Skip to content

Instantly share code, notes, and snippets.

@syohex
Created November 5, 2012 14:29
Show Gist options
  • Save syohex/4017457 to your computer and use it in GitHub Desktop.
Save syohex/4017457 to your computer and use it in GitHub Desktop.
Sample of Carp::CarpLevel
#!perl
use strict;
use warnings;
package Fuga;
sub bar {
Carp::croak("I'm bar");
}
package Hoge;
use Carp ();
sub foo {
local $Carp::CarpLevel = $Carp::CarpLevel + 1;
Fuga::bar();
}
package main;
Hoge::foo();
syohei@ibanez:% perl level.pl
I'm bar at level.pl line 22.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment