summaryrefslogtreecommitdiff
path: root/lib/autouse.pm
diff options
context:
space:
mode:
authorMichael G. Schwern <schwern@pobox.com>2001-05-30 15:39:06 +0100
committerJarkko Hietaniemi <jhi@iki.fi>2001-05-30 12:47:11 +0000
commit5a02ccb1df652f2b0dd47663c285921ec8e27bd2 (patch)
treefce2a114877da0f102d92334e09af1c52232b6f1 /lib/autouse.pm
parentb7063bb1b92ff84997e600c7569e39546bc04230 (diff)
downloadperl-5a02ccb1df652f2b0dd47663c285921ec8e27bd2.tar.gz
Re: [PATCH lib/autouse.pm t/pragma/autouse.t] (was Re: [ID 20010528.001] use autouse 'URI::Escape' => qw(URI::Escape::uri_escape) failed)
Message-ID: <20010530143906.E670@blackrider.blackstar.co.uk> p4raw-id: //depot/perl@10318
Diffstat (limited to 'lib/autouse.pm')
-rw-r--r--lib/autouse.pm30
1 files changed, 21 insertions, 9 deletions
diff --git a/lib/autouse.pm b/lib/autouse.pm
index 15335b7cf9..d320195dd5 100644
--- a/lib/autouse.pm
+++ b/lib/autouse.pm
@@ -39,7 +39,7 @@ sub import {
my $closure_import_func = $func; # Full name
my $closure_func = $func; # Name inside package
- my $index = index($func, '::');
+ my $index = rindex($func, '::');
if ($index == -1) {
$closure_import_func = "${callpkg}::$func";
} else {
@@ -96,21 +96,33 @@ autouse - postpone load of modules until a function is used
If the module C<Module> is already loaded, then the declaration
- use autouse 'Module' => qw(func1 func2($;$) Module::func3);
+ use autouse 'Module' => qw(func1 func2($;$));
is equivalent to
use Module qw(func1 func2);
-if C<Module> defines func2() with prototype C<($;$)>, and func1() and
-func3() have no prototypes. (At least if C<Module> uses C<Exporter>'s
-C<import>, otherwise it is a fatal error.)
+if C<Module> defines func2() with prototype C<($;$)>, and func1() has
+no prototypes. (At least if C<Module> uses C<Exporter>'s C<import>,
+otherwise it is a fatal error.)
If the module C<Module> is not loaded yet, then the above declaration
-declares functions func1() and func2() in the current package, and
-declares a function Module::func3(). When these functions are called,
-they load the package C<Module> if needed, and substitute themselves
-with the correct definitions.
+declares functions func1() and func2() in the current package. When
+these functions are called, they load the package C<Module> if needed,
+and substitute themselves with the correct definitions.
+
+=begin _deprecated
+
+ use Module qw(Module::func3);
+
+will work and is the equivalent to:
+
+ use Module qw(func3);
+
+Its not a very useful feature and has been deprecated.
+
+=end _deprecated
+
=head1 WARNING