Peter Karman > CatalystX-CRUD-YUI > CatalystX::CRUD::YUI::Serializer

Download:
CatalystX-CRUD-YUI-0.031.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.031   Source  

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:

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.

syntax highlighting: