NAME
CatalystX::CRUD::YUI::Serializer - flatten CatalystX::CRUD::Object instances
SYNOPSIS
use CatalystX::CRUD::YUI::Serializer;
my $serializer = CatalystX::CRUD::YUI::Serializer->new(
datetime_format => '%Y-%m-%d %H:%M:%S',
html_escape => 1,
);
my $hashref = $serializer->serialize_object(
object => $my_object,
col_names => [qw( id name email )],
cat_context => $c,
rel_info => $rel_info,
);
DESCRIPTION
CatalystX::CRUD::YUI::Serializer turns objects into hashrefs, typically for rendering as JSON.
METHODS
Only new or overridden method are documented here.
new
Instantiate new Serializer.
datetime_format
Set strftime-style DateTime format string. Default is '%Y-%m-%d %H:%M:%S'. Used in serialize_object().
html_escape
serialize_object() will escape all special HTML characters by default. Set html_escape to false (0) if turn that feature off.
serialize_object( params )
Serialize a CatalystX::CRUD::Object instance, or an object that acts like one. params should be a hash or hashref of key/value pairs. The "object" key pair and "col_names" key pair are required.
params include:
object is the CRUD object to be serialized. Required
rel_info is a Rose::HTMLx::Form::Related::RelInfo object.
col_names is the list of column names to include in the serialized hashref. Required
parent_object is the originating object, in the case where you are serializing related objects.
cat_context is a $c object.
show_related_values is a hash ref of methods and foreign fields, as defined by Rose::HTMLx::Form::Related.
takes_object_as_argument is a hashref of method names where parent_object is expected as a single argument.
Returns a hashref of key/value pairs representing the object.
serialize_livegrid( livegrid_object )
Returns array ref of hash refs as passed through serialize_object().
AUTHOR
Peter Karman, <karman@cpan.org>
BUGS
Please report any bugs or feature requests to bug-catalystx-crud-yui@rt.cpan.org
, or through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
ACKNOWLEDGEMENTS
The Minnesota Supercomputing Institute http://www.msi.umn.edu/
sponsored the development of this software.
COPYRIGHT & LICENSE
Copyright 2008 by the Regents of the University of Minnesota.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.