EigenFunctions has asked for the wisdom of the Perl Monks concerning the following question:

I can't get the XREF feature to work with v5.10 (I have used it in previous versions). Here is the response I get (first is the version info for PERL):
perl -v This is perl, v5.10.0 built for MSWin32-x86-multi-thread (with 9 registered patches, see perl -V for more detail) Copyright 1987-2007, Larry Wall Binary build 1005 [290470] provided by ActiveState http://www.ActiveSt +ate.com Built May 24 2009 12:17:36 Perl may be copied only under the terms of either the Artistic License + or the GNU General Public License, which may be found in the Perl 5 source ki +t. Complete documentation for Perl, including FAQ lists, should be found +on this system using "man perl" or "perldoc perl". If you have access to + the Internet, point your browser at http://www.perl.org/, the Perl Home Pa +ge. Perl -MO=Xref "CTA Plot All.pl" Can't locate object method "NAME" via package "B::SPECIAL" at C:/Apps/ +Perl/v5_10/lib/B/Xref.pm line 162. CHECK failed--call queue aborted.
Can anyone help?

========================================================== new info

I just ran 5 perl program sources and 2 of the 5 worked without errors! So it must have something to do with the code. These are rather large programs (~500 to ~2000 lines).

Thanks,

EigenFunctions

Replies are listed 'Best First'.
Re: Perl -MO=Xref not working for V5.10 (uts,L)
by tye (Sage) on Sep 23, 2009 at 16:04 UTC

    I see a lot of code in http://search.cpan.org/src/DAPM/perl-5.10.1/ext/B/B/Xref.pm that is careful to skip sections of code that might call ->NAME() if the class to be used would be "SPECIAL". Indeed, line 162 falls at the end of this chunk of code:

    next unless class($valsv) eq "GV"; next if class($valsv->STASH) eq 'SPECIAL'; # these pad GVs don't have corresponding names, so same @pad # array can be used without collisions $pad[$ix] = [$valsv->STASH->NAME, "*", $valsv->NAME];

    Which seems to make it impossible for either $valsv or $valsv->STASH() to be objects from B::SPECIAL. But you don't say what version of B::Xref you are using so perhaps line 162 is from quite different code for you, but that seems unlikely given that you are using 5.10 and that line 162 actually does contain attempts to ->NAME().

    I'd look at the code involved in more detail to figure out how those checks are managing to fail to protect against attempts to use B::SPECIAL->NAME(). I'd start by trying to use "perl -d" for that, but some seem to have pronounced difficulty with that and the "CHECK failed" error might indicate that it would be more challenging than usual in this case. But you can also just add some debugging print statements to the B::Xref code.

    - tye        

Re: Perl -MO=Xref not working for V5.10
by Anonymous Monk on Sep 24, 2009 at 02:22 UTC
    This problem appears to be solved in 5.10.1 (this program works)
    C:\>perl -MO=Xref -de 1 Loading DB routines from perl5db.pl version 1.3 Editor support available. Enter h or `h h' for help, or `perldoc perldebug' for more help. Can't locate object method "NAME" via package "B::SPECIAL" at C:/straw +berry/perl/lib/B/Xref.pm line 162. CHECK failed--call queue aborted. at -e line 0
      Strange, the link you posted is from a thread dated May2007, over two years ago. So I wonder if going to v5.10.1 will really help.

      Thanks,

      EigenFunctions

        I tested it ( perl -MO=Xref -de 1) in 5.10.0 and it did not work.

        I tested it ( perl -MO=Xref -de 1) in 5.8.9 and it did work.

        I tested it ( perl -MO=Xref -de 1) in 5.10.1 and it did work.