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

[MacPerl] more brain hurtage



I have successfully created a module with my droplet.  I still have a lot
to do, but the events and classes are taken care of, mostly.  So the
droplet creates Mac::Glue::Finder, and I can do:

  $f = new Mac::Glue::Finder;
  $f->update({item=>['my file',
    {folder=>['my folder',
    {folder=>['my other folder',
    {disk=>'HD',
}]}]}]});

Of course, this is kinda ugly.  It could be done like this:

  $obj = {disk=>'HD'};
  $obj = {folder=>['my other folder', $obj]};
  $obj = {folder=>['my folder', $obj]};
  $obj = {item=>['my file', $obj]};
  $f->update($obj);

But I had another thought: use an ordered array instead of a hash.

  $f->update([item=>'my file', folder=>'my folder',
    folder=>'my other folder', disk=>'HD']);

The problem here is that I do not know if what is passed is an AE List or
an AE Object.  I could check the specs for that event ... but what if it
accepts a list of objects?  There would be no easy way to tell if the above
were an object or a list of objects that I can think of (suggestions
welcome).

Another idea is to have an AE Object constructor:

  $obj = $f->ae_object(item=>'my file', folder=>'my folder',
    folder=>'my other folder', disk=>'HD');
  $f->update($obj);

This adds an extra level of interface, but is probably the most clean.
$obj would probably just be a Perl AEDesc object containing an AE object.

Any thoughts?

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