At 8:15 AM -0400 9/14/99, Chris Nandor wrote: > >Well, in AppleScript it would be something like this: > > get state of (PPP status) > >That is, you need to evaluate PPP status and then get the state key. You >can't just do "get state of PPP status" in AppleScript. So it is similar >here: > > print ${{$p->ppp_status}}{RAsb}; # ref to hash, deref, get value > Ok I'm not missing as much as I thought. (just jumping a little ahead) >Or as you did it, put it into a real hash, and then get the value. > >Note I am planning on allowing this instead (or maybe in addition to?): > > print ${{$p->ppp_status}}{state}; That would be more in line with your "Cool Mac::Glue method. > >But I first need to figure out exactly how to do it. It shouldn't be too >difficult ... I believe it should be the case that every key to the record >should be a class/property name. Any thoughts or insights? > That sounds like it should be correct. If I have any thoughts/insights as I continue to work with this I will let you know. >Here is another problem: should $p->ppp_status return a hash, a hashref, or >differently depending on list or scalar context? If don't like the latter >option, but I thought I would mention it. :) But if it returned a hash >reference instead of a hash, the advantages would be: > > 1. Nicer abbreivated syntax: $p->ppp_status->{state} > 2. Lower memory requirements if a big record is returned (not likely with > Apple events) > >Disadvantages: > > 1. Must assign my $hash = $p->ppp_status, and then call $hash->{key} > instead of my %hash = $p->ppp_status, $hash{key}; breaks old code > and is more effort to use in some cases (two extra chracters to type!) > >There are probably more. Any suggestions? > >-- >Chris Nandor mailto:pudge@pobox.com http://pudge.net/ >%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6']) My "gut" feeling is it should be a hashref. I know TMTOWTDI is the Perl mantra, but what would a reasonably experienced PERL programer expect? A hashref will be more difficult for a newbie to understand (such as some one who is frustrated by AppleScript and is trying to jump the fence.) But that is part of the learning curve. What yields a more consistent interface given all of the inconsistent extensions/applications? I think the answer is the hashref. The two extra characters may result in clear code. (Somebody is going to have to read what you write, It just may be you!) Dave Comparing Windows to a Mac is like comparing Sparkling Wine to Champagne. It has the bubbles and will get you drunk. But when you wake up in the morning you've got a headache. ==== Want to unsubscribe from this list? ==== Send mail with body "unsubscribe" to macperl-modules-request@macperl.org