Title | Rating | Author(s) |
---|---|---|
<% $book->title %> | <% $book->rating %> | <%perl> my @authors = $book->authors; %perl> (<% scalar @authors %>) <% join(', ', @authors) %> |
##
print html_table(
html_tr(
html_th('Title'),
html_th('Rating'),
html_th('Authors'),
( map {
my $book = $_;
html_tr(
html_td( $book->title ),
html_td( $book->rating ),
html_td(
do {
my @authors = $book->authors;
scalar(@authors) . ' ' . join( ', ', @authors );
}
)
);
} @books
)
)
);