Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

mapping warning from an eval code to actual line in text

by ISAI student (Scribe)
on May 10, 2013 at 11:18 UTC ( #1032936=perlquestion: print w/ replies, xml ) Need Help??
ISAI student has asked for the wisdom of the Perl Monks concerning the following question:

Hello all. I am running a very lengthy code (too lengthy to upload, and may be proprietary). I am getting these warnings:
eval {...} called at /edata/eng/ldagan/voodoo_from_1.1.7.b4/bi +n/../DesignLibs/ScriptLib/Generic/WMPerl/voodoo/voodooThreads.pm line + 73 thread 3 Use of uninitialized value $_ in pattern match (m//) at (eval 60) line + 1, <$SIM_F> line 50. Use of uninitialized value $_ in pattern match (m//) at (eval 61) line + 1, <$SIM_F> line 50.
I have tried to look, but could not find any pattern match that uses $_ in the file. I could be missing something, of course. Line 73 is:
$thread = threads->create(\&executeSimThread, $tb, $i, "Thread data " +. $i, $all_shary_for_subs, $global_non_share_ref );
I could not find in the subroutine any usage of $_ in pattern matching. Thanks.

Comment on mapping warning from an eval code to actual line in text
Select or Download Code
Re: mapping warning from an eval code to actual line in text
by choroba (Abbot) on May 10, 2013 at 11:27 UTC
    Note that the special variable $_ does not have to be specified in pattern matching:
    #!/usr/bin/perl use warnings; undef $_; $x = 'abcd'; print 'yes' if $x = /a/;

    The above code gives no output and the following warning:

    Use of uninitialized value $_ in pattern match (m//) at ./1.pl line 6.
    لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
      Good one... I'll have a look. Still don't know how to map the numbers in eval to the code... But, it gives me something to try... Thanks.
Re: mapping warning from an eval code to actual line in text
by kcott (Abbot) on May 10, 2013 at 11:39 UTC

    G'day ISAI student,

    "I could not find in the subroutine any usage of $_ in pattern matching. Thanks."

    $_ is the default variable to match against (see perlrequick). So, $_ =~ /$pat/ can be written as just /$pat/. I can only suggest that you might need to be looking for constructs like:

    if (/$pat/) { ... for (m{$pat}g) { ...

    -- Ken

Re: mapping warning from an eval code to actual line in text
by BrowserUk (Pope) on May 10, 2013 at 11:56 UTC

    See Re: Re: Re: Line Numbers for an idea that might allow you to track down your evals more easily.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
Re: mapping warning from an eval code to actual line in text
by tobyink (Abbot) on May 10, 2013 at 12:12 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1032936]
Approved by moritz
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2014-12-27 00:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (176 votes), past polls