Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'no bareword::filehandles' #199

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions Build.PL
Expand Up @@ -50,6 +50,7 @@ my $builder = MyBuild->new(
'true::VERSION' => '0.16',
'Capture::Tiny' => '0.06',
'utf8::all' => '0.002',
'bareword::filehandles' => '0.003',
},
build_requires => {
'ExtUtils::CBuilder' => '0.26',
Expand Down
1 change: 1 addition & 0 deletions META.json
Expand Up @@ -72,6 +72,7 @@
"autobox::dump" : "20090426",
"autodie" : "1.999",
"autovivification" : "0.06",
"bareword::filehandles" : "0.003",
"indirect" : "0.22",
"parent" : "0.221",
"perl" : "v5.10.0",
Expand Down
1 change: 1 addition & 0 deletions META.yml
Expand Up @@ -206,6 +206,7 @@ requires:
autobox::dump: 20090426
autodie: 1.999
autovivification: 0.06
bareword::filehandles: 0.003
indirect: 0.22
parent: 0.221
perl: v5.10.0
Expand Down
2 changes: 2 additions & 0 deletions lib/perl5i/2.pm
Expand Up @@ -30,6 +30,7 @@ use parent 'perl5i::2::autobox';
use parent 'autovivification';
use parent 'indirect';
use parent 'utf8::all';
use parent 'bareword::filehandles';

## no critic (Subroutines::RequireArgUnpacking)
sub import {
Expand Down Expand Up @@ -67,6 +68,7 @@ sub import {
perl5i::2::autobox::import($class);
autovivification::unimport($class);
indirect::unimport($class, ":fatal");
bareword::filehandles::unimport($class);

utf8::all::import($class);
(\&perl5i::latest::open)->alias($caller, 'open');
Expand Down
18 changes: 18 additions & 0 deletions t/no-bareword-filehandles.t
@@ -0,0 +1,18 @@
use Test::More tests => 4;

open IN, '<', __FILE__;
ok(IN, 'bareword filehandle opened OK');

open my $in, '<', __FILE__;
ok($in, 'lexical filehandle opened OK');

use perl5i::latest;
try {
open IN2, '<', __FILE__;
}
catch {
like($_, qr{\QCan't use string ("IN2") as a symbol ref while "strict refs" in use},
q{Can't use bareword filehandles with perl5i in scope});
};
open my $in2, '<', __FILE__;
ok($in2, 'lexical filehandle opened OK');