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

[BUG] pre-population of glob slots

Dan Brook
October 22, 2003 06:35
[BUG] pre-population of glob slots
Message ID:
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 = ();


  $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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About