Skip to content

Commit

Permalink
Don't permit running with autodie < 2.12
Browse files Browse the repository at this point in the history
autodie obliterated the IO layers set by the open pragma prior
to version 2.12, so now we refuse to run with autodie before
that bug was fixed.

RT #54777: autodie loses open pragma
GH #7: autodie breaks the open set by utf8::all
  • Loading branch information
doherty committed Jul 10, 2012
1 parent e69f37f commit 830890d
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,2 +1,3 @@
utf8-all*
.build
*.orig
1 change: 1 addition & 0 deletions Changes
Expand Up @@ -2,6 +2,7 @@ Revision history for Perl module {{$dist->name}}

{{$NEXT}}
* Use Import::Into instead of home-grown "solution" [GH #10]
* Don't permit running with autodie < 2.12, due to RT #54777 [GH #7]

0.004 2012-01-04
* Fix test suite for less current versions of Perl [getty, doherty]
Expand Down
15 changes: 12 additions & 3 deletions lib/utf8/all.pm
Expand Up @@ -65,9 +65,18 @@ sub _encode_argv {
return;
}

=for Pod::Coverage
utf8_open
unimport
=head1 INTERACTION WITH AUTODIE
If you use L<autodie>, which is a great idea, you need to use at least version
B<2.12>, released on L<June 26, 2012|https://metacpan.org/source/PJF/autodie-2.12/Changes#L3>.
Otherwise, autodie obliterates the IO layers set by the L<open> pragma. See
L<RT #54777|https://rt.cpan.org/Ticket/Display.html?id=54777> and
L<GH #7|https://github.com/doherty/utf8-all/issues/7>.
=cut

CHECK {
autodie->VERSION(2.12) if $INC{'autodie.pm'};
}

1;
17 changes: 17 additions & 0 deletions t/autodie.t
@@ -0,0 +1,17 @@
use strict;
use warnings;
use Test::More;
use Capture::Tiny qw(capture_merged);

my @code = (
q{use autodie; use utf8::all; 1},
q{use utf8::all; use autodie; 1}
);
plan tests => 2*@code;

foreach my $code_str (@code) {
note $code_str;
my $output = capture_merged sub { system( $^X, '-e', $code_str ) };
like $output => qr/CHECK/, 'failed b/c of the CHECK block' or diag $output;
like $output => qr/autodie.*2\.12/, q{failed b/c of autodie wasn't new enough} or diag $output;
}

0 comments on commit 830890d

Please sign in to comment.