summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7fb39d5)
raw | patch | inline | side by side (parent: 7fb39d5)
author | Petr Baudis <pasky@suse.cz> | |
Wed, 26 Jul 2006 01:03:58 +0000 (03:03 +0200) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 26 Jul 2006 04:13:30 +0000 (21:13 -0700) |
We used just the blessed() routine so steal it from Scalar/Util.pm.
Unfortunately, Scalar::Util is not bundled with older Perl versions.
This is a newer much saner blessed() version by Randal L. Schwarz.
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Unfortunately, Scalar::Util is not bundled with older Perl versions.
This is a newer much saner blessed() version by Randal L. Schwarz.
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
perl/private-Error.pm | patch | blob | history |
diff --git a/perl/private-Error.pm b/perl/private-Error.pm
index ebd07498a22ec598449211e8a26c0b63689633ff..8fff86699fc4585ef9378150d3a60edf911ecc8c 100644 (file)
--- a/perl/private-Error.pm
+++ b/perl/private-Error.pm
# Exported subs are defined in Error::subs
-use Scalar::Util ();
-
sub import {
shift;
local $Exporter::ExportLevel = $Exporter::ExportLevel + 1;
@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;
$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;
if (defined($err))
{
- if (Scalar::Util::blessed($err) && $err->can('throw'))
+ if (blessed($err) && $err->can('throw'))
{
throw $err;
}