develooper Front page | perl.perl5.porters | Postings from July 2013

Re: Try/Catch Exception Objects: Possible?

Thread Previous | Thread Next
David E. Wheeler
July 26, 2013 12:12
Re: Try/Catch Exception Objects: Possible?
Message ID:
On Jul 26, 2013, at 1:00 PM, Leon Timmermans <> wrote:

>> Now, if there could be some lazy way to reference a point in Perl
>> time/code/memory at the time an exception was thrown, that made it
>> possible to introspect the stack that occurred at that time, in an
>> efficient manner, that'd be cool.

Yeah, this is something I was wondering about, as well.

> That sounds a bit like Yuval's Devel::StackTrace::XS [1]

Hard to tell; no docs!

>> I'd be especially cool, because it wouldn't inherently bind you to
>> having one type of stack trace presentation, and one type of stack
>> trace presentation only, things like Carp::Always could hook in to
>> this facility, ie:
>> if ( $_->isa('exceptionything') ) {
>>   my $stack = CORE::stacktracefor($_);
>>   print $_->message . custom_stacktrace_formatter($stack);
>> }
>> ( The point being its useful to be able to decouple the presentation
>> logic from the actual exception implementation so that presentation
>> can be changed at the top level when needed )
> Agreed

Yes, if this is possible, it would be preferred: Defer iterating over the stack trace until someone asks for it.



Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About