develooper Front page | perl.macosx | Postings from May 2003

DropScript confusion about cwd

Thread Next
From:
Rick Anderson
Date:
May 10, 2003 17:48
Subject:
DropScript confusion about cwd
Message ID:
3BA00C00-834A-11D7-954E-0003937BA240@attbi.com
I'm trying to write a perl script that I want to make into a droplet
with Dropscript. It needs it to be portable (not in the sense of
cross-platform, but rather in the sense of being able to be easily
moved from place to place and machine to machine.) To that end, I'm
trying to make my script aware of its current location (i.e, the path
to its parent directory) so it can create files in its current
directory.

I'm getting nowhere using either of these:

$currentDir = `cwd`

or

Use::Cwd;

$currentDir = cwd

Both of those return the current path of / regardless of where the
script is actually located. I was under the impression that doing so
would show the current path. Is this how DropScript is supposed to
work?

If so, would anyone out there have any suggestions for how to do this?
I have examined $0 as well, but that gives the path down into the
DropScript bundle and right to the script resource itself. Obviously,
I can do some regex magic on the path but that feels borderline skanky
and I don't want this to break easily.

--Rick  Anderson


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About