[Chicago-talk] fun with Carp

Steven Lembark lembark at wrkhors.com
Tue Jul 31 10:27:04 PDT 2007


> I can't tell if there's something obvious I'm forgetting or missing, or
> if Carp's just so geared for OOP that it's completely incapable of DWIM
> in scripting uses like this.

Check if something you are using is setting:

  $Carp::Verbose = 1;

I use this to turn on tracing in my own code:

  log_trace =>
  sub
  {
    # log a full stack trace but avoid pushing the entire stack
    # back to the caller in $@.

*   local $Carp::CarpLevel  = 1;
*   local $Carp::Verbose    = 1;

    my ( undef, $file, $line ) = caller 1;

    my $err_msg = &$extract_first_scalar;

    push @_, '';

    my $message = &$format;

    carp $message;

    die "$err_msg at $file, $line\n";
  },


-- 
Steven Lembark                                         85-09 90th Street
Workhorse Computing                                  Woodhaven, NY 11421
lembark at wrkhors.com                                      +1 888 359 3508


More information about the Chicago-talk mailing list