Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

No strict vars for one-liners #194

Merged
merged 1 commit into from Apr 28, 2011
Jump to file or symbol
Failed to load files and symbols.
+16 −3
Split
View
@@ -48,12 +48,20 @@ sub import {
mro::set_mro( $caller, 'c3' );
load_in_caller( $caller => (
- ["CLASS"], ["File::chdir"],
- [English => qw(-no_match_vars)],
- ["Want" => qw(want)], ["Try::Tiny"], ["Perl6::Caller"], ["Carp"],
+ ['CLASS'],
+ ['File::chdir'],
+ ['English' => qw(-no_match_vars)],
+ ['Want' => qw(want)],
+ ['Try::Tiny'],
+ ['Perl6::Caller'],
+ ['Carp'],
['perl5i::2::Signatures'],
['Child' => qw(child)],
) );
+ # no strict vars for oneliners - GH #63
+ strict::unimport($class, 'vars')
+ if $class eq 'perl5i::cmd'
+ or $0 eq '-e';
# Have to call both or it won't work.
true::import($class);
View
@@ -59,4 +59,9 @@ is capture { system @perl5icmd, "-e", q[print __FILE__] }, "-e", '__FILE__
is `$perl5icmd $file`, "Hello\n", "program in a file";
}
+# Check it doesn't have strict vars on
+is capture {system @perl5icmd, '-e', q($fun="yay"; say $fun;)}, "yay\n", 'no strict vars for perl5i';
+is capture {system ($^X, '-Ilib', '-Mperl5i::latest', '-e', q|$fun="yay"; say $fun;|)},
+ "yay\n", q{no strict vars for perl -Mperl5i::latest -e '...'};
+
done_testing;