Hi Manfred,
On Tue, 31 Mar 2015 10:28:13 +0200
Manfred Lotz <[email protected]> wrote:
> Hi there,
> I have a script where I use croak and somebody else using that script
> gets
>
> Bizarre copy of HASH in list assignment
> at /usr/share/perl/5.20/Carp.pm line 228.
>
> I get a message like this, instead:
>
> Variable b has empty value! at ./x.pl line 23.
> main::myfunc() called at ./x.pl line 8
>
> which is what should happen.
>
> Any idea what this message means? I'm not able to reproduce it.
>
> Here a minimal example:
>
> #! /usr/bin/perl
>
> use strict;
> use warnings;
>
> use Carp;
>
> myfunc();
>
>
>
> sub myfunc {
> my %vars = (
> 'a' => 'some val',
> 'b' => q{},
> );
>
> while ( my ( $key, $val ) = each %vars ) {
> if ( not defined $val ) {
> croak "No value given for $key";
> }
> if ( $val eq q{} ) {
> croak "Variable $key has empty value!";
> }
> }
> return;
> }
>
This code looks fine to me (except for some \t|4-space-indent mixup, which is
relatively minor). I cannot reproduce the reported problem here
( perl-5.20.1-8.mga5 on Mageia Linux x86-64 5 - I'm getting something similar
to what you are getting).
Can you please ask your friend for:
1. Operating system + version.
2. The perl 5 distribution and its version.
3. Version of Carp.pm and the surrounding lines.
4. Other parameters of their environment.
Maybe this way we'll be able to reproduce it.
Regards,
Shlomi Fish
--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
http://www.shlomifish.org/humour/bits/facts/Summer-Glau/
95% of Programmers consider 95% of the code they did not write, in the bottom
5%.
Please reply to list if it's a mailing list post - http://shlom.in/reply .
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/