develooper Front page | perl.perl5.porters | Postings from December 2004

$Package::_ in blead and maint

Thread Next
Nicholas Clark
December 3, 2004 10:43
$Package::_ in blead and maint
Message ID:
Was this change in behaviour intended?

$ perl -le '$_= main; $Foo::_ = Foo; print "$]: $_"'
5.008006: main

$ ./perl -le '$_= main; $Foo::_ = Foo; print "$]: $_"'
5.009002: Foo

ie now in blead there is only one $_, whatever explicit package you gave it.
This differs from previous perls, where things like $_ and @INC aren't forced
into main if you give a full package.

I think that it's due to this bit of gv.c:

    /* $_ should always be in main:: even when our'ed */
    if (*name == '_' && !name[1])
	stash = PL_defstash;

Nicholas Clark

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About