CC: | Russell Jenkins <russell.jenkins [...] strategicdata.com.au> |
Subject: | Exception::Class::Base calls Exception::Class without using it first |
Date: | Fri, 07 May 2010 10:31:06 +1000 |
To: | bug-Exception-Class [...] rt.cpan.org |
From: | Alex Peters <alex.peters [...] strategicdata.com.au> |
Distribution name and version:
Exception-Class-1.30
Perl version:
5.8.8
Operating System vendor and version:
Linux 2.6.28-18-generic #60-Ubuntu SMP Fri Mar 12 04:26:47
UTC 2010 x86_64 GNU/Linux
Exception::Class::Base features direct calls to
Exception::Class, but doesn't ensure that this module has been
loaded first. Attached is a test to replicate the unexpected
behaviour.
A simple "use Exception::Class" statement near the top of this
module will solve the problem.
#!/usr/bin/perl
package AnException;
use strict;
use warnings;
use parent 'Exception::Class::Base';
# We deliberately do not "use Exception::Class" here because we don't
# call it directly.
package main;
use strict;
use warnings;
use Test::More (tests => 1);
# We deliberately do not "use Exception::Class" here because we don't
# call it directly anywhere. We would "use AnException" here if
# AnException were defined in another file.
eval { AnException->throw };
ok(
AnException->caught,
'AnException->caught should return true without error',
);