[perl #62488] B::Deparse fails on 'CORE::require(STRING)'
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Sun, 18 Jan 2009 22:03:27 +0000 (23:03 +0100)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Sun, 18 Jan 2009 22:03:27 +0000 (23:03 +0100)
This patch allows the following to deparse properly:

    perl -MO=Deparse -e 'CORE::require "CGI.pm"'

(necessary due to the specific way require() is overriden)

ext/B/B/Deparse.pm

index 753192d..c398ddb 100644 (file)
@@ -1603,8 +1603,10 @@ sub unop {
     my $kid;
     if ($op->flags & OPf_KIDS) {
        $kid = $op->first;
-       if (defined prototype("CORE::$name")
-          && prototype("CORE::$name") =~ /^;?\*/
+       my $builtinname = $name;
+       $builtinname =~ /^CORE::/ or $builtinname = "CORE::$name";
+       if (defined prototype($builtinname)
+          && prototype($builtinname) =~ /^;?\*/
           && $kid->name eq "rv2gv") {
            $kid = $kid->first;
        }