NAME

JS::YUI::Loader - Load (and cache) the Yahoo YUI framework

VERSION

Version 0.02

SYNOPSIS

use JS::YUI::Loader;

my $loader = JS::YUI::Loader->new_from_yui_host;
$loader->include->yuitest->reset->fonts->base;
print $loader->html;

# The above will yield:
# <link rel="stylesheet" href="http://yui.yahooapis.com/2.5.1/build/reset/reset.css" type="text/css"/>
# <link rel="stylesheet" href="http://yui.yahooapis.com/2.5.1/build/fonts/fonts.css" type="text/css"/>
# <link rel="stylesheet" href="http://yui.yahooapis.com/2.5.1/build/base/base.css" type="text/css"/>
# <script src="http://yui.yahooapis.com/2.5.1/build/yahoo/yahoo.js" type="text/javascript"></script>
# <script src="http://yui.yahooapis.com/2.5.1/build/dom/dom.js" type="text/javascript"></script>
# <script src="http://yui.yahooapis.com/2.5.1/build/event/event.js" type="text/javascript"></script>
# <script src="http://yui.yahooapis.com/2.5.1/build/logger/logger.js" type="text/javascript"></script>
# <script src="http://yui.yahooapis.com/2.5.1/build/yuitest/yuitest.js" type="text/javascript"></script>

You can also cache YUI locally:

my $loader = JS::YUI::Loader->new_from_yui_host(cache => { dir => "htdocs/assets", uri => "http://example.com/assets" });
$loader->include->yuitest->reset->fonts->base;
print $loader->html;

# The above will yield:
# <link rel="stylesheet" href="http://example.com/assets/reset.css" type="text/css"/>
# <link rel="stylesheet" href="http://example.com/assets/fonts.css" type="text/css"/>
# <link rel="stylesheet" href="http://example.com/assets/base.css" type="text/css"/>
# <script src="http://example.com/assets/yahoo.js" type="text/javascript"></script>
# <script src="http://example.com/assets/dom.js" type="text/javascript"></script>
# <script src="http://example.com/assets/event.js" type="text/javascript"></script>
# <script src="http://example.com/assets/logger.js" type="text/javascript"></script>
# <script src="http://example.com/assets/yuitest.js" type="text/javascript"></script>

DESCRIPTION

JS::YUI::Loader is a tool for loading YUI assets within your application. Loader will either provide the URI/HTML to access http://yui.yahooapis.com directly, or you can cache assets locally or serve them from an exploded yui_x.x.x.zip dir.

METHODS

JS::YUI::Loader->new_from_yui_host([ base => <base>, version => <version> ])

Return a new JS::YUI::Loader object configured to serve assets from http://yui.yahooapis.com/<version>

JS::YUI::Loader->new_from_yui_dir([ dir => <dir>, version => <version> ])

Return a new JS::YUI::Loader object configured to serve assets from a local, exploded yui_x.x.x.zip dir

As an example, for a dir of ./assets, the reset.css asset should be available as:

./assets/reset/reset.css

JS::YUI::Loader->new_from_uri([ base => <base> ])

Return a new JS::YUI::Loader object configured to serve assets from an arbitrary uri

As an example, for a base of http://example.com/assets, the reset.css asset should be available as:

http://example.com/assets/reset.css

JS::YUI::Loader->new_from_dir([ dir => <dir> ])

Return a new JS::YUI::Loader object configured to serve assets from an arbitrary dir

As an example, for a dir of ./assets, the reset.css asset should be available as:

./assets/reset.css

select( <component>, <component>, ..., <component> )

Include each <component> in the "manifest" for the loader.

A <component> should correspond to an entry in the YUI component catalog (see below)

include

Returns a chainable component selector that will include what is called

You can use the methods of the selector to choose components to include. See YUI component catalog below

You can return to the loader by using the special ->then method:

$loader->include->reset->yuilogger->grids->fonts->then->html;

exclude

Returns a chainable component selector that will exclude what is called

You can use the methods of the selector to choose components to include. See YUI component catalog below

You can return to the loader by using the special ->then method:

$loader->exclude->yuilogger->then->html;

YUI component catalog

animation - Animation Utility (utility)

autocomplete - AutoComplete Control (widget)

base - Base CSS Package (css)

button - Button Control (widget)

calendar - Calendar Control (widget)

charts - Charts Control (widget)

colorpicker - Color Picker Control (widget)

connection - Connection Manager (utility)

container - Container Family (widget)

containercore - Container Core (Module, Overlay) (widget)

datasource - DataSource Utility (utility)

datatable - DataTable Control (widget)

dom - Dom Collection (core)

dragdrop - Drag &amp; Drop Utility (utility)

editor - Rich Text Editor (widget)

element - Element Utility (utility)

event - Event Utility (core)

fonts - Fonts CSS Package (css)

get - Get Utility (utility)

grids - Grids CSS Package (css)

history - Browser History Manager (utility)

imagecropper - ImageCropper Control (widget)

imageloader - ImageLoader Utility (utility)

json - JSON Utility (utility)

layout - Layout Manager (widget)

logger - Logger Control (tool)

profiler - Profiler (tool)

profilerviewer - ProfilerViewer Control (tool)

reset - Reset CSS Package (css)

reset_fonts - reset-fonts.css (rollup)

reset_fonts_grids - reset-fonts-grids.css (rollup)

resize - Resize Utility (utility)

selector - Selector Utility (utility)

simpleeditor - Simple Editor (widget)

slider - Slider Control (widget)

tabview - TabView Control (widget)

treeview - TreeView Control (widget)

uploader - Uploader (widget)

utilities - utilities.js (rollup)

yahoo - Yahoo Global Object (core)

yahoo_dom_event - yahoo-dom-event.js (rollup)

yuiloader - Loader Utility (utility)

yuiloader_dom_event - yuiloader-dom-event.js (rollup)

yuitest - YUI Test Utility (tool)

AUTHOR

Robert Krimen, <rkrimen at cpan.org>

SEE ALSO

http://developer.yahoo.com/yui/, "yui/yuiloader/" in developer.yahoo.com

BUGS

Please report any bugs or feature requests to bug-js-yui-loader at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=JS-YUI-Loader. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc JS::YUI::Loader

You can also look for information at:

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

Copyright 2008 Robert Krimen, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.