From: Vincent Pit Date: Sat, 21 Aug 2010 12:23:59 +0000 (+0200) Subject: Document and test that the "-e without semicolon" bug is fixed on 5.12 X-Git-Tag: v0.23~7 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2Findirect.git;a=commitdiff_plain;h=2b4cc6c04da4c960652e76a3b14e32554550f3e1;hp=28344f23a0e0d25ff130a5745a91e85fbadfcd6f Document and test that the "-e without semicolon" bug is fixed on 5.12 --- diff --git a/lib/indirect.pm b/lib/indirect.pm index 86cdf37..09090c2 100644 --- a/lib/indirect.pm +++ b/lib/indirect.pm @@ -181,7 +181,8 @@ If you want to re-enable the pragma later, you also need to reload it by deletin The implementation was tweaked to work around several limitations of vanilla C pragmas : it's thread safe, and does not suffer from a C bug that causes all pragmas to propagate into Cd scopes. -C (no semicolon) at the end of a file won't be seen as an indirect object syntax, although it will as soon as there is another token before the end (as in C or C). +Before C 5.12, C (no semicolon) at the end of a file is not seen as an indirect object syntax, although it is as soon as there is another token before the end (as in C or C). +If you use C 5.12 or greater, those constructs are correctly reported. With 5.8 perls, the pragma does not propagate into C. This is due to a shortcoming in the way perl handles the hints hash, which is addressed in perl 5.10. diff --git a/t/50-external.t b/t/50-external.t index e717bdf..f8dca42 100644 --- a/t/50-external.t +++ b/t/50-external.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 1; +use Test::More tests => 2; BEGIN { delete $ENV{PERL_INDIRECT_PM_DISABLE} } @@ -21,3 +21,10 @@ sub run_perl { my $status = run_perl 'no indirect; qq{a\x{100}b} =~ /\A[\x00-\x7f]*\z/;'; is $status, 0, 'RT #47866'; } + +SKIP: +{ + skip 'Fixed in core only since 5.12' => 1 unless $] >= 5.012; + my $status = run_perl 'no indirect hook => sub { exit 2 }; new X'; + is $status, 2 << 8, 'no semicolon at the end of -e'; +}