NAME
Google::AJAX::Library - Access the Google AJAX Libaries API in Perl
VERSION
version 0.022
SYNOPSIS
use Google::AJAX::Library;
my $library = Google::AJAX::Library->jquery;
$library->uri
# http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
$library->html
#
You can also fetch or write-out the library content:
my $library = Google::AJAX::Library->new(name => "mootools", version => "1.8.1");
my $content = $library->fetch;
# Into a scalar:
my $content;
$library->fetch(\$content)
# To a filehandle:
$library->write(\*STDOUT)
# To a file:
$library->write("/path/to/library.js")
# Check if a library exists at http://ajax.googleapis.com
# This will just do a HEAD request
$library->exists
DESCRIPTION
Google::AJAX::Library is a module for accessing the Google AJAX Libaries
API via Perl
You can find out more about the API here:
http://code.google.com/apis/ajaxlibs/
METHODS
Google::AJAX::Library->jquery([ , ])
Google::AJAX::Library->jQuery([ , ])
Returns a jQuery library object of the given version
If no version is given or the given version is 0, then the latest
version (1) will be used
You can pass through "uncompressed = 1" to get the non-compacted .js
For example:
my $library = Google::AJAX::Library->jQuery(1.2, uncompressed => 1)
Google::AJAX::Library->prototype([ ])
Returns a prototype library object of the given version
If no version is given or the given version is 0, then the latest
version (1) will be used
A compressed .js is not offered at this time
Google::AJAX::Library->scriptaculous([ ])
Returns a script.aculo.us library object of the given version
If no version is given or the given version is 0, then the latest
version (1) will be used
A compressed .js is not offered at this time
Google::AJAX::Library->mootools([ , ])
Google::AJAX::Library->MooTools([ , ])
Returns a MooTools library object of the given version
If no version is given or the given version is 0, then the latest
version (1) will be used
You can pass through "uncompressed = 1" to get the non-compacted .js
Google::AJAX::Library->dojo([ , ])
Returns a Dojo library object of the given version
If no version is given or the given version is 0, then the latest
version (1) will be used
You can pass through "uncompressed = 1" to get the non-compacted .js
$library->uri
Returns the URI for $library
$library->version
Returns the version of $library
$library->name
Returns the name of $library (e.g. jquery, scriptaculous, etc.)
$library->file
Returns the filename of $library (e.g. jquery.min.js, dojo/dojo.xd.js,
etc.)
$library->html
Returns a properly formatted HTML entry for $library
$library->exists
Returns 1 if the $library (at the URI, including the specified version)
exists at http://ajax.googleapis.com/
Returns 0 otherwise
This method uses a HEAD request to do the checking
$library->request
Returns the HTTP::Response of the GET request for $library
$library->fetch([ ])
Attempts to GET $library
Returns the HTTP::Response decoded content If is not given
If is a SCALAR reference then the content will be put into
This method is synonymous/interchangeable with "write"
$library->write( )
Attempts to GET $library
If is a GLOB reference then the content will be printed to
If is a filename (or Path::Class::File object) then the content
will be printed to the filename specified
This method will croak if $library couldn't be gotten from Google (e.g.
404)
This method is synonymous/interchangeable with "fetch"
SEE ALSO
JS::jQuery::Loader
JS::YUI::Loader
AUTHOR
Robert Krimen
COPYRIGHT AND LICENSE
This software is copyright (c) 2010 by Robert Krimen.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.