Sub-StrictDecl-0.005000755001750001750 013133627503 14243 5ustar00zeframzefram000000000000Sub-StrictDecl-0.005/.gitignore000444001750001750 24313133627475 16357 0ustar00zeframzefram000000000000/Build /Makefile /_build /blib /META.json /META.yml /MYMETA.json /MYMETA.yml /Makefile.PL /SIGNATURE /Sub-StrictDecl-* /lib/Sub/StrictDecl.c /lib/Sub/StrictDecl.o Sub-StrictDecl-0.005/Build.PL000444001750001750 167213133627475 15712 0ustar00zeframzefram000000000000{ use 5.006; } use warnings; use strict; use Module::Build; Module::Build->new( module_name => "Sub::StrictDecl", license => "perl", configure_requires => { "Module::Build" => 0, "perl" => "5.006", "strict" => 0, "warnings" => 0, }, build_requires => { "ExtUtils::CBuilder" => "0.15", "Module::Build" => 0, "Test::More" => 0, "perl" => "5.006", "strict" => 0, "warnings" => 0, }, requires => { "Lexical::SealRequireHints" => "0.008", "XSLoader" => 0, "perl" => "5.006", "strict" => 0, "warnings" => 0, }, conflicts => { "B::Hooks::OP::Check" => "< 0.19", }, dynamic_config => 0, meta_add => { distribution_type => "module" }, meta_merge => { "meta-spec" => { version => "2" }, resources => { bugtracker => { mailto => "bug-Sub-StrictDecl\@rt.cpan.org", web => "https://rt.cpan.org/Public/Dist/". "Display.html?Name=Sub-StrictDecl", }, }, }, sign => 1, )->create_build_script; 1; Sub-StrictDecl-0.005/Changes000444001750001750 277513133627475 15716 0ustar00zeframzefram000000000000version 0.005; 2017-07-19 * update test suite to not rely on . in @INC, which is no longer necessarily there from Perl 5.25.7 * use cleaner wrap_op_checker() API to control op checking * no longer include a Makefile.PL in the distribution * in META.{yml,json}, point to public bug tracker * consistently use THX_ prefix on internal function names version 0.004; 2015-03-20 * bugfix: require bugfixed version of Lexical::SealRequireHints (for not breaking version-implied features and for require argument context) * port to Perl 5.21.4, where gv ops don't necessarily refer to real GVs version 0.003; 2011-11-21 * bugfix: require bugfixed version of Lexical::SealRequireHints (for compatibility with early-loaded warnings.pm) and invoke it earlier to make sure it takes effect in time * in Build.PL, declare incompatibility with pre-0.19 B::Hooks::OP::Check, which doesn't play nicely around op check hooking * convert .cvsignore to .gitignore version 0.002; 2011-07-26 * bugfix: require bugfixed version of Lexical::SealRequireHints (for working around [perl #73174]) * fix test case for lexical hints leaking into require * add Perl::Critic::StricterSubs to "see also" list version 0.001; 2011-07-04 * bugfix: cope with the speculative rv2cv op building performed by Perl 5.11.2 and later * ensure compatibility with Devel::CallParser * add META.json, MYMETA.json, and MYMETA.yml to .cvsignore version 0.000; 2011-06-30 * initial released version Sub-StrictDecl-0.005/MANIFEST000444001750001750 36713133627475 15527 0ustar00zeframzefram000000000000.gitignore Build.PL Changes MANIFEST META.json META.yml README lib/Sub/StrictDecl.pm lib/Sub/StrictDecl.xs t/check.t t/devel_callparser.t t/lexicalsub.t t/lib/t/scope_0.pm t/pod_cvg.t t/pod_syn.t t/scope.t SIGNATURE Added here by Module::Build Sub-StrictDecl-0.005/META.json000444001750001750 322213133627475 16030 0ustar00zeframzefram000000000000{ "abstract" : "detect undeclared subroutines in compilation", "author" : [ "Andrew Main (Zefram) " ], "dynamic_config" : 0, "generated_by" : "Module::Build version 0.4224", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "Sub-StrictDecl", "prereqs" : { "build" : { "requires" : { "ExtUtils::CBuilder" : "0.15", "Module::Build" : "0", "Test::More" : "0", "perl" : "5.006", "strict" : "0", "warnings" : "0" } }, "configure" : { "requires" : { "Module::Build" : "0", "perl" : "5.006", "strict" : "0", "warnings" : "0" } }, "runtime" : { "conflicts" : { "B::Hooks::OP::Check" : "< 0.19" }, "requires" : { "Lexical::SealRequireHints" : "0.008", "XSLoader" : "0", "perl" : "5.006", "strict" : "0", "warnings" : "0" } } }, "provides" : { "Sub::StrictDecl" : { "file" : "lib/Sub/StrictDecl.pm", "version" : "0.005" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "mailto" : "bug-Sub-StrictDecl@rt.cpan.org", "web" : "https://rt.cpan.org/Public/Dist/Display.html?Name=Sub-StrictDecl" }, "license" : [ "http://dev.perl.org/licenses/" ] }, "version" : "0.005", "x_serialization_backend" : "JSON::PP version 2.93" } Sub-StrictDecl-0.005/META.yml000444001750001750 175013133627475 15664 0ustar00zeframzefram000000000000--- abstract: 'detect undeclared subroutines in compilation' author: - 'Andrew Main (Zefram) ' build_requires: ExtUtils::CBuilder: '0.15' Module::Build: '0' Test::More: '0' perl: '5.006' strict: '0' warnings: '0' configure_requires: Module::Build: '0' perl: '5.006' strict: '0' warnings: '0' conflicts: B::Hooks::OP::Check: '< 0.19' dynamic_config: 0 generated_by: 'Module::Build version 0.4224, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Sub-StrictDecl provides: Sub::StrictDecl: file: lib/Sub/StrictDecl.pm version: '0.005' requires: Lexical::SealRequireHints: '0.008' XSLoader: '0' perl: '5.006' strict: '0' warnings: '0' resources: bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=Sub-StrictDecl license: http://dev.perl.org/licenses/ version: '0.005' x_serialization_backend: 'CPAN::Meta::YAML version 0.012' Sub-StrictDecl-0.005/README000444001750001750 306613133627475 15275 0ustar00zeframzefram000000000000NAME Sub::StrictDecl - detect undeclared subroutines in compilation DESCRIPTION This module provides optional checking of subroutine existence at compile time. This checking detects mistyped subroutine names and subroutines that the programmer forgot to import. Traditionally Perl does not detect these errors until runtime, so it is easy for errors to lurk in rarely-executed or untested code. Specifically, where checking is enabled, any reference to a specific (compile-time-constant) package-based subroutine name is examined. If the named subroutine has never been declared then an error is signalled at compile time. This does not require that the subroutine be fully defined: a forward declaration such as "sub foo;" suffices to suppress the error. Imported subroutines qualify as declared. References that are checked include not only subroutine calls but also pure referencing such as "\&foo". This checking is controlled by a lexically-scoped pragma. It is therefore applied only to code that explicitly wants the checking, and it is possible to locally disable checking if necessary. Checking might need to be turned off for code that makes special arrangements to put a subroutine in place at runtime, for example. INSTALLATION perl Build.PL ./Build ./Build test ./Build install AUTHOR Andrew Main (Zefram) COPYRIGHT Copyright (C) 2011 PhotoBox Ltd Copyright (C) 2011, 2015, 2017 Andrew Main (Zefram) LICENSE This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Sub-StrictDecl-0.005/SIGNATURE000644001750001750 317113133627503 15670 0ustar00zeframzefram000000000000This file contains message digests of all files listed in MANIFEST, signed via the Module::Signature module, version 0.81. To verify the content in this distribution, first make sure you have Module::Signature installed, then type: % cpansign -v It will check each file's integrity, as well as the signature's validity. If "==> Signature verified OK! <==" is not displayed, the distribution may already have been compromised, and you should not run its Makefile.PL or Build.PL. -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 SHA1 cc3839c92756ae1b6885caaa8ef982d9a625b154 .gitignore SHA1 33a3a1b9cd9bed269b42e7abc1bca24b54f5c6e2 Build.PL SHA1 cb43e1e71c9eab2ff2c55afd35638343b20bf87c Changes SHA1 ae343a3a592abba22ff62ad4a64fa81823a7ff0c MANIFEST SHA1 21a88785e2fdff6c17b27b07818a79f2a8ce3bef META.json SHA1 b8381ffba2282a6046bffcf0b007439a7ce64a9f META.yml SHA1 6d5210afafde7b3f0f1a459854292df23520a7a7 README SHA1 a74399e9d3432e222238f3e19a6ba35f5f33b0a8 lib/Sub/StrictDecl.pm SHA1 a0a71e15a256c10e2ffab6cbf1afce836c12fb5e lib/Sub/StrictDecl.xs SHA1 ae2223e39954d57ed2237bb5c829be683eb3c166 t/check.t SHA1 79a650c98b43542ae1f362b8d94500ef29a1730b t/devel_callparser.t SHA1 29c8399c43665e88d8da7778623ab92f235c0c4b t/lexicalsub.t SHA1 86beeeb5c754c1f08ed85316e06aa8dd70c3fa9a t/lib/t/scope_0.pm SHA1 904d9a4f76525e2303e4b0c168c68230f223c8de t/pod_cvg.t SHA1 65c75abdef6f01a5d1588a307f2ddfe2333dc961 t/pod_syn.t SHA1 33a6d76fefd27578cfe5a301629ff4c58ba9126f t/scope.t -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAllvLz0ACgkQOV9mt2VyAVFPgACfR8TrIiGZ3ynQS4THV9QsCYHP 4fIAmwXeJV6O45obsGwMFjURJrOlbovX =xgce -----END PGP SIGNATURE----- Sub-StrictDecl-0.005/lib000755001750001750 013133627475 15021 5ustar00zeframzefram000000000000Sub-StrictDecl-0.005/lib/Sub000755001750001750 013133627475 15552 5ustar00zeframzefram000000000000Sub-StrictDecl-0.005/lib/Sub/StrictDecl.pm000444001750001750 421213133627475 20304 0ustar00zeframzefram000000000000=head1 NAME Sub::StrictDecl - detect undeclared subroutines in compilation =head1 SYNOPSIS use Sub::StrictDecl; no Sub::StrictDecl; =head1 DESCRIPTION This module provides optional checking of subroutine existence at compile time. This checking detects mistyped subroutine names and subroutines that the programmer forgot to import. Traditionally Perl does not detect these errors until runtime, so it is easy for errors to lurk in rarely-executed or untested code. Specifically, where checking is enabled, any reference to a specific (compile-time-constant) package-based subroutine name is examined. If the named subroutine has never been declared then an error is signalled at compile time. This does not require that the subroutine be fully defined: a forward declaration such as "C" suffices to suppress the error. Imported subroutines qualify as declared. References that are checked include not only subroutine calls but also pure referencing such as "C<\&foo>". This checking is controlled by a lexically-scoped pragma. It is therefore applied only to code that explicitly wants the checking, and it is possible to locally disable checking if necessary. Checking might need to be turned off for code that makes special arrangements to put a subroutine in place at runtime, for example. =cut package Sub::StrictDecl; { use 5.006; } use Lexical::SealRequireHints 0.008; use warnings; use strict; our $VERSION = "0.005"; require XSLoader; XSLoader::load(__PACKAGE__, $VERSION); =head1 PACKAGE METHODS =over =item Sub::StrictDecl->import Turns on subroutine declaration checking in the lexical environment that is currently compiling. =item Sub::StrictDecl->unimport Turns off subroutine declaration checking in the lexical environment that is currently compiling. =back =head1 SEE ALSO L, L =head1 AUTHOR Andrew Main (Zefram) =head1 COPYRIGHT Copyright (C) 2011 PhotoBox Ltd Copyright (C) 2011, 2015, 2017 Andrew Main (Zefram) =head1 LICENSE This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut 1; Sub-StrictDecl-0.005/lib/Sub/StrictDecl.xs000444001750001750 615713133627475 20334 0ustar00zeframzefram000000000000#define PERL_NO_GET_CONTEXT 1 #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s) #define PERL_DECIMAL_VERSION \ PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION) #define PERL_VERSION_GE(r,v,s) \ (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s)) #ifndef newSVpvs_share # ifdef newSVpvn_share # define newSVpvs_share(STR) newSVpvn_share(""STR"", sizeof(STR)-1, 0) # else /* !newSVpvn_share */ # define newSVpvs_share(STR) newSVpvn(""STR"", sizeof(STR)-1) # define SvSHARED_HASH(SV) 0 # endif /* !newSVpvn_share */ #endif /* !newSVpvs_share */ #ifndef SvSHARED_HASH # define SvSHARED_HASH(SV) SvUVX(SV) #endif /* !SvSHARED_HASH */ #ifndef SVfARG # define SVfARG(p) ((void*)(p)) #endif /* !SVfARG */ #if !PERL_VERSION_GE(5,9,3) typedef OP *(*Perl_check_t)(pTHX_ OP *); #endif /* <5.9.3 */ #if !PERL_VERSION_GE(5,10,1) typedef unsigned Optype; #endif /* <5.10.1 */ #ifndef wrap_op_checker # define wrap_op_checker(c,n,o) THX_wrap_op_checker(aTHX_ c,n,o) static void THX_wrap_op_checker(pTHX_ Optype opcode, Perl_check_t new_checker, Perl_check_t *old_checker_p) { if(*old_checker_p) return; OP_REFCNT_LOCK; if(!*old_checker_p) { *old_checker_p = PL_check[opcode]; PL_check[opcode] = new_checker; } OP_REFCNT_UNLOCK; } #endif /* !wrap_op_checker */ #ifndef qerror # define qerror(m) Perl_qerror(aTHX_ m) #endif /* !qerror */ #if PERL_VERSION_GE(5,9,5) # define PL_parser_exists PL_parser # define PL_expect (PL_parser->expect) #else /* <5.9.5 */ # define PL_parser_exists 1 #endif /* <5.9.5 */ static SV *hint_key_sv; static U32 hint_key_hash; static OP *(*THX_nxck_rv2cv)(pTHX_ OP *o); #define in_strictdecl() THX_in_strictdecl(aTHX) static bool THX_in_strictdecl(pTHX) { HE *ent = hv_fetch_ent(GvHV(PL_hintgv), hint_key_sv, 0, hint_key_hash); return ent && SvTRUE(HeVAL(ent)); } static OP *THX_myck_rv2cv(pTHX_ OP *op) { OP *aop; GV *gv; op = THX_nxck_rv2cv(aTHX_ op); if(op->op_type == OP_RV2CV && (op->op_flags & OPf_KIDS) && (aop = cUNOPx(op)->op_first) && aop->op_type == OP_GV && PL_parser_exists && PL_expect == XOPERATOR && in_strictdecl() && (gv = cGVOPx_gv(aop)) && (!PERL_VERSION_GE(5,21,4) || SvTYPE(gv) == SVt_PVGV) && !GvCVu(gv)) { SV *name = sv_newmortal(); gv_efullname3(name, gv, NULL); qerror(mess("Undeclared subroutine &%"SVf"", SVfARG(name))); } return op; } MODULE = Sub::StrictDecl PACKAGE = Sub::StrictDecl PROTOTYPES: DISABLE BOOT: hint_key_sv = newSVpvs_share("Sub::StrictDecl/strict"); hint_key_hash = SvSHARED_HASH(hint_key_sv); wrap_op_checker(OP_RV2CV, THX_myck_rv2cv, &THX_nxck_rv2cv); void import(SV *classname) PREINIT: SV *val; HE *he; CODE: PERL_UNUSED_VAR(classname); PL_hints |= HINT_LOCALIZE_HH; gv_HVadd(PL_hintgv); val = newSVsv(&PL_sv_yes); he = hv_store_ent(GvHV(PL_hintgv), hint_key_sv, val, hint_key_hash); if(he) { val = HeVAL(he); SvSETMAGIC(val); } else { SvREFCNT_dec(val); } void unimport(SV *classname) CODE: PERL_UNUSED_VAR(classname); PL_hints |= HINT_LOCALIZE_HH; gv_HVadd(PL_hintgv); (void) hv_delete_ent(GvHV(PL_hintgv), hint_key_sv, G_DISCARD, hint_key_hash); Sub-StrictDecl-0.005/t000755001750001750 013133627475 14516 5ustar00zeframzefram000000000000Sub-StrictDecl-0.005/t/check.t000444001750001750 734213133627475 16123 0ustar00zeframzefram000000000000use warnings; use strict; use Test::More tests => 58; BEGIN { $^H |= 0x20000; } my $r; $r = eval(q{ use Sub::StrictDecl; # sub call if(0) { foo0(); } 1; }); is $r, undef; like $@, qr/\AUndeclared subroutine &main::foo0/; $r = eval(q{ use Sub::StrictDecl; # sub call sub foo1; if(0) { foo1(); } 1; }); is $r, 1; is $@, ""; $r = eval(q{ use Sub::StrictDecl; # sub call sub foo2 (); if(0) { foo2(); } 1; }); is $r, 1; is $@, ""; $r = eval(q{ use Sub::StrictDecl; # sub call sub foo3 {} if(0) { foo3(); } 1; }); is $r, 1; is $@, ""; $r = eval(q{ use Sub::StrictDecl; # sub call BEGIN { *foo4 = sub { }; } if(0) { foo4(); } 1; }); is $r, 1; is $@, ""; $r = eval(q{ use Sub::StrictDecl; # sub call *foo5 = sub { }; if(0) { foo5(); } 1; }); is $r, undef; like $@, qr/\AUndeclared subroutine &main::foo5/; $r = eval(q{ use Sub::StrictDecl; # sub ref if(0) { print \&bar0; } 1; }); is $r, undef; like $@, qr/\AUndeclared subroutine &main::bar0/; $r = eval(q{ use Sub::StrictDecl; # sub ref sub bar1; if(0) { print \&bar1; } 1; }); is $r, 1; is $@, ""; $r = eval(q{ use Sub::StrictDecl; # sub ref sub bar2 (); if(0) { print \&bar2; } 1; }); is $r, 1; is $@, ""; $r = eval(q{ use Sub::StrictDecl; # sub ref sub bar3 {} if(0) { print \&bar3; } 1; }); is $r, 1; is $@, ""; $r = eval(q{ use Sub::StrictDecl; # sub ref BEGIN { *bar4 = sub { }; } if(0) { print \&bar4; } 1; }); is $r, 1; is $@, ""; $r = eval(q{ use Sub::StrictDecl; # sub ref *bar5 = sub { }; if(0) { print \&bar5; } 1; }); is $r, undef; like $@, qr/\AUndeclared subroutine &main::bar5/; $r = eval(q{ use Sub::StrictDecl; # sub call if(0) { Baz::baz0(); } 1; }); is $r, undef; like $@, qr/\AUndeclared subroutine &Baz::baz0/; $r = eval(q{ use Sub::StrictDecl; # sub call sub Baz::baz1; if(0) { Baz::baz1(); } 1; }); is $r, 1; is $@, ""; $r = eval(q{ use Sub::StrictDecl; no warnings qw(reserved void); # bare string if(0) { quux0a; } 1; }); is $r, 1; is $@, ""; $r = eval(q{ use Sub::StrictDecl; # sub call sub quux0b; if(0) { quux0b; } 1; }); is $r, 1; is $@, ""; $r = eval(q{ use Sub::StrictDecl; # sub call sub quux1b; if(0) { quux1b 1; } 1; }); is $r, 1; is $@, ""; $r = eval(q{ use Sub::StrictDecl; # indirect method call if(0) { my $x; quux2a $x; } 1; }); is $r, 1; is $@, ""; $r = eval(q{ use Sub::StrictDecl; # sub call sub quux2b; if(0) { my $x; quux2b $x; } 1; }); is $r, 1; is $@, ""; $r = eval(q{ use Sub::StrictDecl; no warnings "reserved"; # bare string (and direct method call) if(0) { quux3a->x; } 1; }); is $r, 1; is $@, ""; $r = eval(q{ use Sub::StrictDecl; # sub call (and direct method call) sub quux3b; if(0) { quux3b->x; } 1; }); is $r, 1; is $@, ""; $r = eval(q{ use Sub::StrictDecl; # bare string (and direct method call) sub quux4a::x {} if(0) { quux4a->x; } 1; }); is $r, 1; is $@, ""; $r = eval(q{ use Sub::StrictDecl; # sub call (and direct method call) sub quux4b::x {} sub quux4b; if(0) { quux4b->x; } 1; }); is $r, 1; is $@, ""; $r = eval(q{ use Sub::StrictDecl; # indirect method call if(0) { quux5a Quux5a; } 1; }); is $r, 1; is $@, ""; $r = eval(q{ use Sub::StrictDecl; # sub call sub quux5b; if(0) { quux5b Quux5b; } 1; }); is $r, 1; is $@, ""; $r = eval(q{ use Sub::StrictDecl; # indirect method call sub Quux6a::quux6a {} if(0) { quux6a Quux6a; } 1; }); is $r, 1; is $@, ""; $r = eval(q{ use Sub::StrictDecl; # indirect method call sub Quux6b::quux6b {} sub quux6b; if(0) { quux6b Quux6b; } 1; }); is $r, 1; is $@, ""; $r = eval(q{ use Sub::StrictDecl; # bare string if(0) { my @x = (quux7a=>1); } 1; }); is $r, 1; is $@, ""; $r = eval(q{ use Sub::StrictDecl; # bare string sub quux7b; if(0) { my @x = (quux7b=>1); } 1; }); is $r, 1; is $@, ""; 1; Sub-StrictDecl-0.005/t/devel_callparser.t000444001750001750 72513133627475 20333 0ustar00zeframzefram000000000000use warnings; use strict; BEGIN { eval { require Devel::CallParser }; if($@ ne "") { require Test::More; Test::More::plan(skip_all => "Devel::CallParser unavailable"); } } use Test::More tests => 4; use Devel::CallParser (); my $r; $r = eval(q{ use Sub::StrictDecl; if(0) { foo0(); } 1; }); is $r, undef; like $@, qr/\AUndeclared subroutine &main::foo0/; $r = eval(q{ use Sub::StrictDecl; sub foo1; if(0) { foo1(); } 1; }); is $r, 1; is $@, ""; 1; Sub-StrictDecl-0.005/t/lexicalsub.t000444001750001750 51513133627475 17154 0ustar00zeframzefram000000000000use warnings; use strict; BEGIN { eval { require Lexical::Sub }; if($@ ne "") { require Test::More; Test::More::plan(skip_all => "Lexical::Sub unavailable"); } } use Test::More tests => 2; my $r; $r = eval(q{ use Sub::StrictDecl; use Lexical::Sub foo => sub { }; if(0) { print \&foo; } 1; }); is $r, 1; is $@, ""; 1; Sub-StrictDecl-0.005/t/pod_cvg.t000444001750001750 27313133627475 16443 0ustar00zeframzefram000000000000use warnings; use strict; use Test::More; plan skip_all => "Test::Pod::Coverage not available" unless eval "use Test::Pod::Coverage; 1"; Test::Pod::Coverage::all_pod_coverage_ok(); 1; Sub-StrictDecl-0.005/t/pod_syn.t000444001750001750 23613133627475 16474 0ustar00zeframzefram000000000000use warnings; use strict; use Test::More; plan skip_all => "Test::Pod not available" unless eval "use Test::Pod 1.00; 1"; Test::Pod::all_pod_files_ok(); 1; Sub-StrictDecl-0.005/t/scope.t000444001750001750 177313133627475 16161 0ustar00zeframzefram000000000000use warnings; use strict; BEGIN { unshift @INC, "./t/lib"; } use Test::More tests => 15; BEGIN { $^H |= 0x20000; } ok eval("if(0) { foo(); } 1"); ok !eval("use Sub::StrictDecl; if(0) { foo(); } 1"); ok eval("if(0) { foo(); } 1"); ok eval("{ use Sub::StrictDecl; } if(0) { foo(); } 1"); ok eval("use Sub::StrictDecl; no Sub::StrictDecl; if(0) { foo(); } 1"); ok !eval("use Sub::StrictDecl; { no Sub::StrictDecl; } if(0) { foo(); } 1"); SKIP: { skip "lexical hints don't propagate into eval on this perl", 7 unless "$]" >= 5.009003; ok eval("if(0) { foo(); } 1"); use Sub::StrictDecl; ok !eval("if(0) { foo(); } 1"); { ok !eval("if(0) { foo(); } 1"); ok eval("no Sub::StrictDecl; if(0) { foo(); } 1"); ok !eval("if(0) { foo(); } 1"); no Sub::StrictDecl; ok eval("if(0) { foo(); } 1"); } ok !eval("if(0) { foo(); } 1"); } ok eval q{ use Sub::StrictDecl; use t::scope_0; 1; }; ok !eval q{ use Sub::StrictDecl; BEGIN { my $x = "foo\x{666}"; $x =~ /foo\p{Alnum}/; } if(0) { foo(); } 1; }; 1; Sub-StrictDecl-0.005/t/lib000755001750001750 013133627475 15264 5ustar00zeframzefram000000000000Sub-StrictDecl-0.005/t/lib/t000755001750001750 013133627475 15527 5ustar00zeframzefram000000000000Sub-StrictDecl-0.005/t/lib/t/scope_0.pm000444001750001750 6013133627475 17506 0ustar00zeframzefram000000000000use warnings; use strict; if(0) { foo(); } 1;