On Tue, 15 May 2007, Charlie Katz wrote:
> 3) throw() calls die, which causes Devel::StackTrace to be called to create a
> stack trace
>
> The problem occurring in Devel::StackTrace, in
> _ref_as_string. I put some debugging statements in there.
>
> sub _ref_as_string
> {
> my $self = shift;
> local $@;
>
> # some print STDERR statements here to examine the values used in the
> # if() test
> if ( ref $_[0] &&
> ! $self->{respect_overload} &&
> eval { overload::Overloaded($_[0]) }
> )
> {
> return overload::StrVal($_[0]);
> }
> else
> {
> # force stringification
> $_[0] . '';
> }
> }
>
> When this runs for the dummy class, the else clause is
> taken. The dummy object looks like
>
> bless {}, 'Class::DBI::Object::Has::Been::Deleted';
>
> and that's it. So in the if() test, I find from my diagnostic print
> statements,
>
> ref $_[0] is TRUE
> $self->{respect_overload} is FALSE
> eval { overload::Overloaded($_[0]) } is FALSE
>
> that last one, because the dummy object isn't overloaded, makes the if() test
> fail, so the else clause is taken, where the object stringification fails.
Which makes no sense, since it's clearly overloaded ;)
But anyway, I've simplified the code in the latest release and removed
this last check, so that may help you.
> For this case at least, it appears that the if() logic is wrong: shouldn't the
> eval { overload::Overloaded($_[0]) } test be !eval{ ... } ? If the object
> doesn't have any overloading, the code shouldn't try to force
> stringification, should it? I'm must not be understanding how
> Devel::StackTrace works.
If the object has overloading, we want to use overload::StrVal instead of
risking letting the object's stringification overloading kick in. That
_is_ the problem you're seeing, somehow the overloading kicks in and
throws an exception.
Anyway, I think this may be fixed in Devel::StackTrace 1.14+, as a side
effect of some other code changes.
-dave
/*===================================================
VegGuide.Org www.BookIRead.com
Your guide to all that's veg. My book blog
===================================================*/
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Mason-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mason-users