Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Perl Script, Know Thyself?

by brusimm (Pilgrim)
on Apr 14, 2007 at 17:48 UTC ( [id://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.

Replies are listed 'Best First'.
Re: Perl Script, Know Thyself?
by jdporter (Paladin) on Apr 14, 2007 at 17:57 UTC
Re: Perl Script, Know Thyself?
by shmem (Chancellor) 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
Domain Nodelet?
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?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-03-28 15:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found