| 1 | package Mason::Result; | ||
| 2 | $Mason::Result::VERSION = '2.23'; | ||
| 3 | use Mason::Moose; | ||
| 4 | |||
| 5 | # Public attributes | ||
| 6 | has 'data' => ( default => sub { {} } ); | ||
| 7 | has 'output' => ( is => 'rw', default => '' ); | ||
| 8 | |||
| 9 | method _append_output ($text) { | ||
| 10 | $self->{output} .= $text; | ||
| 11 | } | ||
| 12 | |||
| 13 | __PACKAGE__->meta->make_immutable(); | ||
| 14 | |||
| 15 | 1; | ||
| 16 | |||
| 17 | __END__ | ||
| 18 | |||
| 19 | =pod | ||
| 20 | |||
| 21 | =head1 NAME | ||
| 22 | |||
| 23 | Mason::Result - Result returned from Mason request | ||
| 24 | |||
| 25 | =head1 SYNOPSIS | ||
| 26 | |||
| 27 | my $interp = Mason->new(...); | ||
| 28 | my $output = $result->output; | ||
| 29 | my $data = $result->data; | ||
| 30 | |||
| 31 | =head1 DESCRIPTION | ||
| 32 | |||
| 33 | An object of this class is returned from C<< $interp->run >>. It contains the | ||
| 34 | page output and any values set in C<< $m->result >>. Plugins may add additional | ||
| 35 | accessors. | ||
| 36 | |||
| 37 | =head1 METHODS | ||
| 38 | |||
| 39 | =over | ||
| 40 | |||
| 41 | =item output | ||
| 42 | |||
| 43 | The output of the entire page, unless L<out_method|Mason::Request/out_method> | ||
| 44 | was defined in which case this will be empty. | ||
| 45 | |||
| 46 | =item data | ||
| 47 | |||
| 48 | A hashref of arbitrary data that can be set via | ||
| 49 | |||
| 50 | $m->result->data->{'key'} = 'value'; | ||
| 51 | |||
| 52 | =back | ||
| 53 | |||
| 54 | =head1 SEE ALSO | ||
| 55 | |||
| 56 | L<Mason|Mason> | ||
| 57 | |||
| 58 | =head1 AUTHOR | ||
| 59 | |||
| 60 | Jonathan Swartz <swartz@pobox.com> | ||
| 61 | |||
| 62 | =head1 COPYRIGHT AND LICENSE | ||
| 63 | |||
| 64 | This software is copyright (c) 2012 by Jonathan Swartz. | ||
| 65 | |||
| 66 | This is free software; you can redistribute it and/or modify it under | ||
| 67 | the same terms as the Perl 5 programming language system itself. | ||
| 68 | |||
| 69 | =cut |