Skip Menu |

This queue is for tickets about the Text-LTSV CPAN distribution.

Report information
The Basics
Id: 88545
Status: open
Priority: 0/
Queue: Text-LTSV

People
Owner: Nobody in particular
Requestors: ANDK [...] cpan.org
Cc: ZEFRAM [...] cpan.org
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.07
Fixed in: (no value)



CC: ZEFRAM [...] cpan.org
Subject: Fails with Carp 1.32
As per subject. I'm not sure whose bug it is. I see that Carp 1.32 is localizing $! so you cannot get at the $! that happens within Carp. The test failing is test 5 in t/02_parse_file.t which goes like eval { $p->parse_file('./t/not_found') }; ok $! == Errno::ENOENT; Within the eval the relevant line executed is: my $fh = IO::File->new($path, $opt->{utf8} ? '<:utf8' : 'r') or croak $!; I'm CC'ing Zefram, maybe he can shed some light on the plans about Carp and $!. HTH && Thanks,
Subject: Re: [rt.cpan.org #88545] Fails with Carp 1.32
Date: Mon, 9 Sep 2013 17:58:32 +0100
To: Andreas Koenig via RT <bug-Text-LTSV [...] rt.cpan.org>
From: Zefram <zefram [...] fysh.org>
Andreas Koenig via RT wrote: Show quoted text
>I'm not sure whose bug it is. I see that Carp 1.32 is localizing $!
What's going on is that "croak $!" passes *a reference to* $! into croak, rather than passing in its string value. The localisation modifies the string value, so when it eventually gets stringified in the middle of Carp::shortmess() it produces the wrong string. I think Carp should stringify the argument earlier, before the localisation. -zefram
CC: ANDK [...] cpan.org
Subject: Re: [rt.cpan.org #88545] Fails with Carp 1.32
Date: Mon, 9 Sep 2013 21:01:41 +0100
To: Zefram via RT <bug-Text-LTSV [...] rt.cpan.org>
From: Zefram <zefram [...] fysh.org>
I wrote: Show quoted text
>I think Carp should stringify the argument earlier, before the >localisation.
It gets worse. It turns out that the localisation of $! doesn't actually work if $! is a sub argument somewhere on the stack: $ perl -MCarp -lwe '$!=69; my $a = Carp::longmess($!); print "errno=",$!; print $a;' errno= at -e line 1. Certain quite-common operations on @_ break "local $!" if one of the args is $!. This gets detected in t/errno.t as soon as it's extended to use $! as an error message argument, even before you start looking for the stringified $! in the formatted error message. I've reported this as [perl #119683]. Right now I have no way to make the localisation work reliably. You can work around your original problem by stringifying $! yourself before handing it off to Carp. Use 'croak "$!"' instead of 'croak $!'. -zefram