Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

mpeters (5802)

mpeters
  (email not shown publicly)
http://petersfamily.org/
AOL IM: michael00peters (Add Buddy, Send Message)

Technorati Profile [technorati.com]

Journal of mpeters (5802)

Tuesday September 15, 2009
04:48 PM

Help needed on a new 5.10 warning

[ #39632 ]
I'm trying to run an existing application on 5.10 for the first time (5.10.0 for right now) and am getting a warning that is not making it easy for me to track down. Any help from the lazy web would be appreciated.

It goes like this:

  Variable "$x" is not available at (re_eval 1070) line 1.

I'm assuming this is pretty deep inside some dependency I'm using (of which my application probably has an old version which doesn't play nicely with 5.10). Google is no help here as it returns a lot of CPAN testers results with the same warning for various modules (http://www.mail-archive.com/cpan-testers@perl.org/msg652326.html, http://trouchelle.com/perl/ppmrepview.pl?id=33577&v=10).

My normal trick of using

  $SIG{__WARN__} = \*Carp::cluck;

to get a nice stack trace of where the warning is coming from is not actually giving me a stack trace. Anyone have any extra ideas?

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • The code that throws that warning is in pad.c. Below is the code. I think the comment explains why the warning is being thrown. /* trying to capture from an anon prototype? */ if (CvCOMPILED(cv) ? CvANON(cv) && CvCLONE(cv) && !CvCLONED(cv) : *out_flags & PAD_FAKELEX_ANON) { if (warn && ckWARN(WARN_CLOSURE)) Perl_warner(aTHX_ packWARN(WARN_CLOSURE),
    • Yeah, I was also able to trace where in the *perl* code the warning was coming from, but I'm trying to figure out which *module* in the huge tree of modules being used is using a construct that is causing the warning to be thrown.

  • All I can offer is that during some recent attempts to refactor ExtUtils::ParseXS, I encountered this warning when attempting to make that module work under 'use strict'. IIRC, I got it in a part of the code that was using the "deferred regex evaluation" feature -- ??{ $some_variable } -- inside of itself.

    $bal = qr[(?:(?>[^()]+)|\((??{ $bal })\))*]; # ()-balanced

    $cast = qr[(?:\(\s*SV\s*\*\s*\)\s*)?]; # Optional (SV*) cast

    $size = qr[,\s* (??{ $bal }) ]x; # Third arg (to setpvn)

    Again

    • Thanks for the advice. I eventually tracked it down to Regexp::Common and was able to remove the warning if I just imported the number specific regexes:

        use Regexp::Common qw(number);

  • I've found success with the Carp::Always module. All I have to do is say "use Carp::Always" at the top of my program, and any time an exception is thrown it includes a stack trace, which is great for diagnosing all the exceptions from 'use strict' or 'use warnings fatal'. That said it /may/ not be compatible with other attempts to override the signal handlers. I now make it common practice to put "use Carp::Always" at the top of all my module t/*.t files.

    • I hope using -MCarp::Always on the command line has the same effect as editing use Carp::Always; into the code?
      • I found that the effects of 'use Carp::Always' are global in scope, so I assume that loading it with -M on the command line will work as well as placement into code.