Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: Getting logical path from Perl?

by talexb (Chancellor)
on Mar 08, 2021 at 13:54 UTC ( #11129331=note: print w/replies, xml ) Need Help??

in reply to Getting logical path from Perl?

If pwd -L gives you the answer you want, can you just grab that value when you need it?

Alex / talexb / Toronto

Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.

Replies are listed 'Best First'.
Re^2: Getting logical path from Perl?
by mathomp4 (Novice) on Mar 08, 2021 at 17:59 UTC

    The issue with pwd -L is that we don't always run these scripts from the bindir. So, we'd have to chdir to do so and:

    $ cat /discover/nobackup/mathomp4/MyTestScript/bin/ #!/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"; chomp($pwdL = `pwd -L`); print "Current pwd -L: $pwdL\n"; chdir($fvroot); chomp($pwdL2 = `pwd -L`); print "After pwd -L: $pwdL2\n" $ /discover/nobackup/mathomp4/MyTestScript/bin/ Using Bin: /gpfsm/dnb44/mathomp4/MyTestScript Using RealBin: /gpfsm/dnb44/mathomp4/MyTestScript Current pwd -L: /home/mathomp4 After pwd -L: /gpfsm/dnb44/mathomp4/MyTestScript

    So, it's not logical because the chdir didn't go to the logical path! That said, I haven't yet tested the Path::Tiny yet.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11129331]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2022-01-21 09:27 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (57 votes). Check out past polls.