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: 104903
Status: rejected
Priority: 0/
Queue: Exception-Class

People
Owner: Nobody in particular
Requestors: abeltje [...] cpan.org
Cc:
AdminCc:

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



Subject: «perl -wc» Warns in perl-5.16 and up
package AnException; use warnings; use strict; use base 'Exception::Class'; use Exception::Class ( 'AnException', 'AnException::ToThrow' => { isa => 'AnException', description => 'This is warns in 5.16+', }, ); 1; __END__ $ perl5142 -I. -cw AnException.pm AnException.pm syntax OK $ perl5163 -I. -cw AnException.pm Subroutine description redefined at (eval 8) line 10. AnException.pm syntax OK
On Wed Jun 03 04:53:20 2015, ABELTJE wrote: Show quoted text
> package AnException; > use warnings; > use strict; > > use base 'Exception::Class'; > > use Exception::Class ( > 'AnException', > 'AnException::ToThrow' => { > isa => 'AnException', > description => 'This is warns in 5.16+', > }, > ); > > 1; > __END__ > > $ perl5142 -I. -cw AnException.pm > AnException.pm syntax OK > > $ perl5163 -I. -cw AnException.pm > Subroutine description redefined at (eval 8) line 10. > AnException.pm syntax OK
There is a small bug here, but it's only surfacing because the package where you "use Exception::Class" is also the name of one of your exception classes. I would recommend not doing that.
Actually, thinking about this a bit more, I don't think this is a bug in Exception::Class. It should try to load the specified parent classes of an exception it's generating, since it's possible to use a class defined on disk as a parent. Also, the "-w" option is not recommended, as it globally enabled warnings for all code. The warnings pragma lets people enable warnings (or not), as needed.
On Sat Jun 06 16:20:16 2015, DROLSKY wrote: Show quoted text
> On Wed Jun 03 04:53:20 2015, ABELTJE wrote:
> > package AnException; > > use warnings; > > use strict; > > > > use base 'Exception::Class'; > > > > use Exception::Class ( > > 'AnException', > > 'AnException::ToThrow' => { > > isa => 'AnException', > > description => 'This is warns in 5.16+', > > }, > > ); > > > > 1; > > __END__ > > > > $ perl5142 -I. -cw AnException.pm > > AnException.pm syntax OK > > > > $ perl5163 -I. -cw AnException.pm > > Subroutine description redefined at (eval 8) line 10. > > AnException.pm syntax OK
> > There is a small bug here, but it's only surfacing because the package > where you "use Exception::Class" is also the name of one of your > exception classes. I would recommend not doing that.
Fwiw, That's not it: package AnException::Class; use warnings; use strict; use base 'Exception::Class'; use Exception::Class ( 'AnException', 'AnException::ToThrow' => { isa => 'AnException', description => 'This is warns in 5.16+', }, ); 1; __END__ $ perl5142 -wc AnException/Class.pm AnException/Class.pm syntax OK $ perl5163 -wc AnException/Class.pm Subroutine description redefined at (eval 8) line 10. AnException/Class.pm syntax OK