Froody::Response::String - create a response from a string
my $response = Froody::Response::String->new() ->structure($froody_method) ->set_string($string) print $response->render;
This is a concrete implementation of Froody::Response. It takes its input from a valid Perl string, which you can set with set_string:
set_string
my $frs = Froody::Response::String->new(); $frs->structure($froody_method); $frs->set_string( <<ENDOFRSP ); <rsp stat="ok"> <monger>L\x{e9}on Brocard</monger> </rsp> ENDOFRSP
Note that there's no XML declaration header there - one will be added automatically. You can also set the bytes directly:
my $frs = Froody::Response::String->new(); $frs->structure($froody_method); $frs->set_bytes( <<ENDOFRSP ); <?xml version="1.0" encoding="utf-8" ?> <rsp stat="ok"> <monger>L\x{c3}\x{a9}on Brocard</monger> </rsp> ENDOFRSP
In this case you are required to include the XML declaration header (as we can't create one for you as we have no idea what encoding scheme the bytes are using)
Once you've loaded this class you can automatically convert other Froody::Response class instances to Froody::Response::String objects with the as_string method.
as_string
use Froody::Response::String; my $string = Froody::Response::Terse ->new() ->structure($froody_method) ->content(...) ->as_string; print ref($string); # prints "Froody::Response::String"
None known.
Please report any bugs you find via the CPAN RT system. http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Froody
Copyright Fotango 2005. All rights reserved.
Please see the main Froody documentation for details of who has worked on this project.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Froody, Froody::Response
To install Froody, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Froody
CPAN shell
perl -MCPAN -e shell install Froody
For more information on module installation, please visit the detailed CPAN module installation guide.