diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/List/Util/lib/List/Util.pm | 45 | ||||
-rw-r--r-- | ext/List/Util/lib/Scalar/Util.pm | 63 | ||||
-rw-r--r-- | ext/Time/Piece/Piece.pm | 1 |
3 files changed, 0 insertions, 109 deletions
diff --git a/ext/List/Util/lib/List/Util.pm b/ext/List/Util/lib/List/Util.pm index 053134d91e..641ca97a21 100644 --- a/ext/List/Util/lib/List/Util.pm +++ b/ext/List/Util/lib/List/Util.pm @@ -19,51 +19,6 @@ eval { 1 }; -eval <<'ESQ' unless defined &reduce; - -# This code is only compiled if the XS did not load - -use vars qw($a $b); - -sub reduce (&@) { - my $code = shift; - - return shift unless @_ > 1; - - my $caller = caller; - local(*{$caller."::a"}) = \my $a; - local(*{$caller."::b"}) = \my $b; - - $a = shift; - foreach (@_) { - $b = $_; - $a = &{$code}(); - } - - $a; -} - -sub sum (@) { reduce { $a + $b } @_ } - -sub min (@) { reduce { $a < $b ? $a : $b } @_ } - -sub max (@) { reduce { $a > $b ? $a : $b } @_ } - -sub minstr (@) { reduce { $a lt $b ? $a : $b } @_ } - -sub maxstr (@) { reduce { $a gt $b ? $a : $b } @_ } - -sub first (&@) { - my $code = shift; - - foreach (@_) { - return $_ if &{$code}(); - } - - undef; -} -ESQ - 1; __END__ diff --git a/ext/List/Util/lib/Scalar/Util.pm b/ext/List/Util/lib/Scalar/Util.pm index ee65667358..2b81d8e903 100644 --- a/ext/List/Util/lib/Scalar/Util.pm +++ b/ext/List/Util/lib/Scalar/Util.pm @@ -26,69 +26,6 @@ sub export_fail { @_; } -eval <<'ESQ' unless defined &dualvar; - -push @EXPORT_FAIL, qw(weaken isweak dualvar); - -# The code beyond here is only used if the XS is not installed - -# Hope nobody defines a sub by this name -sub UNIVERSAL::a_sub_not_likely_to_be_here { ref($_[0]) } - -sub blessed ($) { - local($@, $SIG{__DIE__}, $SIG{__WARN__}); - length(ref($_[0])) - ? eval { $_[0]->a_sub_not_likely_to_be_here } - : undef -} - -sub reftype ($) { - local($@, $SIG{__DIE__}, $SIG{__WARN__}); - my $r = shift; - my $t; - - length($t = ref($r)) or return undef; - - # This eval will fail if the reference is not blessed - eval { $r->a_sub_not_likely_to_be_here; 1 } - ? do { - $t = eval { - # we have a GLOB or an IO. Stringify a GLOB gives it's name - my $q = *$r; - $q =~ /^\*/ ? "GLOB" : "IO"; - } - or do { - # OK, if we don't have a GLOB what parts of - # a glob will it populate. - # NOTE: A glob always has a SCALAR - local *glob = $r; - defined *glob{ARRAY} && "ARRAY" - or defined *glob{HASH} && "HASH" - or defined *glob{CODE} && "CODE" - or length(ref(${$r})) ? "REF" : "SCALAR"; - } - } - : $t -} - -sub tainted { - local($@, $SIG{__DIE__}, $SIG{__WARN__}); - local $^W = 0; - eval { kill 0 * $_[0] }; - $@ =~ /^Insecure/; -} - -sub readonly { - return 0 if tied($_[0]) || (ref(\($_[0])) ne "SCALAR"); - - local($@, $SIG{__DIE__}, $SIG{__WARN__}); - my $tmp = $_[0]; - - !eval { $_[0] = $tmp; 1 }; -} - -ESQ - 1; __END__ diff --git a/ext/Time/Piece/Piece.pm b/ext/Time/Piece/Piece.pm index 64830f4b02..97925552de 100644 --- a/ext/Time/Piece/Piece.pm +++ b/ext/Time/Piece/Piece.pm @@ -7,7 +7,6 @@ require Exporter; require DynaLoader; use Time::Seconds; use Carp; -use UNIVERSAL; @ISA = qw(Exporter DynaLoader); |