#===========================================================================
Copyright (C) 2008 by Nik Ogura. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Bug reports and comments to nik.ogura@gmail.com.
CGI::Lazy::Widget::DomLoader
use CGI::Lazy; my $q = CGI::Lazy->new('frobnitz.conf'); my $domloader = $q->widget->domloader({ raw => { jsobjectname => $perlvariable, someotherobj => $someOtherVariable, }, lookups { countryLookup => { #name of resultant DOM object sql => 'select ID, country from countryCodeLookup ', orderby => ['ID'], output => 'hash', primarykey => 'ID', }, }, }); print $domloader->output;
CGI::Lazy::Widget::DomLoader is an object for preloading useful stuff into a page's DOM, such as lookup queries, or any javascript object that might be desired. This is functionality that is duplicated from the internals of CGI::Lazy::Widget::Dataset, but it's included as a separate object for preloading arbitrary values for other purposes.
It's created by calling the domloader method on the widget object, and passing in its configuration hashref.
Queries to be run and loaded into the DOM as simple lists.
Raw perl variables to be parsed and converted to javascript objects. This is intended to facilitate loading complex data structures, arrays of arrays, hashes of hashes, etc into the DOM. Basically you create it in perl, and it gets parsed into JS and loaded into the DOM for the page.
Returns output of object for printing to the web page
To install CGI::Lazy, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CGI::Lazy
CPAN shell
perl -MCPAN -e shell install CGI::Lazy
For more information on module installation, please visit the detailed CPAN module installation guide.