I am most definitely not a Perl guru, so I might be asking a simple question but...I can't figure it out. I work on a model that uses Perl for some scripting that creates other scripts. I also work on a system where directories can "move" because of NFS. As an example, I have a directory on the system:
/discover/nobackup/mathomp4That is actually a path through a symlink:
$ pwd -L /discover/nobackup/mathomp4 $ pwd -P /gpfsm/dnb44/mathomp4
Every so often, due to disk systems filling up, they might have to move us from, say, dnb44 to dnb45, and if I use Perl to make a script before that move, well, things break. So, it would be good for Perl to use the logical and not physical path. For example, I have a script that wants to know what directory it was called from. My hope after reading the FindBin docs:
$Bin - path to bin directory from where script was invoked $RealBin - $Bin with all links resolved
was that Bin would do it, but it seems to be the same as RealBin:
$ cd $HOME $ cat /discover/nobackup/mathomp4/MyTestScript/bin/test.pl #!/usr/bin/env perl use FindBin; use File::Basename; my $fvroot = dirname($FindBin::Bin); print "Using Bin: $fvroot\n"; my $fvroot2 = dirname($FindBin::RealBin); print "Using RealBin: $fvroot2\n"; $ /discover/nobackup/mathomp4/MyTestScript/bin/test.pl Using Bin: /gpfsm/dnb44/mathomp4/MyTestScript Using RealBin: /gpfsm/dnb44/mathomp4/MyTestScript
Dang. So is there any way for Perl to see the logical path rather than the physical one?
In reply to Getting logical path from Perl? by mathomp4
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |