Skip Menu |

This queue is for tickets about the Devel-TraceSubs CPAN distribution.

Report information
The Basics
Id: 13287
Status: new
Priority: 0/
Queue: Devel-TraceSubs

People
Owner: Nobody in particular
Requestors: david [...] landgren.net
Cc:
AdminCc:

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



Subject: Getting a "Modification of non-creatable array value attempted, subscript -1"
The following code causes Devel::TraceSubs (v0.02) to die a horrible death. It's my own fault, so I can work around it to get D::TS to work. Thus, non-urgent. I've had a look at the code but I don't see an easy way to fix it. I would consider it sufficient to merely warn of the failure mode (Don't Do That Then!) in the documentation. The nastiness is in the guts subroutine. In real life, Devel::DProf showed that it was a considerably hot, so I save a certain amount of time by not setting up a $self lexical, and deferencing $_[0] directly. The exact error message is Modification of non-creatable array value attempted, subscript -1 at /usr/local/lib/perl5/site_perl/5.8.7/Devel/TraceSubs.pm line 116. You can run the script as ./try to get it to run normally, or ./try 1 to make it crash (this simply sets the params attribute of the D::TS object. __BEGIN__ #! /usr/local/bin/perl -w package P; use strict; sub new { bless { p => [qw[ foo ]] }, 'P' } sub guts { $_[0]->{p}; } package main; use strict; use Devel::TraceSubs; my $dbg = Devel::TraceSubs->new( params => shift || 0 )->trace( 'P::' ); print P->new->guts, "\n"; __END__