On Fri, Jan 30, 2004 at 12:18:51AM -0600, Dave Rolsky <[EMAIL PROTECTED]> wrote: > On Thu, 29 Jan 2004, Daisuke Maki wrote: > > > > Can't this be done with the @CARP_NOT variable? > > > > Hmmm, I was trying to do this: > > > > sub on_fail { > > my($class, $input) = @_; > > local @Carp::CARP_NOT = qw( PKGS ... ); > > croak $input; > > } > > > > But somehow the messages where unaltered, so now I look at Carp.pm from > > my perl 5.8.3, and I see the following: > > > > sub shortmess { # Short-circuit &longmess if called via multiple packages > > { local $@; require Carp::Heavy; } # XXX fix require to not clear [EMAIL > > PROTECTED] > > # Icky backwards compatibility wrapper. :-( > > my $call_pack = caller(); > > local @CARP_NOT = caller(); # <<< RIGHT HERE > > shortmess_heavy(@_); > > } > > > > Hmph. local @CARP_NOT = caller()? > > It's overriding @CARP_NOT regardless of what the caller has done...? > > > > Dave, mind if I just fall back to what I initially proposed? > > Sure, that's fine. Looks like Carp is a bit broken.
That bit sets @Carp::CARP_NOT. In your code you should be setting @Your::Module::CARP_NOT. It's intended to be set just once, like @ISA, not just before calling carp.