On Wed, Mar 29, 2000 at 02:31:21PM +0200, Steffen Beyer wrote:
> > a shame to add a complete new module for this. But if a new module
> > is require I would suggest a name under Carp::
>
> Something like Carp::Date?
Why limit it to Date ? It should be more general but I cannot think
of a name. Carp::Package Carp::SkipHier ...
> > I suspect the package is quite simple too.
>
> The changes are quite minimal. Maybe one could change the Carp.pm in
> the CORE so that "croak" and "carp" etc. would accept an additional
> parameter or flag (or configuration global) to instruct Carp.pm to skip
> certain packages; either the named package hierarchy, or the caller's
> package hierarchy.
>
> > > All "Date::*" modules can use and profit from this module.
> > So can others
>
> Yes, if one could change this into a more general solution, as described
> above. Certainly.
I was expecting something like
sub carp {
my $pkg = caller;
$pkg =~ s/::.*//;
my $level = $Carp::CarpLevel;
local $Carp::CarpLevel = 1;
1 while caller($Carp::CarpLevel++) =~ /^$pkg(::|$)/;
$Carp::CarpLevel += $level;
Carp::carp @_;
}
And likewise for the other subs in Carp too.
Graham.