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

[MacPerl] How to get MacPerl STDERR from AppleScript



I'm a newbie for MacPerl and AppleScript (especially the latter).

I'm making a script to control MacPerl STDOUT and STDERR from
AppleScript. I want to run a MacPerl script written in the variables of
AppleScript, and to receive STDOUT and STDERR of MacPerl into the
variables of AppleScript.

According to the file "MacPerl.Frontend" in the MacPerl Application
Package, It describes the followings:

-----------------------------------------------------------
Event:                  "Do Script" [misc/dosc]
Direct parameter:       A file [fss ], text [TEXT] or a list
                        of files and text.
Reply:                  Text results, depending on mode.
"extract" [EXTR] (opt): A boolean [bool] which when false
                        prevents searching for a #! line.
"debug" [DEBG] (opt):   A boolean which when true runs the
                        Perl debugger
"mode" [MODE] (opt):    A mode [MODE], one of Local [LOCL],
                        Batch [BATC], Remote [RCTL],
                        or Duplex [DPLX].

...(omitted)

 - Batch mode redirects standard output and error to the
   reply apple event. Standard output is put into the direct
   parameter of the reply, while standard error is
   put into element [diag] of parameter [OUTP].
-----------------------------------------------------------

I found that I may use Batch mode, but I don't know the meanings
of [diag], [OUTP], etc. and I don't know how to use these.

For example, 

-----------------------------------------------------------
set scriptText to "
    print \"Hello, MacPerl STDOUT!\\n\";
    print STDERR \"Hello, MacPerl STDERR!\\n\";
"

tell application "MacPerl"
    Do Script scriptText mode Batch
    set stdoutText to result
--  set stderrText to XXXXXX    -- I don't know how define this
end tell

stdoutText
-- stderrText                   -- not defined
-----------------------------------------------------------

I can get STDOUT to the variable "stdoutText", but I don't know
how to get STDERR into the variable "stderrText".

Please teach me!

---
Tomohisa Iwanaga
iwanaga@crl.hitachi.co.jp


***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch