Peter Scott wrote:
>
> Tony Olekshy wrote:
> >
> >[snip]And the following output was generated:
> >
> > Exception
> >
> > $ = Try::throw('Exception') called from scott2.pm[8].
> > $ = main::pling('Test') called from scott2.pm[4].
> > $ = main::bar('Test') called from scott1.pl[1].
> > $ = main::foo('Test') called from scott1.pl[8].
> > $ = Try::try(CODE(0xca8830)) called from scott1.pl[9].
> > $ = Try::try(CODE(0xca2418), 'catch', CODE(0x10b18ac))
> > called from scott1.pl[8].
> >
> >If I'm not mistaken, exceptions must bubble up through the call
> >stack as at the point the exception is thrown, so if we capture
> >that stack traceback then, we have all the info. Do you still
> >want the file/line array?
>
> Yes, I want to be able to get at it C<caller>-like. You're just
> dumping it.
Ok, but that's just because I was storing it in a string. Instead
of going to all the trouble to format up the string, we can copy
some of those caller fields into an array (one entry per level) of
hashes (one key per value). Like this:
$myException->{stackTrace}->[0]->{file}
$myException->{stackTrace}->[0]->{line}
$myException->{stackTrace}->[0]->{sub}
Yours, &c, Tony Olekshy