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/