Determine symlink name in required module

V

vurt

Hi,

I'm possibly not googling effectively, but I couldn't find an answer to
this.

Say I had a scriptanalogous something like:

require "/foo/bar/S01wibble.pm"

But the file is actually a symlink, ie:

/foo/bar/S01wibble.pm -> ../wibble.pm

How can I, in the required module, find the name of the symlink. I want to
be able to have behaviour analogous to rc scripts, and be able to have
different behaviour determined by the name I was called as. I hasten to
add I'm not actually trying to produce real rc scripts here...

Any tips would be welcome...
 
B

Ben Morrow

Quoth vurt said:
Hi,

I'm possibly not googling effectively, but I couldn't find an answer to
this.

Say I had a scriptanalogous something like:

require "/foo/bar/S01wibble.pm"

But the file is actually a symlink, ie:

/foo/bar/S01wibble.pm -> ../wibble.pm

How can I, in the required module, find the name of the symlink. I want to
be able to have behaviour analogous to rc scripts, and be able to have
different behaviour determined by the name I was called as. I hasten to
add I'm not actually trying to produce real rc scripts here...

AFAIK the only thing you can do is grovel through values %INC looking
for a symlink to the right place. I suppose that if you remove or
replace it every time wibble.pm is loaded this would even be reliable.

Ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top