Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

betterworld's scratchpad

by betterworld (Curate)
on Feb 19, 2005 at 16:46 UTC ( [id://432752] : scratchpad . print w/replies, xml ) Need Help??

use strict; use warnings; use B; package Foo; sub thing {} my $ref1 = \&package1::sub1; my $ref2 = \&thing; package Bar; for ($ref1, $ref2) { print B::svref_2object($_)->STASH->NAME, "\n"; print B::svref_2object($_)->GV->STASH->NAME, "\n"; } # Output: # main # package1 # Foo # Foo

Apparently $cv->STASH->NAME is always "main" if the reference was constructed via an absolute name (like $ref1 was).