How to locate my script file itself when it is called by others.

Discussion in 'Perl Misc' started by MorningStar, Aug 2, 2005.

  1. MorningStar

    MorningStar Guest

    I wrote a perl script and it will be called by other modules.
    Now I need to know where I(my script) am when I am called.
    For example: If my script located in:
    And some one called it from:
    [home/someone]$ /home/morningstar/
    or even
    [home/someone]$ (if /home/morningstar is in $PATH ENV)

    Then when was executed, how can it get its location:

    If you don't understand what do I mean, just imagin the functionality
    of 2 Windows API: GetModuleFileName and GetModuleFileNameEx.

    MorningStar, Aug 2, 2005
    1. Advertisements

  2. perldoc FindBin

    John W. Krahn, Aug 2, 2005
    1. Advertisements

  3. MorningStar

    MorningStar Guest

    MorningStar, Aug 2, 2005
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.