develooper Front page | perl.perl5.porters | Postings from October 2003

[BUG] pre-population of glob slots

From:
Dan Brook
Date:
October 22, 2003 06:35
Subject:
[BUG] pre-population of glob slots
Message ID:
20031022143448.5565b324.dbrook@easyspace.com
Across all versions of perl (and all platforms from what I can tell)
glob slots are pre-populated if seen to be used at some point in the
program, *even* when the glob has been localized e.g

  use Data::Dumper;
  $Data::Dumper::Purity = 1;

  print Dumper *g;

  {
    local *g;
    @g = %g = ();
  }

  __output__

  $VAR1 = *::g;
  *::g = [];
  *::g = {};

If I had to hazard a guess at the cause of the problem, it would be that
parser sees the given glob data slots being used and so are flagged to
be populated for use, irrespective of the local() in use.

This can be an issue when testing the existence of data for exporting or
dumping data for future use.

Dan



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About