Hi,

maybe I missed some more convenient methods, but here are my solutions so 
far:

That's a working snippet for reading out a key-value pair from an HTML 
table:

  for my $details ($tables[4]->find('tr')->each) {
    my ($key,$value) 
       = map { $_->all_text } $details->find('td')->each;

    $result{$key} = $value; 
  }

My first attempt was something like

  my ($key,$value) = $details->find('td')->each->all_text; # WRONG

which does not work.

Then I tried map and ended in something complex like this one

  my ($key,$value) = @{
     Mojo::DOM->new("<b>K</b><b>V</b>")
       ->find("b")
       ->map(sub {$_->text})
       ->to_array
  };

I still would like my first attempt, which is IMHO more natural, but maybe 
against technically oriented design.

Comments?

Helmut Wollmersdorfer

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to