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

[MacPerl] Mac::Glue progress



Today I worked on fetching data from a returned event.  I am going to be
making a new version of Mac::AppleEvents::Simple that provides get() and
data() methods, which work similarly to the AEDesc methods, but they break
lists up into Perl lists.

Anyway, I also changed the _obj() method to simply o(), and _prop()
(property) is p().  I know those are not the clearest of names, but they
could be called often enough that Shorter Is Better.  I think so, anyway.
You tell me.

  #!perl -wl
  use strict;
  use Mac::Glue::Finder;
  my($f, $o, $x);

  $f = new Mac::Glue::Finder;
  $o = $f->p('label_index', item=>"Bird");

  $f->set($o, {to=>5});                                       # set label index
  printf "Label Index of 'Bird' is %s\n", $f->get($o)->get;   # get label index

  $f->select($f->o(item=>'Megahertz XJA3288')); # select PCMCIA modem on
desktop
  $x = $f->get($f->p('selection'))->data;       # get descriptor for selection
  $f->open($x);                                 # open selection by descriptor

Last part could also be, of course:

  $f->open(  $f->get($f->p('selection'))->data  );

But in most cases, it just makes sense to do:

  $f->open($f->o(item=>'Megahertz XJA3288'));

and skip the rest altogether.  But this is Just a Test of what can be done.
Sometimes you do need to get a descriptor back and do something with it, so
that's what I am doing.

Obviously, this would be lengthier if you did error checking, but it works.
And the -w switch will warn on errors anyway (I think I might add a flag to
die() on errors, too, instead of just warning).

Thoughts and comments on this appreciated.  Also, thoughts on yesterday's
note about properties is sought.

Thanks,

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%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