Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Exception-Class CPAN distribution.

Report information
The Basics
Id: 67503
Status: resolved
Priority: 0/
Queue: Exception-Class

People
Owner: Nobody in particular
Requestors: avnermoshkovitz [...] lighthauslogic.com
Cc:
AdminCc:

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



CC: "avner [...] telus.net" <avner [...] telus.net>
Subject: bug-Exception-Class@rt.cpan.org
Date: Fri, 15 Apr 2011 16:56:19 -0700
To: "bug-Exception-Class [...] rt.cpan.org" <bug-Exception-Class [...] rt.cpan.org>
From: Avner Moshkovitz <avnermoshkovitz [...] lighthauslogic.com>
I don't know if this is a bug but I experienced problems when using the packages Exception::Class and Carp together It seems that both packages compete to set the eval_error variable ($@) For example, throwing an object type can result in the eval_error variable ($@) after the eval statement getting a scalar type if the Carp is fast enough to set a string (of type scalar) that contains the error stack. The result is that the catcher after the eval statement sees a different type than what it expects and does not react as planned. I obsereved this problem on one machine while on a different machine with the identical packages, the type after the eval statement was of subclass of Exception::Class as expected. Confirmed that the following packages are identical on both machines Exception::Class, Exception::Class::Base, Carp, Carp::Heavy, Carp::Always Running on Linux Fedora Core 11 Carp.pm - Version 1.08 Exception::Class.pm - Version 1.32 Exception::Class::Base - Version 1.32 Carp::Always - Version 0.09 Regards, Avi This e-mail may contain information that is privileged, confidential or otherwise exempt from disclosure under applicable laws. Unauthorized use, reproduction or dissemination of the e-mail is strictly prohibited. If you have received this e-mail in error, please contact the sender immediately. [11EABB509DF]
Subject: Re: [rt.cpan.org #67503] bug-Exception-Class@rt.cpan.org
Date: Fri, 15 Apr 2011 19:19:57 -0500 (CDT)
To: Avner via RT <bug-Exception-Class [...] rt.cpan.org>
From: Dave Rolsky <autarch [...] urth.org>
On Fri, 15 Apr 2011, Avner via RT wrote: Show quoted text
> I don't know if this is a bug but I experienced problems when using the packages Exception::Class and Carp together > It seems that both packages compete to set the eval_error variable ($@)
Neither module sets it explcititly. If you call die inside an eval, that sets it. If you call MyException->throw, that calls die. Carp can call die too. I don't really understand what you're reporting, but doesn't sound like a bug to me. $@ is a kind of interpreter "super global". That means its easy to step on its value. Do you have code to demonstrate the problem? -dave /*============================================================ http://VegGuide.org http://blog.urth.org Your guide to all that's veg House Absolute(ly Pointless) ============================================================*/
From: avnermoshkovitz [...] lighthauslogic.com
Show quoted text
> Do you have code to demonstrate the problem? >
Unfortunately, the problem shows up in context os a bigger chunk of code, and even there not persistantly (it happens on one machine but not on the other) I verified that the last one to call "die" is the line "die $proto->new(@_);" in sub throw in the package Exception::Class::Base.pm Printing the value of $@, gives an Exception::Class subclass object type, as expected. However, after the eval statement, printing the value of $@ shows the stack trace, that is coming from Carp, as if I was calling "die" directly instead of "throw". After removing the all calls to the Carp package throughout the system, I am getting the correct value (Exception::Class subclass object type) for $@ after the eval statement
Subject: Re: [rt.cpan.org #67503] bug-Exception-Class@rt.cpan.org
Date: Mon, 18 Apr 2011 15:27:18 -0500 (CDT)
To: Avner via RT <bug-Exception-Class [...] rt.cpan.org>
From: Dave Rolsky <autarch [...] urth.org>
On Mon, 18 Apr 2011, Avner via RT wrote: Show quoted text
> Queue: Exception-Class > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=67503 > >
>> Do you have code to demonstrate the problem? >>
> Unfortunately, the problem shows up in context os a bigger chunk of > code, and even there not persistantly > (it happens on one machine but not on the other) > I verified that the last one to call "die" is the line "die > $proto->new(@_);" in sub throw in the package Exception::Class::Base.pm > Printing the value of $@, gives an Exception::Class subclass object > type, as expected. > However, after the eval statement, printing the value of $@ shows the > stack trace, that is coming from Carp, as if I was calling "die" > directly instead of "throw". > After removing the all calls to the Carp package throughout the system, > I am getting the correct value > (Exception::Class subclass object type) for $@ after the eval statement
Right, the last die() call sets $@. This is not a bug, it's just how Perl works. -dave /*============================================================ http://VegGuide.org http://blog.urth.org Your guide to all that's veg House Absolute(ly Pointless) ============================================================*/
Subject: RE: [rt.cpan.org #67503] bug-Exception-Class@rt.cpan.org
Date: Mon, 18 Apr 2011 13:37:47 -0700
To: "bug-Exception-Class [...] rt.cpan.org" <bug-Exception-Class [...] rt.cpan.org>
From: Avner Moshkovitz <avnermoshkovitz [...] lighthauslogic.com>
When having "use Carp.pm" in the perl script, calling Exception::Class::mySubclass::throw results in: 1. The call to "throw" trickles into the sub "throw" in the package Exception::Class::Base.pm. The call "die" in the line "die $proto->new(@_);"yields the correct type (i.e. an Exception::Class subclass object type ) 2. But $@ after the eval statement shows a wrong type (type scalar). How can this happen? Regards, Avner Show quoted text
> -----Original Message----- > From: autarch@urth.org via RT [mailto:bug-Exception-Class@rt.cpan.org] > Sent: April 18, 2011 1:27 PM > To: Avner Moshkovitz > Subject: Re: [rt.cpan.org #67503] bug-Exception-Class@rt.cpan.org > > <URL: http://rt.cpan.org/Ticket/Display.html?id=67503 > > > On Mon, 18 Apr 2011, Avner via RT wrote: >
> > Queue: Exception-Class > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=67503 > > >
> >> Do you have code to demonstrate the problem? > >>
> > Unfortunately, the problem shows up in context os a bigger chunk of > > code, and even there not persistantly > > (it happens on one machine but not on the other) > > I verified that the last one to call "die" is the line "die > > $proto->new(@_);" in sub throw in the package Exception::Class::Base.pm > > Printing the value of $@, gives an Exception::Class subclass object > > type, as expected. > > However, after the eval statement, printing the value of $@ shows the > > stack trace, that is coming from Carp, as if I was calling "die" > > directly instead of "throw". > > After removing the all calls to the Carp package throughout the system, > > I am getting the correct value > > (Exception::Class subclass object type) for $@ after the eval statement
> > Right, the last die() call sets $@. This is not a bug, it's just how Perl > works. > > > -dave > > /*============================================================ > http://VegGuide.org http://blog.urth.org > Your guide to all that's veg House Absolute(ly Pointless) > ============================================================*/
This e-mail may contain information that is privileged, confidential or otherwise exempt from disclosure under applicable laws. Unauthorized use, reproduction or dissemination of the e-mail is strictly prohibited. If you have received this e-mail in error, please contact the sender immediately. [11EABB509DF]
Subject: RE: [rt.cpan.org #67503] bug-Exception-Class@rt.cpan.org
Date: Mon, 18 Apr 2011 15:42:00 -0500 (CDT)
To: Avner via RT <bug-Exception-Class [...] rt.cpan.org>
From: Dave Rolsky <autarch [...] urth.org>
On Mon, 18 Apr 2011, Avner via RT wrote: Show quoted text
> When having "use Carp.pm" in the perl script, calling Exception::Class::mySubclass::throw results in: > 1. The call to "throw" trickles into the sub "throw" in the package Exception::Class::Base.pm. The call "die" in the line "die $proto->new(@_);"yields the correct type (i.e. an Exception::Class subclass object type ) > 2. But $@ after the eval statement shows a wrong type (type scalar). > > How can this happen?
Unless you can provide an example I cannot help you, and I don't think what you're describing sounds like a bug. Simple _using_ Carp will not even _do_ anything other than export some functions into your namespace. It does not magically break Exception::Class. -dave /*============================================================ http://VegGuide.org http://blog.urth.org Your guide to all that's veg House Absolute(ly Pointless) ============================================================*/
Subject: RE: [rt.cpan.org #67503] bug-Exception-Class@rt.cpan.org
Date: Mon, 18 Apr 2011 13:43:40 -0700
To: "bug-Exception-Class [...] rt.cpan.org" <bug-Exception-Class [...] rt.cpan.org>
From: Avner Moshkovitz <avnermoshkovitz [...] lighthauslogic.com>
Ok, thanks for your response. I will try to come back with isolated code that demonstrates the problem. Regards, Avner Show quoted text
> -----Original Message----- > From: autarch@urth.org via RT [mailto:bug-Exception-Class@rt.cpan.org] > Sent: April 18, 2011 1:42 PM > To: Avner Moshkovitz > Subject: RE: [rt.cpan.org #67503] bug-Exception-Class@rt.cpan.org > > <URL: http://rt.cpan.org/Ticket/Display.html?id=67503 > > > On Mon, 18 Apr 2011, Avner via RT wrote: >
> > When having "use Carp.pm" in the perl script, calling
> Exception::Class::mySubclass::throw results in:
> > 1. The call to "throw" trickles into the sub "throw" in the package
> Exception::Class::Base.pm. The call "die" in the line "die $proto-
> >new(@_);"yields the correct type (i.e. an Exception::Class subclass object type ) > > 2. But $@ after the eval statement shows a wrong type (type scalar). > > > > How can this happen?
> > Unless you can provide an example I cannot help you, and I don't > think what you're describing sounds like a bug. > > Simple _using_ Carp will not even _do_ anything other than export some > functions into your namespace. It does not magically break > Exception::Class. > > > -dave > > /*============================================================ > http://VegGuide.org http://blog.urth.org > Your guide to all that's veg House Absolute(ly Pointless) > ============================================================*/
This e-mail may contain information that is privileged, confidential or otherwise exempt from disclosure under applicable laws. Unauthorized use, reproduction or dissemination of the e-mail is strictly prohibited. If you have received this e-mail in error, please contact the sender immediately. [11EABB509DF]