Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Perl / February 2005



Tip: Looking for answers? Try searching our database.

Questions about Perl and Mac::Glue

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kim Helliwell - 13 Feb 2005 01:07 GMT
I've been struggling with accessing email messages in a particular
account and mailbox, and this (and some other stuff I'm trying)
engenders a question:

What's the proper way to visit all of a list of objects that are
elements
of another object? By trial and error, I've come up with the following,
which seems to work:

for $mbox ($account->obj('mailboxes')->get)
{
     ... do some stuff...
}

But what if I want a reference to a list of all the mailboxes? Should
I force a list context like this?

$mboxes = ($account->obj('mailboxes')->get);

I know that it doesn't work without the parens, because when I try
it, I only get the first one of whatever.

Kim Helliwell
kimgh@mac.com
Homepage: http://homepage.mac.com/kimgh
Chris Nandor - 14 Feb 2005 17:21 GMT
> for $mbox ($account->obj('mailboxes')->get)
> {
[quoted text clipped - 5 lines]
>
> $mboxes = ($account->obj('mailboxes')->get);

If you want a persistent reference to all the mailboxes, that will change as
the mailboxes change, then you just want merely:

  $account->obj('mailboxes')

And then call ->get on it whenever you want the mailboxes.

But if you want a Perl reference to the list of all mailboxes, then you just
need to make one explicitly.

  $mboxes = [ $account->obj('mailboxes')->get ];

Signature

Chris Nandor                      pudge@pobox.com    http://pudge.net/
Open Source Development Network    pudge@osdn.com     http://osdn.com/

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.