]> asedeno.scripts.mit.edu Git - git.git/blobdiff - perl/private-Error.pm
Merge branch 'master' of git://git.kernel.org/pub/scm/gitk/gitk
[git.git] / perl / private-Error.pm
index ebd07498a22ec598449211e8a26c0b63689633ff..11e9cd9a02eb3f85a9150c6fb06d1fc76abd9b09 100644 (file)
@@ -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;
         }
@@ -775,7 +781,7 @@ that is a plain string. (Unless C<$Error::ObjectifyCallback> is modified)
 
 This variable holds a reference to a subroutine that converts errors that
 are plain strings to objects. It is used by Error.pm to convert textual
-errors to objects, and can be overrided by the user.
+errors to objects, and can be overridden by the user.
 
 It accepts a single argument which is a hash reference to named parameters.
 Currently the only named parameter passed is C<'text'> which is the text