From: Vincent Pit Date: Thu, 28 Aug 2008 17:18:07 +0000 (+0200) Subject: Clarify what 'in' does with doc and tests X-Git-Tag: v0.03~9 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=8c014a64b4ed83a697c0109af2c1555bc8c26ae9;p=perl%2Fmodules%2Fsubs-auto.git Clarify what 'in' does with doc and tests --- diff --git a/lib/subs/auto.pm b/lib/subs/auto.pm index 7975e55..87fcc55 100644 --- a/lib/subs/auto.pm +++ b/lib/subs/auto.pm @@ -53,7 +53,7 @@ You can pass options to C as key / value pairs : C<< in => $pkg >> -Specifies on which package the pragma should act. Defaults to the current package. +Specifies on which package the pragma should act. Setting C<$pkg> to C allows you to resolve all functions name of the type C in the current scope. You can use the pragma several times with different package names to allow resolution of all the corresponding barewords. Defaults to the current package. =back diff --git a/t/11-pkg.t b/t/11-pkg.t index bd4ebb3..e97b704 100644 --- a/t/11-pkg.t +++ b/t/11-pkg.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 12; +use Test::More tests => 16; our $foo; @@ -21,6 +21,10 @@ our $foo; is($@, '', 'compiled to foo(3)'); is($foo, 3, 'main::foo was really called'); + eval { subs::auto::Test::Pkg::foo 4 }; + is($@, '', 'compiled to subs::auto::Test::Pkg::foo(4)'); + is($foo, 8, 'subs::auto::Test::Pkg::foo was really called'); + { package subs::auto::Test::Pkg; @@ -35,6 +39,16 @@ our $foo; } } +{ + package subs::auto::Test::Pkg; + + use subs::auto; + + eval { foo 8 }; + Test::More::is($@, '', 'compiled to foo(8)'); + Test::More::is($foo, 16, 'subs::auto::Test::Pkg::foo was really called'); +} + { use subs::auto in => '::';