I am getting a error returned when I use the shell script to call a perl script. This script works fine and I get expected results when I run it from the terminal window.
When I do it from applescript I get the following error.
Can’t locate LWP/UserAgent.pm in @INC (@INC contains: /System/Library/Perl/5.8.6/darwin-thread-multi-2level /System/Library/Perl/5.8.6 /Library/Perl/5.8.6/darwin-thread-multi-2level /Library/Perl/5.8.6 /Library/Perl /Network/Library/Perl/5.8.6/darwin-thread-multi-2level /Network/Library/Perl/5.8.6 /Network/Library/Perl /System/Library/Perl/Extras/5.8.6/darwin-thread-multi-2level /System/Library/Perl/Extras/5.8.6 /Library/Perl/5.8.1 .) at /Library/Perl/getcatsL1.1.pl line 3.¨BEGIN failed–compilation aborted at /Library/Perl/getcatsL1.1.pl line 3.
i don’t seem to have ‘/Library/Perl/getcatsL1.1.pl’ on my system, so my error is ‘File Missing’.
you might try something like this:
do shell script "/usr/bin/perl /Library/Perl/getcatsL1.1.pl"
but that’s just a guess. i’ll google for ‘getcatsL1.1.pl’ and see if i can find it and download.
cheers.
EDITED: i found your earlier post, but not the code. definitely don’t do “Perl /Library/Perl/getcatsL1.1.pl” because capitalization is important in Unix. try the above and see if it works.-w
The “getcatsL1.1.pl” file is my/the perl script i made to get xml data so you will not find this elsewhere.
In my hunting it seems to be a error in the state of the shell. It reacts different when called from applescript than it does when I run the script right from the shell.
I am trying to figure out where or what I need to on.
setting the state or set up of the shell / terminal
setting perl different
3)preparing my applescript do shell different
I did try your script and it gives the same error list.
i think you are right about the state of the shell. typically the ‘do shell script’ calls ‘sh’, while on the termnal you use ‘bash’. it’s probably some path you have that the ‘do shell script’ does not.
try this, at the terminal type:
echo $PATH
and then run this:
set myPath to (do shell script "/bin/echo $PATH")
display dialog myPath
and see how they are different. you may have to specifically set a path in your perl script. i’ll look into that.
obviously i’m not a perl expert, nor do i play one on TV. however, after checking this article it seems that your LWP/UserAgent.pm is not installed in perl’s default path. for some reason you must have that path in your user account. i don’t quite understand how all of this works, but you should be able to get the perl path that AppleScript is calling like this:
set myPerl to (do shell script "/usr/bin/perl -le 'print for @INC'")
display dialog myPerl
it seems to me that if you moved LWP/UserAgent.pm into one of those paths, you should be ok. you could also try to add the LWP/UserAgent.pm’s current path to perl, but you’d probably need to go to a perl messageboard to find that kind of info.
Bareword found where operator expected at -e line 1, near “/Library/Perl”
(Missing operator before Perl?)
Bareword found where operator expected at -e line 1, near “1.pl”
(Missing operator before pl?)
syntax error at -e line 1, near “/Library/Perl”
Execution of -e aborted due to compilation errors
that indicates a problem with the perl file. without seeing and testing it, i would not be able to diagnose. hopefully someone else may have a bit more perl knowledge, but i’m really out of my depth here.