At 06.42 1998.05.05, Peter Hartmann wrote: >the following script is a purely mechanical adaption of Matthias >'recipe_as_osa' from his Perl Anarchists Cookbook, borrowing two lines from >Chris' AETutorial to make MacPerl print the result. I guess you could use Hey, here is a module based on your script. For some Frontier scripts, this will work just fine. All the user needs to do (once this package is put in a module) is: use Mac::Apps::Frontier; print frontier('clock.now()'); #!perl -w #define package; better to make into module file package Mac::Apps::Frontier; use strict; use Mac::Components; use Mac::OSA; use Mac::AppleEvents; use Exporter; use vars qw(@ISA @EXPORT); @ISA = qw(Exporter); @EXPORT = qw(frontier); my($UserTalk) = OpenDefaultComponent(kOSAComponentType(), 'LAND') or die $^E; sub frontier { my($script, $value, $return, $text); $script = _compile($_[0]); $value = OSAExecute($UserTalk, $script, 0, 0) or die $^E; $return = OSADisplay($UserTalk, $value, 'TEXT', 0) or die $^E; OSADispose($UserTalk, $value); OSADispose($UserTalk, $script); return (AEPrint($return) =~ /^Ò(.*)Ó$/); } sub _compile { my($script, $id); $script = AECreateDesc('TEXT', $_[0]) or die $^E; $id = OSACompile($UserTalk, $script, 0) or die $^E; AEDisposeDesc($script); return $id; } END{CloseComponent($UserTalk)} #define script package main; use strict; Mac::Apps::Frontier->import(); # just use Mac::Apps::Frontier if in module file print frontier('clock.now()'); __END__ -- Chris Nandor mailto:pudge@pobox.com http://pudge.net/ MacPerl: Power and Ease (ISBN 1881957322), http://www.ptf.com/macperl/ %PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6']) ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch