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

[MacPerl] New Mac::Glue 19980930



-----BEGIN PGP SIGNED MESSAGE-----

New version.  Come and get it:

    <ftp://pudge.net/pub/pudge/macperl/glue.19980930.sit.hqx>

Two sample modules and a sample script included.  Very little
documentation.  Feel free to ask me questions on the list, as I think this
is something that affects many people on the list, even if they don't want
to download the alpha.

NB: glue modules created under previous versions will no longer work.

PREREQUISTIES:
  * updated AutoLoader and Exporter

    <ftp://ftp.clark.net/ftp/pub/schinder/Fixed_Library_Routines/
        AutoLoader.pm>

    <ftp://ftp.clark.net/ftp/pub/schinder/Fixed_Library_Routines/
        Exporter.pm>

  * _newly updated_ Mac::AppleEvents::Simple and Mac::Apps::Launch

    <ftp://pudge.net/pub/pudge/macperl/Mac-AppleEvents-Simple/
        Mac-AppleEvents-Simple-0.51.tgz>

    <ftp://pudge.net/pub/pudge/macperl/Mac-Apps-Launch/
        Mac-Apps-Launch-1.60.tar.gz>

Quick Overview:
- ---------------

This is for controlling any scriptable app with MacPerl, using language
similar to AppleScript instead of the raw Apple Events we've had to use all
this time.

This thing is comprised of two portions, a droplet (glue_me.dp) and a
module (Mac::Glue).  The aete resource is parsed by the droplet (thanks to
David C. Schooley's original droplet) and a module is created that uses
Mac::Glue, and is appropriately subclassed under Mac::Glue.

Two test glue modules are included: Mac::Glue::Finder and
Mac::Glue::Anarchie_Pro.  They have not been changed at all except for one
manual change in Mac::Glue::Finder, I changed the second open event (there
are two) to C<open2>.  Oh, I also added the 'using' parameter to that
event, since it was absent (that gives you an idea of what is actually
missing from many C<aete> resources).

Mac::Glue is where most of the work is done.  The other modules just
provide the parameters required for Mac::Glue to do the right thing.

The Glue.pm file should be placed in your MacPerl Ä:site_perl:Mac:
directory, and then this short script needs to be run:

  #!perl -w
  use AutoSplit;
  $dir = "$ENV{MACPERL}site_perl";
  autosplit("$dir:Mac:Glue.pm","$dir:auto",0,1,1);

The two other modules need to be placed in the MacPerl
Ä:site_perl:Mac:Glue: directory.  Same thing goes for any new modules you
create.

It is alpha, and is not very close to being feature complete.  I have done
quite a bit, but I have more to do, and feedback on this is welcome.

The sample script, plus the discussion of the last several weeks on the
mac-perl list, should be able to get you started.  Of course, please send
me any input you have, and feel free to send discussion to the list.  And
please, test it out on scriptable apps you know fairly well; that way you
can better guage the thing.

Recent changes:
- ---------------

* all parameters except for the direct object are named (direct object can
be named too, if you like, but the others must be named):

  $obj->event('direct object data', {param1=>$data1, param2=>$data2});

* huge speed improvements (Mac::AppleEvents::Simple was a big slowdown, and
I have a new version to upload)

* replies only returned to events if 1.) the event calls for them (i.e.,
reply ne 'null'), or 2.) it is asked for explicitly:

  $f->event('data', {param=>$data, _reply=>1});

* more documentation, in Mac::Glue and in created modules (yay! :-)

* ae_object() method has changed name to _obj

* sample Finder.pm shows how to edit created module to suit needs

* as part of fixing slowness problem, switching frontmost app has been
changed.  switching will not happen by default, only if it is called for
explicitly in one of the following manners:

  $f->_switch(1);                                 # will now switch with
                                                  # every event call
  $f->event('data', {param=>$data, _switch=>1});  # will switch only for
                                                  # this event call

Also, we use SetFrontProcess() to switch to the frontmost app, instead of
LaunchApplication().

There are other minor changes, but there are the most of them.

Thanks,

- --
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 5.0 for non-commercial use <http://www.pgp.com>
Charset: noconv

iQCVAwUBNhKJQyhcZja3bnKtAQG4ZAP/ZCwFEx/frobebu4tipiFVIKfaN07gHrF
MrhhoiySA2DVpU2+tW3QyuaZEGrwHmo4YANsU7LFADTD2OvgPxJNHmvxrYKtg4Rm
8ZJk1c340o1FpEbGuoxvqrBUt97jB0p7Ct5afzBgs+gEu7HZoBeSNCIhZft+tudP
DhAIHXSdkJc=
=9GCM
-----END PGP SIGNATURE-----

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