NAME

Froody::Response - result of a Froody::Method executing

SYNOPSIS

my $response = Froody::Response::String
                 ->new()
                 ->structure($froody_method)
                 ->set_string($string);
print $response->render;

DESCRIPTION

This class encapsulates a response from the Froody server, and are what the Invokers must return when Froody::Methods are called. You normally don't have to construct these yourself, as they're built by Froody::Invoker::Implementation for you from the data structure your code returned.

This class is an abstract class, with a couple of implementations on the system. Basically, responses are something that when you call render on them produce something that look like this:

<?xml version="1.0" encoding="utf-8" ?>
<rsp stat="ok">
  <foo>bar</foo>
</rsp>

Or this, if an error has occured:

<?xml version="1.0" encoding="utf-8" ?>
<rsp stat="fail">
  <err code="947" message="Frobinator insufficiently Bamboozled" />
</rsp>

METHODS

render

Abstract instance method, this method should return a byte encoded XML string in the standard response format. By "byte encoded" string we mean that the characters in the string should contain the bytes corrisponsing the the encoding scheme mentioned in the returned xml declaration.

Get/set an arrayref of CGI::cookie instances associated with the response.

add_cookie( name => 'name', value =>'value', expires => 'expires', domain => 'domain' )

Adds an associated a cookie to the response. Takes the following arguments:

name

The name of the cookie (required). This can be any string at all. Although browsers limit their cookie names to non-whitespace alphanumeric characters, CGI.pm removes this restriction by escaping and unescaping cookies behind the scenes.

value

The value of the cookie. This can be any scalar value, array reference, or even associative array reference. For example, you can store an entire associative array into a cookie this way:

$cookie=$query->cookie(-name=>'family information',
                       -value=>\%childrens_ages);
=item path

The optional partial path for which this cookie will be valid, as described above.

domain

The optional partial domain for which this cookie will be valid, as described above.

expires

The optional expiration date for this cookie. The format is as described in the section on the header() method:

"+1h"  one hour from now
secure

If set to true, this cookie will only be used within a secure SSL session.

(these docs from the CGI docs)

structure

The Froody::Method or Froody::ErrorType associated with this response. Something that has a 'structure' method, anyhows.

render

abstract method. Returns a froody-formatted XML response as a byte-sequence, used as a fall-back to convert between Froody::Response types.

render_xml

Synonym for render.

CONVERSION METHODS

as_string
as_perlds
as_xml
as_terse
as_error

BUGS

None known.

Please report any bugs you find via the CPAN RT system. http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Froody

AUTHOR

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.

SEE ALSO

Froody, Froody::Response