CatalystX::CRUD::YUI::Serializer - flatten CatalystX::CRUD::Object instances
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, );
CatalystX::CRUD::YUI::Serializer turns objects into hashrefs, typically for rendering as JSON.
Only new or overridden method are documented here.
Instantiate new Serializer.
Set strftime-style DateTime format string. Default is '%Y-%m-%d %H:%M:%S'. Used in serialize_object().
serialize_object() will escape all special HTML characters by default. Set html_escape to false (0) if turn that feature off.
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.
Returns array ref of hash refs as passed through serialize_object().
Peter Karman, <karman@cpan.org>
<karman@cpan.org>
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.
bug-catalystx-crud-yui@rt.cpan.org
The Minnesota Supercomputing Institute http://www.msi.umn.edu/ sponsored the development of this software.
http://www.msi.umn.edu/
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.
To install CatalystX::CRUD::YUI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CatalystX::CRUD::YUI
CPAN shell
perl -MCPAN -e shell install CatalystX::CRUD::YUI
For more information on module installation, please visit the detailed CPAN module installation guide.