Server : Apache/2.4.43 (Win64) OpenSSL/1.1.1g PHP/7.4.6 System : Windows NT USER-PC 6.1 build 7601 (Windows 7 Professional Edition Service Pack 1) AMD64 User : User ( 0) PHP Version : 7.4.6 Disable Function : NONE Directory : C:/xampp/perl/vendor/lib/PPI/ |
package PPI::Exception; use strict; use Params::Util qw{_INSTANCE}; use vars qw{$VERSION}; BEGIN { $VERSION = '1.215'; } ##################################################################### # Constructor and Accessors sub new { my $class = shift; return bless { @_ }, $class if @_ > 1; return bless { message => $_[0] }, $class if @_; return bless { message => 'Unknown Exception' }, $class; } sub message { $_[0]->{message}; } sub callers { @{ $_[0]->{callers} || [] }; } ##################################################################### # Main Methods sub throw { my $it = shift; if ( _INSTANCE($it, 'PPI::Exception') ) { if ( $it->{callers} ) { push @{ $it->{callers} }, [ caller(0) ]; } else { $it->{callers} ||= []; } } else { my $message = $_[0] || 'Unknown Exception'; $it = $it->new( message => $message, callers => [ [ caller(0) ], ], ); } die $it; } 1;