On 4/19/07, Rob Dixon <[EMAIL PROTECTED]> wrote:
snip
for (my $elem = $doc->firstChild; $elem; $elem = $elem->nextSibling) {
:
}
snip
I covered that in my earlier email:
Weirder stuff that you only tend to see people coming from a C background do
for (my $node = $head; $node;$node = $node->next) {}
...
But in Perl it is rarely necessary to do this sort of loop since most
functions return a list that can be iterated over using for:
for my $node ($head->nodes) {}
In this case your module should include a children method
for my $elem ($doc->children) {}
or a true iterator
my $iter = $doc->child_iter;
while (my $elem = $iter->next) {}
If it doesn't then bug the maintainer to add one or both. Having a
true iterator will put him or her ahead of the curve for Perl 6's
iterated-the-iterator operator
for =$iter -> $elem {}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/