Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Perl Script, Know Thyself?

by brusimm (Pilgrim)
on Apr 14, 2007 at 17:48 UTC ( #610089=perlquestion: print w/ replies, xml ) Need Help??
brusimm has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks:

I have users that wish to use a script that can determine it's own location after they have copied the original script to some location of their choice. I'm assuming they want to report the location of the script to some form of output. The users are being vague about this.

Is there a function or script technique to affect this result? I've looked around on nntp.perl.org, cpan & google and nothing stands out as to what I am looking for.

Any guidance / help would be appreciated. Thank you everyone.

Comment on Perl Script, Know Thyself?
Re: Perl Script, Know Thyself?
by jdporter (Canon) on Apr 14, 2007 at 17:57 UTC
Re: Perl Script, Know Thyself?
by shmem (Canon) on Apr 14, 2007 at 18:53 UTC
    You could...
    use Cwd qw(abs_path); my $location = abs_path($0); print "Location: $location\n";

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://610089]
Approved by GrandFather
Front-paged by bingos
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (11)
As of 2014-07-14 07:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (256 votes), past polls