[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] That Do Script thing



At 21:31 -0700 2000.09.06, Mikael Hansen wrote:
>The following works, but is not particularly elegant:
>
>---start calling AppleScript---
>set PerlArgs to "$a1 = 'x'; $a2 = 'y';"
>set PerlFile to "disk:folder:perlscript"
>
>set myFile to (open for access file PerlFile)
>set PerlScript to (read myFile)
>close access myFile
>
>tell application "MacPerl"
>   set r to (Do Script (PerlArgs & PerlScript & "MacPerl::Reply($result)"))
>end tell
>---end calling AppleScript---
>
>---start called Perl script---
>#!perl
>
>$result = $a1 . $a2;
>---end called Perl script---
>
>I'm wondering if it is possible to pass a list of strings and let the
>Perl script return a value, e.g.
>
>   set r to (Do Script (PerlScript, aList))

---start called Perl script---
#!perl

$result = join '', @ARGV;
---end called Perl script---



tell application "MacPerl"
   set r to (Do Script [PerlScript & "MacPerl::Reply($result)", "x", "y"))
end tell


@ARGV is populated with extra argumenrs to Do Script.

-- 
Chris Nandor                      pudge@pobox.com    http://pudge.net/
Open Source Development Network    pudge@osdn.com     http://osdn.com/

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org