in reply to Re: How to trick strict like Exporter does
in thread How to trick strict like Exporter does

but what's the difference? the symbol table of main:: is the same in both cases. at which point is the difference strict is complaining about? without strict it's working.
  • Comment on Re^2: How to trick strict like Exporter does

Replies are listed 'Best First'.
Re^3: How to trick strict like Exporter does (import)
by tye (Sage) on Jul 12, 2006 at 15:59 UTC

      Just for reference, here's a comparison of the internals. Note the additional IMPORT( SV ) in FLAGS.

      With package imp;.
      C:\>perl -MDevel::Peek -e "BEGIN { require 'imp.pl'}; print Dump(*foo) +" SV = PVGV(0x1950c74) at 0x195aa84 REFCNT = 2 FLAGS = (GMG,SMG,MULTI,IN_PAD,IMPORT( SV )) IV = 0 NV = 0 MAGIC = 0x193716c MG_VIRTUAL = &PL_vtbl_glob MG_TYPE = PERL_MAGIC_glob(*) MG_OBJ = 0x195aa84 NAME = "foo" NAMELEN = 3 GvSTASH = 0x2260dc "main" GP = 0x1950cc4 SV = 0x19307cc REFCNT = 1 IO = 0x0 FORM = 0x0 AV = 0x0 HV = 0x0 CV = 0x0 CVGEN = 0x0 GPFLAGS = 0x0 LINE = 2 FILE = "imp.pl" FLAGS = 0x1a EGV = 0x195aa84 "foo"
      Without package imp;.
      C:\>perl -MDevel::Peek -e "BEGIN { require 'imp.pl'}; print Dump(*foo) +" SV = PVGV(0x195064c) at 0x1930730 REFCNT = 2 FLAGS = (GMG,SMG,MULTI,IN_PAD) IV = 0 NV = 0 MAGIC = 0x1959054 MG_VIRTUAL = &PL_vtbl_glob MG_TYPE = PERL_MAGIC_glob(*) MG_OBJ = 0x1930730 NAME = "foo" NAMELEN = 3 GvSTASH = 0x2260dc "main" GP = 0x195ecf4 SV = 0x19307cc REFCNT = 1 IO = 0x0 FORM = 0x0 AV = 0x0 HV = 0x0 CV = 0x0 CVGEN = 0x0 GPFLAGS = 0x0 LINE = 1 FILE = "imp.pl" FLAGS = 0xa EGV = 0x1930730 "foo"
      Thank you for that link, it describes exactly my problem. Well, apparently I have to accept this as "the way perl does things", even though I fail to see why it's sensible.