| Filename | /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/PPI/Exception.pm |
| Statements | Executed 8 statements in 232µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 12µs | 24µs | PPI::Exception::BEGIN@3 |
| 1 | 1 | 1 | 7µs | 24µs | PPI::Exception::BEGIN@6 |
| 1 | 1 | 1 | 7µs | 28µs | PPI::Exception::BEGIN@4 |
| 1 | 1 | 1 | 3µs | 3µs | PPI::Exception::BEGIN@7 |
| 0 | 0 | 0 | 0s | 0s | PPI::Exception::callers |
| 0 | 0 | 0 | 0s | 0s | PPI::Exception::message |
| 0 | 0 | 0 | 0s | 0s | PPI::Exception::new |
| 0 | 0 | 0 | 0s | 0s | PPI::Exception::throw |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package PPI::Exception; | ||||
| 2 | |||||
| 3 | 2 | 22µs | 2 | 36µs | # spent 24µs (12+12) within PPI::Exception::BEGIN@3 which was called:
# once (12µs+12µs) by PPI::Token::BEGIN@26 at line 3 # spent 24µs making 1 call to PPI::Exception::BEGIN@3
# spent 12µs making 1 call to strict::import |
| 4 | 2 | 21µs | 2 | 49µs | # spent 28µs (7+21) within PPI::Exception::BEGIN@4 which was called:
# once (7µs+21µs) by PPI::Token::BEGIN@26 at line 4 # spent 28µs making 1 call to PPI::Exception::BEGIN@4
# spent 21µs making 1 call to Exporter::import |
| 5 | |||||
| 6 | 2 | 23µs | 2 | 41µs | # spent 24µs (7+17) within PPI::Exception::BEGIN@6 which was called:
# once (7µs+17µs) by PPI::Token::BEGIN@26 at line 6 # spent 24µs making 1 call to PPI::Exception::BEGIN@6
# spent 17µs making 1 call to vars::import |
| 7 | # spent 3µs within PPI::Exception::BEGIN@7 which was called:
# once (3µs+0s) by PPI::Token::BEGIN@26 at line 9 | ||||
| 8 | 1 | 4µs | $VERSION = '1.215'; | ||
| 9 | 1 | 160µs | 1 | 3µs | } # spent 3µs making 1 call to PPI::Exception::BEGIN@7 |
| 10 | |||||
| - - | |||||
| 15 | ##################################################################### | ||||
| 16 | # Constructor and Accessors | ||||
| 17 | |||||
| 18 | sub new { | ||||
| 19 | my $class = shift; | ||||
| 20 | return bless { @_ }, $class if @_ > 1; | ||||
| 21 | return bless { message => $_[0] }, $class if @_; | ||||
| 22 | return bless { message => 'Unknown Exception' }, $class; | ||||
| 23 | } | ||||
| 24 | |||||
| 25 | sub message { | ||||
| 26 | $_[0]->{message}; | ||||
| 27 | } | ||||
| 28 | |||||
| 29 | sub callers { | ||||
| 30 | @{ $_[0]->{callers} || [] }; | ||||
| 31 | } | ||||
| 32 | |||||
| - - | |||||
| 37 | ##################################################################### | ||||
| 38 | # Main Methods | ||||
| 39 | |||||
| 40 | sub throw { | ||||
| 41 | my $it = shift; | ||||
| 42 | if ( _INSTANCE($it, 'PPI::Exception') ) { | ||||
| 43 | if ( $it->{callers} ) { | ||||
| 44 | push @{ $it->{callers} }, [ caller(0) ]; | ||||
| 45 | } else { | ||||
| 46 | $it->{callers} ||= []; | ||||
| 47 | } | ||||
| 48 | } else { | ||||
| 49 | my $message = $_[0] || 'Unknown Exception'; | ||||
| 50 | $it = $it->new( | ||||
| 51 | message => $message, | ||||
| 52 | callers => [ | ||||
| 53 | [ caller(0) ], | ||||
| 54 | ], | ||||
| 55 | ); | ||||
| 56 | } | ||||
| 57 | die $it; | ||||
| 58 | } | ||||
| 59 | |||||
| 60 | 1 | 2µs | 1; |