Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Use of uninitialized value in string

by blakem (Monsignor)
on Aug 22, 2002 at 22:23 UTC ( [id://192196]=note: print w/replies, xml ) Need Help??


in reply to Use of uninitialized value in string

Looks odd to me... could it be that line 1434 is actually the troublesome one? Try replacing it with:
1434 if ($args->{src} && $args->{src} eq "commit") {

-Blake

Replies are listed 'Best First'.
Re: Re: Use of uninitialized value in string
by bart (Canon) on Aug 22, 2002 at 22:42 UTC
    No line 1434 can't be the troublemaker because with or without warnings, undef ne 'commit'. The result of this boolean test would be false, and nothing would be printed. And as you can see, there is printout from this block:
    I've got my sources! I'm committed!

    To the op: use Data::Dumper, and print out what's in the dubious variables (here: $arg). If this sub is called a lot without any warnings, then it's better to restrict output to when it is actually useful. For that, I sometimes do things like:

    use Data::Dumper; local $SIG{__WARN__} = sub { print STDERR @_, Dumper $arg };
    You must put that where $arg is in scope, thus in the sub, and it needs to be run before the warning happens.

    Also, print out the line number perl thinks it's on, it's in __LINE__. Sometimes it's off from the actual line number by 1, maybe sometimes even more (though I don't think I've ever seen that happen).

      The line numbering seems to drift when your statement itself is more than one line, or on occasion when the if call is labelled the culprit, when it's actually a line of code in the if-BLOCK. So, it seems that 1431 is the problem, not 1430, and yet, no output is produced to support of that theory.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://192196]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2024-04-25 11:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found