[Chicago-talk] fun with Carp

Pete Krawczyk mongers at bsod.net
Tue Jul 31 11:54:51 PDT 2007


Subject: Re: [Chicago-talk] fun with Carp
From: Kent Cowgill <kent at c2group.net>
Date: Tue, 31 Jul 2007 12:21:48 -0500

}$Carp::CarpLevel = 1;

That seems sane, but if you do that, localize it to the scope where it's 
needed, or else other modules relying on Carp may behave unexpectedly (or 
change that value out from under you!)

  sub quit {
      my $error_msg = shift;
      # ... do some other stuff here, and then, the coup de grace:
      { 
        local $Carp::CarpLevel = 1;
        # Alternately, to be more robust:
        # local $Carp::CarpLevel = $Carp::CarpLevel + 1;
        Carp::croak($error_msg);
      }
  }


-Pete K
-- 
Pete Krawczyk
    Chicago Perl Mongers
    mongers at bsod dot net


More information about the Chicago-talk mailing list