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

[MacPerl] Glue question



In gluenotes.pod, I asked for an example of how this canonical AppleScript
example might be rendered in Perl:

    the first row in which the First Name column equals ¬
        "John" and the Last Name column equals "Chapman" ¬
        in the table "MyAddresses" of the database "SurfDB"

Well, this is what I have come up with:

    @row = $s->get($s->obj(
        row => 1, row => whose(AND =>
            [column => 'First Name', equals => 'John'],
            [column => 'Last Name', equals => 'Chapman']),
        table => 'MyAddresses', database => 'SurfDB'));

I have this working now:

    @row = $f->get($f->obj(
        record => 1, record => whose(AND =>
            [cell => 'Paid To', equals => 'The Deli'],
            [cell => 'Receipt For', contains => 'Sonia Long']),
        database => 'Cash Receipts'));

Basically, the tests work like this:

  comparison record:
    (PROPERTY, OPERATOR, VALUE), or
    (CLASS => VALUE, OPERATOR, VALUE)

    PROPERTY and CLASS => VALUE work like prop() and obj().  The PROPERTY
      form is the same as C<property => VALUE>.
    OPERATOR is contains, equals, begins_with, ends_with, l_t, l_e, g_t, or g_e
    VALUE is the value to compare to


  logical record:  (OPERATOR, LIST)

    OPERATOR is AND, OR, or NOT
    LIST is any number of other logical records or comparison records

So you can do:

  $f->get( $f->obj(name => windows => whose(
    AND => [name => contains => 'e'], [name => ends_with => 's'],
    [NOT => [popup => equals => glueTrue]]
  )));


Does this sound good?  Sound bad?  Any other thoughts of any kind?
(Feedback is good.)

--
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 macperl-request@macperl.org