in reply to FindBin breaks dependency on File::Spec if using non-standard lib dir (WAS:@INC madness %$#%$#$@!)

To follow up: thanks to Tye for the clue:
o My script used FindBin to determine its absolute path.
o FindBin is standard with Perl, in my case 5.005_03.
o FindBin (v1.42) does 'use File::Spec;'
o File::Spec is standard with Perl.
o Perl 5.005_03 has File::Spec v0.6
o Many modules require File::Spec v0.8
o I was doing 'use FindBin' to add my path to @INC,
  to load my custom File::Spec v0.8. But I thus had
  loaded the wrong version of File::Spec before modifying
  @INC.
Tye pointed out that he has previously shown other ways in which FindBin can break, and has suggested a workaround using $0. This doesn't seem to provide a path that one can unshift onto @INC, though.

Another suggestion has been to remove the loaded File::Spec from %INC, but it seems we have to worry about symbols we've exported. I've checked the source of File::Spec and it doesn't export anything by default. But it looks like FindBin calls all kinds of methods on it :(

Meanwhile I'm hacking around with `pwd` but of course now I have to check that the user is in the right directory, but ... I still don't know where I am!!!!

Continuing to look into this.

  • Comment on FindBin breaks dependency on File::Spec if using non-standard lib dir (WAS: @INC madness %$#%$#$@!)