#===========================================================================
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::Ajax
use CGI::Lazy; my $q = CGI::Lazy->new('/path/to/config'); my $widget = $q->ajax->dataset({...});
CGI::Lazy::Ajax is an abstract class for the Lazy Ajax widgets such as Dataset, Composite, and Domloader.
Its methods are called internally by its child classes. There are, at present, no real uses for the class by itself.
Wraps data (presumably from widget) in json format with validator from widgets for returning to browser in response to an ajax reqeust
List of widgets to be parsed for validators
Widget html output
Runs select based on args and returns output. By default will be sans enclosing div tags, but div can be included if you pass div => 1. This is useful for children of composite widgets.
Hash of select parameters
traverses variable and strips out single quotes to prevent JSON parser blowing up.
Strips them out rather than escaping them, as at present I can't figure out how to just add a single fracking backslash to them. s/'/\\'/g gives 2 backslashes, and s/'/\'/g gives none. grr. problem seems to be in either JSON or JSONPARSER
whatever variable you're going to convert to json and then parse
Runs queries for lookup tables and parses then into JSON wrapped in javascript suitable for loading into the DOM of a page.
Useful only for tables that are intended to be preloaded into a page at load.
Convenience method. Returns blank widget output
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.