The workaround suggested in the "KNOWN ISSUES" section of FindBin feels rather hackish. Here's a small code change introducing a new FindBin::again function to make things somewhat better. Regards, Slaven #### Patch data follows #### diff -up 'perl-5.8.0/lib/FindBin.pm' 'new.perl-5.8.0/lib/FindBin.pm' Index: ./lib/FindBin.pm --- ./lib/FindBin.pm Sat Jun 1 19:03:18 2002 +++ ./lib/FindBin.pm Tue Apr 29 17:13:33 2003 @@ -47,8 +47,14 @@ C<BEGIN> block, it'll be executed only o 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 diff -up 'perl-5.8.0/lib/FindBin.t' 'new.perl-5.8.0/lib/FindBin.t' Index: ./lib/FindBin.t --- ./lib/FindBin.t Sat Jun 1 19:03:18 2002 +++ ./lib/FindBin.t Tue Apr 29 17:18:22 2003 @@ -5,7 +5,7 @@ BEGIN { @INC = -d 't' ? 'lib' : '../lib'; } -print "1..1\n"; +print "1..2\n"; use FindBin qw($Bin); @@ -17,3 +17,9 @@ if ($^O eq 'MacOS') { print "not " unless $Bin =~ m,[/.]lib\]?$,; } print "ok 1\n"; + +$0 = "-"; +FindBin::again(); + +print "not " if $FindBin::Script ne "-"; +print "ok 2\n"; #### End of Patch data #### -- Slaven Rezic - slaven@rezic.de tktimex - project time manager http://sourceforge.net/projects/ptktools/Thread Next