Skip Menu |

This queue is for tickets about the NEXT CPAN distribution.

Report information
The Basics
Id: 25053
Status: resolved
Priority: 0/
Queue: NEXT

People
Owner: Nobody in particular
Requestors: jloverso [...] mathworks.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.60
Fixed in: (no value)



Subject: uninitialized variable warning in the debugger when using NEXT::AUTOLOAD + warnings
Using the debugger with code using NEXT::AUTOLOAD causes an uninit variable warning from within the debugger code. Using the attached example script: $ perl -dw /tmp/next.pl Loading DB routines from perl5db.pl version 1.28 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main::(/tmp/next.pl:17): my $obj = bless {}, "CN"; DB<1> c CN=HASH(0x94a660): CN AUTOLOAD Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/5.8.8/perl5db.pl line 3617. at /usr/lib/perl5/5.8.8/perl5db.pl line 3617 CN::AUTOLOAD('CN=HASH(0x94a660)') called at /tmp/next.pl line 18 CN=HASH(0x94a660): BN AUTOLOAD Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/5.8.8/perl5db.pl line 3617. at /usr/lib/perl5/5.8.8/perl5db.pl line 3617 BN::AUTOLOAD('CN=HASH(0x94a660)') called at /usr/lib/perl5/5.8.8/NEXT.pm line 80 NEXT::AUTOLOAD('CN=HASH(0x94a660)') called at /tmp/next.pl line 13 CN::AUTOLOAD('CN=HASH(0x94a660)') called at /tmp/next.pl line 18 CN=HASH(0x94a660): AN AUTOLOAD Debugged program terminated. Use q to quit or R to restart, The error is from DB::sub, in the assignment to $al: # If the last ten characters are C'::AUTOLOAD', note we've traced # into AUTOLOAD for $sub. if ( length($sub) > 10 && substr( $sub, -10, 10 ) eq '::AUTOLOAD' ) { $al = " for $$sub"; } When this is called for an AUTOLOAD sub, $sub == 'CN::AUTOLOAD', so $$sub deferences $CN::AUTOLOAD, which is 'CN::method' (in the example script). But, when redispatched to $self->NEXT::AUTOLOAD(), $sub == 'NEXT::AUTOLOAD', and $NEXT::AUTOLOAD isn't set.
Subject: next.pl
use NEXT 0.6; package AN; sub AN::AUTOLOAD { print "$_[0]: AN AUTOLOAD\n" } sub AN::DESTROY { } package BN; use base qw( AN ); sub BN::AUTOLOAD { print "$_[0]: BN AUTOLOAD\n"; $_[0]->NEXT::AUTOLOAD() } package CN; use base qw( BN ); sub CN::AUTOLOAD { print "$_[0]: CN AUTOLOAD\n"; $_[0]->NEXT::AUTOLOAD() } package main; my $obj = bless {}, "CN"; $obj->method();
From: jloverso [...] mathworks.com
Show quoted text
> The error is from DB::sub, in the assignment to $al: > > # If the last ten characters are C'::AUTOLOAD', note we've traced > # into AUTOLOAD for $sub. > if ( length($sub) > 10 && substr( $sub, -10, 10 ) eq '::AUTOLOAD' ) { > $al = " for $$sub"; > }
In case I wasn't clear: that is from perl5db.pl line 3617 (perl 5.8.8) where the uninit warning occurs.
From: jloverso [...] mathworks.com
This patch to perl5db.pl shuts up the warning: 3617c3617 < $al = " for $$sub"; --- Show quoted text
> $al = " for $$sub" if defined $$sub;
From: RGARCIA [...] cpan.org
On Tue Feb 20 20:31:42 2007, jlv wrote: Show quoted text
> This patch to perl5db.pl shuts up the warning: > > 3617c3617 > < $al = " for $$sub"; > ---
> > $al = " for $$sub" if defined $$sub;
Thanks, I've applied this patch as change #32000 to the development version of perl. It will be included in the upcoming releases.