Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • The File::Spec::Functions solution fails to find the correct directory if $0 is a symlink whose value contains a slash. It will find the directory containing the symlink rather than the directory containing the target of the symlink. Also, on perl 5.8.2, catpath requires 3 arguments and you're only giving it 2. That can be fixed by adding a third "" argument.
    • Yes, because it purposely does not examine the file system. This should work:

      use Cwd 'abs_path';
      use File::Basename;
      use lib dirname( abs_path $0 );