At 13:56 +0000 3/12/09, David Cantrell wrote:
On Thu, Mar 12, 2009 at 09:27:54AM -0400, Wayne Brissette wrote:

I'm new to writing perl and perl in Mac OS X, although I've had plenty of AppleScript experience.

Anyhow, I'm playing around with reading in some static files in perl, what I've discovered is that if put the script in the same directory as the text file, it works properly. However, if I try to provide a path like: ~/Documents/log_files/

The script can't open the file. is there a trick in Mac OS X to do this that is outside the perl norm?

Using ~ as a shortcut for your home directory is a shell-ism, perl
doesn't handle it.  Replace it with $ENV{HOME}, or if you want your code
to be portable to non-Unix platforms, use the File::Homedir module.

If you're using AppleScript's "do shell script" command remember that those environment variables may not be what you expect. You're passed through a bash shell that doesn't read your profile stuff. I believe $HOME is OK but a lot of other things are not. $PATH and $PERL5LIB certainly do not work.

$HOME/.MacOSX/environment.plist is something you might want to learn about.

-> Stocks are getting pilloreid <-

Reply via email to