in reply to Walk through HTML::Treebuilder

See method dump in HTML::Element and modify it

Replies are listed 'Best First'.
Re^2: Walk through HTML::Treebuilder
by Anonymous Monk on Jan 06, 2008 at 07:51 UTC
    add_address_attr($tree); sub add_address_attr { my $self = shift; for (@{$self->{'_content'}}) { if (ref $_) { # element $_->attr(addr => $_->address ); add_address_attr ($_); # recurse } } }

      I really don't occurred to me walk through the hash, thanks you very good and beautiful solution.

      I was looking for some method that walk to it, but this is a great idea

      Thank you again

      combined with the solution I proposed, that would be even more short and simple:

      $tree->parse_content (<DATA>); $_->attr ("addr", $_->address) for $tree->look_down (_tag => qr{.});

      I never knew about the address property. Thanks, very useful


      Enjoy, Have FUN! H.Merijn