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

Re: [MacPerl] MacPerl shared lib?



>jerry@pwa.acusd.edu (Jerry Stratton) writes:
>} Are there any instructions or guidelines anywhere on writing glues? I'd
>} like to be able to call Perl scripts directly from Cron; it requires
>} accepting appleevents, much in the same way that web cgis on the Mac
>} must accept appleevents. Since there is a Perl CGI glue, I suspect that
>} a Cron glue isn't impossible :*)
>
>You can already launch Perl scripts with a reasonable Macintosh cron,
>like for example Mark Malson's.  I do this several times daily.
>Malson's works by using an alias to the droplet in cron's folder with
>the usual cron pattern for the time(s) of launch as a name, but all you
>really have to do is tell the Finder to open the droplet at the time
>you want and away you go.  (This is a useful Applescript trick: if the
>application itself isn't scriptable, the Finder can always be told to
>open one of the application's documents.) Surely the other Cron's can
>do this?

Of course: Cron 1.01d6 can open a list of documents/folders with any
application, anywhere on your hard drive(s), by name or by creator code.
But that's all it can do without apple events: open files or apps. I can't
send parameters; I either have to hard code them in the Perl droplet, or
use an applescript gateway to grab the parameters and then call Perl with
a do script.

The advantage of Chris Johnson's Cron (and one of the two reasons I
chose it over Mark's, if I'm remembering his correctly) is that it can
send parameters as appleevents to my applescripts [or C/Pascal programs,
were I to write any].

I use this feature quite extensively to manage my net site and the
school's help site. For example, here's how I do the monthly log
analysis:

15 3 1 * * Cerebus "Negative Space:Iest:Utilities:Paul Bunyan"
"Start=Month-1" "End=Month-1" "Log=Negative Space:System
Folder:Preferences:NetPresenz Preferences D:NetPresenz Log 1"
"Template=Negative Space:Palnu:etc:LastMonth.blue" "Template=Negative
Space:Palnu:etc:Statistics.blueblue" "Template=Negative
Space:Palnu:etc:About.blueblueblue" "Output=Negative
Space:Palnu:html:NetLife:NSpace:Statistics:LastMonth.html"
"Output=Negative Space:Palnu:etc:Statistics.blue" "Output=Negative
Space:Palnu:etc:About.blueblue" "Activate=Clip2Gif"

On the first of every month at 3:15 in the morning, Cron calls Paul
Bunyan with those parameters and creates log analysis web pages based on
the template files I send as parameters. Paul Bunyan is an applescript
that accepts the argsargc event that Cron sends.

I'd like to be able to do this with Perl as well. Either something like:

open(THECRONPARAMS,"dev:AEVT:argsargc");
while !(<THECRONPARAMS>) {sleep 3;}
while (<THECRONPARAMS>) {
  #parse parameters
}
close THECRONPARAMS;

or by using a "save as... Cron app".

The former would be preferable, as it would allow "Droplets" and "CGIs"
to also accept cron events.

(Is it currently possible to have a Perl script which you've saved as
"CGI" also be a droplet? I've got applescript CGIs that can also accept
dropped files and cron events to control their behavior.)

Jerry
jerry@acusd.edu (Finger or Reply for PGP Public Key)
http://nspace.cts.com/             finger or e-mail help@nspace.cts.com
------
"But seriously, bad Dead songs are like bad sex... how bad can it 
get?" --Van Cushny