Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^3: Full path to the current file?

by davidrw (Prior)
on Jan 08, 2008 at 16:01 UTC ( #661115=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Full path to the current file?
in thread Full path to the current file?

OP said I have a module that needs to know its path in order to access another file in the same location. -- the second step of File::Basename is to fulfill that requirement (even though he didn't directly ask for it).


Other shell (bash) solutions:

# setup cd /var/tmp/ touch foo f='../../var/tmp/foo' # for just the directory: d=`(cd ${f%/*} && pwd)` #or: d=`dirname $f` d=`cd $d && pwd` # for the filename (rel2abs): d=`dirname $f` d=`cd $d && pwd` f=`basename $f` f=`/bin/ls $d/$f`


Comment on Re^3: Full path to the current file?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2014-11-27 22:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (188 votes), past polls