X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=perl%2Fprivate-Error.pm;h=8fff86699fc4585ef9378150d3a60edf911ecc8c;hb=e2b1d1ccdd2ef4db41819bb0d242b808cfe6c422;hp=ebd07498a22ec598449211e8a26c0b63689633ff;hpb=1d8c9dc47de0cbf3955ccc9408564cccbda8e348;p=git.git diff --git a/perl/private-Error.pm b/perl/private-Error.pm index ebd07498a..8fff86699 100644 --- a/perl/private-Error.pm +++ b/perl/private-Error.pm @@ -43,8 +43,6 @@ $Error::ObjectifyCallback = \&throw_Error_Simple; # Exported subs are defined in Error::subs -use Scalar::Util (); - sub import { shift; local $Exporter::ExportLevel = $Exporter::ExportLevel + 1; @@ -290,6 +288,14 @@ use vars qw(@EXPORT_OK @ISA %EXPORT_TAGS); @ISA = qw(Exporter); + +sub blessed { + my $item = shift; + local $@; # don't kill an outer $@ + ref $item and eval { $item->can('can') }; +} + + sub run_clauses ($$$\@) { my($clauses,$err,$wantarray,$result) = @_; my $code = undef; @@ -312,7 +318,7 @@ sub run_clauses ($$$\@) { $i -= 2; next CATCHLOOP; } - elsif(Scalar::Util::blessed($err) && $err->isa($pkg)) { + elsif(blessed($err) && $err->isa($pkg)) { $code = $catch->[$i+1]; while(1) { my $more = 0; @@ -421,7 +427,7 @@ sub try (&;$) { if (defined($err)) { - if (Scalar::Util::blessed($err) && $err->can('throw')) + if (blessed($err) && $err->can('throw')) { throw $err; }