Subject: | croak reports in the context of Class::Std instead of caller |
Calling croak inside a BUILD block reports the error at Class:std line
438 instead of the line from the calling package.
use Class::Std
{
my (%file_of,) :ATTRS;
sub BUILD
{
my ($self, $oid, $arg_ref) = @_;
$file_of{$oid} = $arg_ref{file} or croak "Missing initializer";
}
}
This is a very simple example and init_arg would work but croaking on
more complex initialization yields difficult to trace error messages.
Perl v. 5.8.7
Carp v. 1.0.4
FreeBSD 6.0-STABLE