Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'bug/autodie'

  • Loading branch information...
commit fd489bb4362713856fd9d59f99eef11da635a476 2 parents 8912fc6 + e107aaa
@schwern schwern authored
Showing with 6 additions and 40 deletions.
  1. +2 −2 Build.PL
  2. +2 −1  Changes
  3. +1 −22 lib/perl5i/2.pm
  4. +1 −15 t/autodie.t
View
4 Build.PL
@@ -25,7 +25,7 @@ my $builder = MyBuild->new(
'Module::Load' => '0.16', # for perl5i::1
'Text::Wrap' => '2009.0305',
'Try::Tiny' => '0.02',
- 'autodie' => '1.999',
+ 'autodie' => '2.12', # plays nice with open pragma
'IPC::System::Simple' => '1.18', # Needed for autodie :system
'autobox' => '2.70',
'autobox::Core' => '1.0',
@@ -49,7 +49,7 @@ my $builder = MyBuild->new(
"Devel::Declare::MethodInstaller::Simple" => '0.006007',
'true::VERSION' => '0.16',
'Capture::Tiny' => '0.06',
- 'utf8::all' => '0.004',
+ 'utf8::all' => '0.002',
'Carp::Fix::1_25' => '1.000000',
},
build_requires => {
View
3  Changes
@@ -1,6 +1,7 @@
2.10.0
Bug Fixes
- * Restore utf8 for newly opened filehandles.
+ * Upgraded autodie dependency to fix automatic utf8 open.
+ [github #220] [github #218]
Test Fixes
* Removed a use of Test::Exception, which we don't depend on.
View
23 lib/perl5i/2.pm
@@ -69,7 +69,7 @@ sub import {
indirect::unimport($class, ":fatal");
utf8::all::import($class);
- (\&open)->alias($caller, "open");
+ (\&perl5i::latest::open)->alias($caller, 'open');
# Export our gmtime() and localtime()
(\&{$Latest .'::DateTime::dt_gmtime'})->alias($caller, 'gmtime');
@@ -116,27 +116,6 @@ sub perl5i_die {
}
-# This function must be called open() because autodie will decide what to do
-# with the exception based on the name of the function.
-sub open(*;$@) { ## no critic (Subroutines::ProhibitSubroutinePrototypes)
- my $ret;
- if ( @_ == 1 ) {
- $ret = open $_[0];
- } elsif ( @_ == 2 ) {
- $ret = open $_[0], $_[1];
- } else {
- $ret = open $_[0], $_[1], @_[2..$#_];
- }
-
- # Don't try to binmode an unopened filehandle
- return $ret unless $ret;
-
- my $h = (caller 1)[10];
- binmode $_[0], ":encoding(utf8)" if $h->{perl5i};
- return $ret;
-}
-
-
sub load_in_caller {
my $caller = shift;
my @modules = @_;
View
16 t/autodie.t
@@ -1,7 +1,7 @@
#!perl
use perl5i::latest;
-use Test::More;
+use Test::More "no_plan";
ok !eval { open my $fh, "hlaglaghlaghlagh"; 1 };
@@ -12,17 +12,3 @@ if( $^O eq 'MSWin32' ) {
} else {
ok !eval { system "haljlkjadlkjflajdf"; 1; };
}
-
-note "open() message formatting"; {
- ok !eval { open my $fh, "i_do_not_exist"; 1 };
- is $@->file, __FILE__;
- is $@->line, __LINE__ - 2;
- unlike $@, qr/perl5i/, "open error should not mention perl5i";
-
- TODO: {
- local $TODO = 'open function from autodie exception';
- is $@->function, "open";
- }
-}
-
-done_testing;
Please sign in to comment.
Something went wrong with that request. Please try again.