Determine symlink name in required module

Discussion in 'Perl Misc' started by vurt, May 23, 2004.

  1. vurt

    vurt Guest

    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...
     
    vurt, May 23, 2004
    #1
    1. Advertising

  2. vurt

    Ben Morrow Guest

    Quoth 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...


    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

    --
    Outside of a dog, a book is a man's best friend.
    Inside of a dog, it's too dark to read.
    Groucho Marx
     
    Ben Morrow, May 24, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. onetitfemme
    Replies:
    6
    Views:
    502
    onetitfemme
    Nov 2, 2005
  2. marco

    symlink overwrite

    marco, Jul 28, 2004, in forum: Python
    Replies:
    1
    Views:
    562
    Jeff Epler
    Jul 29, 2004
  3. Replies:
    4
    Views:
    774
    Daniel Dittmar
    Dec 16, 2004
  4. A. Murat Eren

    zipfile + symlink..

    A. Murat Eren, Jun 23, 2005, in forum: Python
    Replies:
    0
    Views:
    368
    A. Murat Eren
    Jun 23, 2005
  5. Marc Heiler
    Replies:
    4
    Views:
    286
    Robert Klemme
    Jun 10, 2009
Loading...

Share This Page