Re: [MacPerl] passing arguments: AppleScript to MacPerl
[email protected] (Nobumi Iyanaga) Sun, 8 Jul 2007 11:32:52 +0900
| Newsgroups | perl.macperl |
|---|---|
| Message-ID | <[email protected]> |
Hello Louis,
On Jul 8, 2007, at 2:43 AM, Louis Pouzin wrote:
> Hello Nobumi,
>
> Great to hear from you again. Thank you for your suggestions.
> Indeed I am using Mac OS on old MACs. One OS is 7.5.5, the other
> 9.0.4.
>
> I have tried your scheme.
> On OS 9.0.4, it fails, and I don't understand why.
>
> -- args is an argument list of class "list", each item is a string
> copy dog to the beginning of args
> activate perl
> tell perl to do script args -- error on script
> or
> tell perl
> Do Script args mode batch -- error on script
> end tell
>
> The diag is: end of line, etc. expected but "script" found
Why don't you use the normal 'tell application "MacPerl"' scheme?
>
> On OS 7.5.5 the statement "tell perl to do script args" calls dog.
> "Do Script args mode batch" fails on "mode", with the diag:
> Expected end of line but found identifier
>
> However, even when dog is called, no argument is copied to @ARGV.
If you don't use 'tell application "MacPerl"' scheme, I think the
script would not compile, and then I don't understand how 'dog' can
be called??
Anyway, please try the script as I wrote:
set my_script to "myDocument:Users:ni:Desktop:dog.pl"
set args to {"dog", "cat"}
set perl_arg to {}
set perl_arg to perl_arg & my_script
set perl_arg to perl_arg & args
tell application "MacPerl"
Do Script perl_arg mode Batch
end tell
The contents of "dog.pl" is the same as the one you wrote, that is:
$\ = "\n"; # print with EOL
print "nb args: ", scalar @ARGV;
$" = "\n"; # separator
print "@ARGV";
Best regards,
Nobumi Iyanaga
Tokyo,
Japan