[Catalyst] How to print/display some data in an end action
Andreas Marienborg
omega at palle.net
Wed Apr 30 11:29:53 BST 2008
On Apr 30, 2008, at 11:51 AM, Emmanuel Quevillon wrote:
> Hi,
>
> I'd like to incorporate an action into an <object> tag that only
> prints some data (XML SVG).
> I have an action in a controller Foo that do this :
>
> sub display : Local : Args(1) {
> ....
> my $t = $object->display_graph();
> $c->detach('Foo', 'end', [$t]);
> }
>
> sub end : Private {
> my($self, $c) = @_;
> my $g = $c->req->args()->[0];
> print $g;
> }
Never use print.
use $c->res->write[2], or set $c->res->body[1].
- andreas
[1]: http://cpansearch.perl.org/~mramberg/Catalyst-Runtime-5.7012/lib/Catalyst/Response.pm#$res-%3Ebody(%3C$text
|$fh|$iofh_object)
[2]: http://cpansearch.perl.org/~mramberg/Catalyst-Runtime-5.7012/lib/Catalyst/Response.pm#$res-%3Ewrite(_$data_)
More information about the Catalyst
mailing list