Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re^2: Curious Symlink question

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

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


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?

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2023-09-30 03:35 GMT
Find Nodes?
    Voting Booth?

    No recent polls found