What does "CODE" mean for a variable?

In perl, I wanted to debug some module code, so I temporarily added the following line to this source code:

 print $${${$${$$h[1]{$j}}{proxy_cache}}{$e}}{'fetch_handler'}{'ownerDocument'}

... and he prints:

 CODE(0x9b2b3e0)

What does "CODE" mean? I was expecting HASH(0x???????). I am new to Perl, so please explain this to me since goooooogling for + Perl + CODE does not help :)

I was looking for urlinformation ownerDocument, by the way.

[UPDATE]

I am trying to use the module WWW::Scripterfor my needs, and I have already found several errors that the author of this module (the father of Chrysostomos) has already fixed based on my inputs.

Now I am "debugging" some problems with images that are dynamically created in JavaScript (for example, ((new Image()).src='http://...'), since these images are no longer included in the results $w->images.

If you look at sub update_htmlthe source of the module [http://cpansearch.perl.org/src/SPROUT/WWW-Scripter-0.026/lib/WWW/Scripter.pm] , a line starting with

       $h && $h->eval($self, $code  ...

, . "" DOM script. , , , get referer. , iframe, .. , , (new Image()).src='http://...' , . , ...

+5
2

, .

, , . , , , .

, , , Perl.

, , , , , , . - , $$$$ref:

my $string = 'Buster';

some_sub( \$string );

sub some_sub {
    my $ref = shift;
    some_other_sub( \$ref );
    }

sub some_other_sub {
    my $ref = shift;
    yet_another_sub( \$ref );
    }

sub yet_another_sub {
    my $ref = shift;
    print "$$$$ref\n";   #fuuuuugly!
    }

, , , , . , , , . , $${ } .

, , , , -, .

- , - 1. :

my $j = 'foo';
my $e = 'baz';

my $h = [];

$h->[1] = { foo => 'bar' };   # to get to $$h[1]{$j}

print "1: $h->[1]{$j}\n";

. $${ ... }{proxy_cache}, -:

$h->[1] = { 
    foo => \ { proxy_cache => 'duck' } # ref to hash reference 
    };   

print "2. $${ $$h[1]{$j} }{proxy_cache}\n";

, , , -, . , . :

sub some_sub {
    my $hash = shift;

    $h->[1] = { 
        foo => \ $hash   # don't do that!
        };

. - ( duck):

$h->[1] = { 
    foo => \ { proxy_cache => { $e => 'quux' } }
    };   

print "3. ${ $${ $$h[1]{$j} }{proxy_cache} }{$e}\n";

- -:

$h->[1] = { 
    foo => \ { 
        proxy_cache => { 
            $e => \ { fetch_handler => 'zap' } 
            } 
        }
    };   

print "4. $${ ${ $${ $$h[1]{$j} }{proxy_cache} }{$e} }{'fetch_handler'}\n";

, ownerDocument :

$h->[1] = { 
    foo => \ { 
        proxy_cache => { 
            $e => \ { fetch_handler => {
                    ownerDocument => sub { print "Buster\n" },
                    }
                } 
            } 
        }
    };   

print "5. $${ ${ $${ $$h[1]{$j} }{proxy_cache} }{$e} }{'fetch_handler'}{'ownerDocument'}\n";

- CODE(0x.......), .

, , - . {$e}:

print "6. ";

print $${ $${ $h->[1]{$j} }{proxy_cache}{$e} }{'fetch_handler'}{'ownerDocument'};

print "\n";
+6

, :

my $var = sub { ... };
print "$var\n";
+10

All Articles