summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/perl/lib/FindBin.pm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/usr.bin/perl/lib/FindBin.pm')
-rw-r--r--gnu/usr.bin/perl/lib/FindBin.pm20
1 files changed, 15 insertions, 5 deletions
diff --git a/gnu/usr.bin/perl/lib/FindBin.pm b/gnu/usr.bin/perl/lib/FindBin.pm
index 8be9cb6b5af..4610beb2cd3 100644
--- a/gnu/usr.bin/perl/lib/FindBin.pm
+++ b/gnu/usr.bin/perl/lib/FindBin.pm
@@ -42,13 +42,19 @@ directory.
=head1 KNOWN ISSUES
If there are two modules using C<FindBin> from different directories
-under the same interpreter, this won't work. Since C<FindBin> uses
+under the same interpreter, this won't work. Since C<FindBin> uses a
C<BEGIN> block, it'll be executed only once, and only the first caller
will get it right. This is a problem under mod_perl and other persistent
Perl environments, where you shouldn't use this module. Which also means
that you should avoid using C<FindBin> in modules that you plan to put
-on CPAN. The only way to make sure that C<FindBin> will work is to force
-the C<BEGIN> block to be executed again:
+on CPAN. To make sure that C<FindBin> will work is to call the C<again>
+function:
+
+ use FindBin;
+ FindBin::again(); # or FindBin->again;
+
+In former versions of FindBin there was no C<again> function. The
+workaround was to force the C<BEGIN> block to be executed again:
delete $INC{'FindBin.pm'};
require FindBin;
@@ -96,9 +102,9 @@ use File::Spec;
%EXPORT_TAGS = (ALL => [qw($Bin $Script $RealBin $RealScript $Dir $RealDir)]);
@ISA = qw(Exporter);
-$VERSION = "1.43";
+$VERSION = "1.44";
-BEGIN
+sub init
{
*Dir = \$Bin;
*RealDir = \$RealBin;
@@ -179,5 +185,9 @@ BEGIN
}
}
+BEGIN { init }
+
+*again = \&init;
+
1; # Keep require happy