Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: Curious Symlink question

by patrickrock (Beadle)
on May 02, 2005 at 22:59 UTC ( [id://453435]=note: print w/replies, xml ) Need Help??


in reply to Re: Curious Symlink question
in thread Curious Symlink question

Roy,

Yes, precisely. I wondered if there was a way for a file to know what symlink was originally.

I thought maybe it got passed along or something.

Sigh, I guessed not, but one can hope.

Replies are listed 'Best First'.
Re^3: Curious Symlink question
by Roy Johnson (Monsignor) on May 02, 2005 at 23:09 UTC
    If you're calling the program using the symlink, you can use __FILE__ (or, as the others have suggested, $0). That gives you the name of the program called, and it doesn't matter whether it's a symlink or a real file. If you're calling the program using the real file name, no. A file might have numerous symlinks to it, and it doesn't have any place to keep track of them.

    Caution: Contents may have been coded under pressure.
Re^3: Curious Symlink question
by ikegami (Patriarch) on May 02, 2005 at 23:01 UTC
    You can, if you want the symlink used to start the Perl script currently being executed. It's in $0.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-03-29 01:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found