1package Reaction::UI::Widget::Data; 2 3use Reaction::UI::WidgetClass; 4use namespace::clean -except => [qw(meta)]; 5 6extends 'Reaction::UI::Widget::Container'; 7 8before fragment widget { 9 my $data = $_{viewport}->args; 10 arg $_ => $data->{$_} for keys %$data; 11}; 12 131; 14 15__END__ 16 17=head1 NAME 18 19Reaction::UI::Widget::Data - Abstract class to render a data hash reference 20 21=head1 DESCRIPTION 22 23This takes the C<args> method return value of the viewport and populates the 24arguments with names and values from that value. 25 26=head1 FRAGMENTS 27 28=head2 widget 29 30Sets an argument for every key and value in the viewport's C<args> method return 31value (which is expected to be a hash reference). 32 33=head1 EXAMPLE LAYOUT 34 35Assuming this hash reference: 36 37 { first_name => "Foo", last_name => "Bar" } 38 39we can access it in a layout set like this: 40 41 =widget Data 42 43 =for layout widget 44 45 Hello [% last_name | html %], [% first_name | html %]! 46 47 =cut 48 49=head1 AUTHORS 50 51See L<Reaction::Class> for authors. 52 53=head1 LICENSE 54 55See L<Reaction::Class> for the license. 56 57=cut 58