<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -37,7 +37,7 @@ WriteMakefile(
     : (
       INSTALLDIRS =&gt; q[perl],
       PREREQ_PM   =&gt; {'Test::More' =&gt; 0,},
-      (eval { ExtUtils::MakeMaker-&gt;VERSION(6.21) } ? (LICENSE =&gt; 'perl') : ()),
+      (eval { ExtUtils::MakeMaker-&gt;VERSION(6.31) } ? (LICENSE =&gt; 'perl') : ()),
       ($do_xs ? () : (XS =&gt; {}, C =&gt; [])),
       ( eval { ExtUtils::MakeMaker-&gt;VERSION(6.46) } ? (
           META_MERGE =&gt; {</diff>
      <filename>Makefile.PL</filename>
    </modified>
    <modified>
      <diff>@@ -12,6 +12,7 @@ use strict;
 use warnings;
 use vars qw(@ISA @EXPORT $VERSION $recurse);
 require Exporter;
+use B qw(svref_2object);
 
 @ISA     = qw(Exporter);
 @EXPORT  = qw(blessed reftype tainted readonly refaddr looks_like_number);
@@ -19,12 +20,11 @@ $VERSION = &quot;1.20&quot;;
 $VERSION = eval $VERSION;
 
 sub blessed ($) {
-  local($@, $SIG{__DIE__}, $SIG{__WARN__});
-  return ref($_[0]) if $recurse;
-  local $recurse = 1; # protect against recursion if user has used UNIVERSAL::can from CPAN
-  length(ref($_[0]))
-    ? eval { $_[0]-&gt;UNIVERSAL::can('can') &amp;&amp; ref($_[0]) }
-    : undef;
+  return undef unless length(ref($_[0]));
+  my $b = svref_2object($_[0]);
+  return undef unless $b-&gt;isa('B::PVMG');
+  my $s = $b-&gt;SvSTASH;
+  return $s-&gt;isa('B::HV') ? $s-&gt;NAME : undef;
 }
 
 sub refaddr($) {
@@ -44,33 +44,32 @@ sub refaddr($) {
   hex($1);
 }
 
-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-&gt;UNIVERSAL::can('can') }
-    ? do {
-      $t = eval {
-	  # we have a GLOB or an IO. Stringify a GLOB gives it's name
-	  my $q = *$r;
-	  (defined($q) &amp;&amp; $q =~ /^\*/) ? &quot;GLOB&quot; : &quot;IO&quot;;
-	}
-	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} &amp;&amp; &quot;ARRAY&quot;
-	  or defined *glob{HASH} &amp;&amp; &quot;HASH&quot;
-	  or defined *glob{CODE} &amp;&amp; &quot;CODE&quot;
-	  or length(ref(${$r})) ? &quot;REF&quot; : &quot;SCALAR&quot;;
-	}
-    }
-    : $t
+{
+  my %tmap = qw(
+    B::HV HASH
+    B::AV ARRAY
+    B::CV CODE
+    B::IO IO
+    B::NULL SCALAR
+    B::NV SCALAR
+    B::PV SCALAR
+    B::GV GLOB
+    B::RV REF
+    B::REGEXP REGEXP
+  );
+
+  sub reftype ($) {
+    my $r = shift;
+
+    return undef unless length(ref($r));
+
+    my $t = ref(svref_2object($r));
+
+    return
+        exists $tmap{$t} ? $tmap{$t}
+      : length(ref($$r)) ? 'REF'
+      :                    'SCALAR';
+  }
 }
 
 sub tainted {</diff>
      <filename>lib/Scalar/Util/PP.pm</filename>
    </modified>
    <modified>
      <diff>@@ -13,7 +13,7 @@ BEGIN {
     }
 }
 
-use Test::More tests =&gt; 23;
+use Test::More tests =&gt; 29;
 
 use Scalar::Util qw(reftype);
 use vars qw($t $y $x *F);
@@ -21,6 +21,7 @@ use Symbol qw(gensym);
 
 # Ensure we do not trigger and tied methods
 tie *F, 'MyTie';
+my $RE = $] &lt; 5.011 ? 'SCALAR' : 'REGEXP';
 
 @test = (
  [ undef, 1,		'number'	],
@@ -32,7 +33,8 @@ tie *F, 'MyTie';
  [ GLOB   =&gt; \*F,	'tied GLOB ref'	],
  [ GLOB   =&gt; gensym,	'GLOB ref'	],
  [ CODE   =&gt; sub {},	'CODE ref'	],
-# [ IO =&gt; *STDIN{IO} ] the internal sv_reftype returns UNKNOWN
+ [ IO     =&gt; *STDIN{IO},'IO ref'        ],
+ [ $RE    =&gt; qr/x/,     'REGEEXP'       ],
 );
 
 foreach $test (@test) {</diff>
      <filename>t/reftype.t</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>6b60a9e8c2c20cbb3982ae57034214edf08551f2</id>
    </parent>
  </parents>
  <author>
    <name>Graham Barr</name>
    <email>gbarr@pobox.com</email>
  </author>
  <url>http://github.com/gbarr/Scalar-List-Utils/commit/eddddcccda4fe0e3484378850b345c60fbcab010</url>
  <id>eddddcccda4fe0e3484378850b345c60fbcab010</id>
  <committed-date>2009-05-13T14:41:25-07:00</committed-date>
  <authored-date>2009-05-13T12:49:04-07:00</authored-date>
  <message>Reimplement perl version of reftype and blessed using B

While not pure perl as B is an XS extension. B is part of core
perl so users should have it available. the PP versions are only
meant as a fallback for users who do not have compiler access</message>
  <tree>c5f0b6626926ebc7983a30b381b2ec8b44dfa2c1</tree>
  <committer>
    <name>Graham Barr</name>
    <email>gbarr@pobox.com</email>
  </committer>
</commit>
