List Info

Thread: Carp /confess enhancement Question




Carp /confess enhancement Question
user name
2007-09-06 15:27:18
I realize it may not be easy (possible?) for args removed
(shift'ed) from
the stack, but is there anyway to show the backtrace with
"available"
arguments ... i.e. something that would work providing you
didn't
remove or alter _ (like my $self=shift;)...For those that
do alter
_,
well -- those frames could show what's left on the stack?

Is this too esoteric or not generally-purpose enough to
include
or perhaps too-complex to explain why backtrace results
might not
correspond to actual args passed?....

Maybe the info is saved somewhere, but assuming it wasn't,
would it
be useful if the stack-backtrace options could, optionally,
be
told to "try" to dump arguments as well?...

Just a thought...(admittedly before 'morning' coffee, but
whatever)...

Linda



Re: Carp /confess enhancement Question
user name
2007-09-06 17:22:30
Linda W wrote:
> I realize it may not be easy (possible?) for args
removed (shift'ed) from
> the stack, but is there anyway to show the backtrace
with "available"
> arguments ... i.e. something that would work providing
you didn't
> remove or alter _ (like my $self=shift;)...For those that
do alter
> _, well -- those frames could show what's left on the
stack?
> 
> Is this too esoteric or not generally-purpose enough to
include
> or perhaps too-complex to explain why backtrace results
might not
> correspond to actual args passed?....
> 
> Maybe the info is saved somewhere, but assuming it
wasn't, would it
> be useful if the stack-backtrace options could,
optionally, be
> told to "try" to dump arguments as well?...
> 
> Just a thought...(admittedly before 'morning' coffee,
but whatever)...

I'm a little unclear on what you want.  Could you give an
example?


-- 
Hating the web since 1994.

Re: Carp /confess enhancement Question
user name
2007-09-06 19:11:59
Quoth perl-diddlertlinx.org (Linda W):
> I realize it may not be easy (possible?) for args
removed (shift'ed) from
> the stack, but is there anyway to show the backtrace
with "available"
> arguments

Like this, you mean? 

~% perl -MCarp=croak -le'sub foo { shift; croak
"bar" } foo 1, 2, 3, 4;'
bar at -e line 1
        main::foo(1, 2, 3, 4) called at -e line 1

> ... i.e. something that would work providing you
didn't
> remove or alter _ (like my $self=shift;)

Some operations destroy the list of arguments: shift does
not, but
splicing _ and assigning to _ both do.

> ...For those that do alter
> _, well -- those frames could show what's left on the
stack?

Removing elements from _ with splice marks unavailable elements
of _
with 'undef'. Unshifting onto _ seems to leave Perl
confused about how
many elements there were to start with: under some
circumstances it
invents a whole lot of 'undef' arguments that were never
there. But
ordinary uses of _ (shift and C<my ($x, $y) = _;>)
leave Perl quite
able to reproduce the list correctly.

Ben


[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )