Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Perlito5 - typeglob vs. import behaviour investigation
  • Loading branch information
fglock committed Oct 14, 2014
1 parent a13381f commit ef7a08d
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions misc/typeglob/import.pl
@@ -1,11 +1,35 @@
#
# importing variables like "our"/"use vars" - using typeglobs:
#
# The variables must be created in a *different* package
#
# The variables must be created at BEGIN time

package X;
# sub imp { my $x; *X::v = \$x; }

package Y;
use strict;
no strict "refs";

# BEGIN { X::imp() }

# BEGIN { my $x; *X::v = \$x; }

# my $x; *X::v = \$x;
sub imp { my $x; *X::v = \$x; }

package X;
use strict;

# no strict "refs";
# use import;
BEGIN { require "import.pm"; import::import( "import" ); }
# BEGIN { require "import.pm"; import::import( "import" ); }
# BEGIN { require "import.pm"; import::export( "import" ); }
# BEGIN { my $x; *X::v = \$x; }

BEGIN { Y::imp() }

# Y::imp();

$v

0 comments on commit ef7a08d

Please sign in to comment.