#!./perl use Test::More tests => 7; BEGIN { # This is in a BEGIN block so that it will run even if # the syntax causes a compilation error. eval q{ my *foo }; ok(!$@, "Syntactically okay."); } { my *foo = *bar; is(*foo, "*main::bar", "Visible within scope,"); } is(*foo, "*main::foo", "yet invisible without it."); { my *foo; is(*foo{PACKAGE}, 'lexical', "Package is 'lexical'"); ok(!keys %lexical::, "Glob does not really exist."); } sub foo { my *foo = shift; sub { return ${*foo}; } } my @foo = map foo($_), \(17, 23); is($foo[0]->(), 17, 'Closure test ($foo[0] == 17)'); is($foo[1]->(), 23, 'Closure test ($foo[1] == 23)');