|text||The text form allows plain text to be used to create the CSS object.|
|hash||The hash form allows a Perl hash to be used.|
|file||The file form allows a file to be specified.|
JQuery needs to be initialized.
my $jquery = new JQuery(jqueryDir => /jquery_js, usePacked => 1) ;
If usePacked is set, the compressed jQuery files are used if available.
add This adds a new object from JQuery::* to JQuery. Typically, this is used in a class implementing new functionality, and adds the new class to the controlling JQuery class. It is not normally called directly by the user. add_css Add css to JQuery. All css elements added are installed before that of css implemented by JQuery::*. This is used if the user wants to install CSS. add_css_last Similar to add_css, but the css gets added after the ccs implemented by JQuery::*. This means that the css installed by JQuery::* can be over-ridden by the user. Typically this would be used when changing colours, urls, backgrounds etc. getJQueryDir All JQuery::* objects get passed the a variable pointing to JQuery. Within JQuery::*, there may be a need to reference a path, eg an image, and the base path can be modified by using this directory.
This parameter is the jqueryDir passed by
my $jquery = new JQuery(jqueryDir => /jquery_js) ;
my $jquery = new JQuery(jqueryDir => /jquery_js) ;
usePacked JQuery modules can come in an unpacked or packed form. The former is the original source, while the second, although not compiled, is highly dense and obfuscated, while being more efficient.
There are a number of working examples in the cgi-bin directory, which can be found in the Perl distribution under the JQuery directory. The examples are mostly written using CGI::Application , so you will need to install CGI-Application to run the examples. This is not a restriction, as the modules will work using CGI and mod-apache as well, and hopefully the framework of yor choice.
The examples mostly use Demo.pm. This is a very simple module which initializes JQuery, calls get_jquery_code, get_css
The module Demo.pm simply does some of the repetitive work.
The setupfunction initiates $jquery. cgiapp_postrun gets runs $jquery->get_jquery_code, $jquery->get_css and puts both of these, and the HTML, into a very basic template.
Lets start with the Ajax.
Suppose you have a button, not neccessarily in a form, and you want some action to happen when the user presses the button.
Firstly, the JQuery module needs to be initialized.
use JQuery ; use JQuery::Taconite ; my $jquery = new JQuery(jqueryDir => /jquery_js) ;
<input id="ex1" type="button" value="Run Example 1" /> JQuery::Taconite->new(id => ex1, remoteProgram => /cgi-bin/jquery_taconite_results.pl, rm => myRunMode, addToJQuery => $jquery) ;
When the button is pressed, some output will be shown, and a placeholder is needed to display the text.
The HTML fragment might be:
<div id="example4" style="display:none; background-color: #ffa; padding:10px; border:1px solid #ccc"> Initially this div is hidden. </div>
This is a div where, initially, the text is not shown.
jquery_accordion.pl Shows an example of an accordion jquery_clickmenu.pl An example of a menu in a normal desktop application
Shows an example of an accordion
jquery_form.pl This is a small example showing how a from is constructed, and how the Ajax reply is sent, causing only the specified fields to be updated. jquery_splitter1.pl, jquery_splitter2.pl, jquery_splitter3.pl Examples showing how to split an area into two or three panes with a bar allowing the user to resize them. jquery_tabs1.pl jquery_tabs2.pl jquery_tabs_results.pl Examples showing a tabbing of a pane. When the tab is pressed a different page is shown. The user can download the page remotely from a server. jquery_taconite1.pl and jquery_taconite_results1.pl jquery_taconite2.pl Taconite is a word that doesnt sound very interesting, but this module allows you update your screen very easily without needing to know anything about the DOM. This is Ajax at its easiest. You really want to use this.
jquery_taconite1.pl sets up the page and jquery_taconite_results1.pl does the reply. This example show a variety of things to do with Taconite, by adding radio buttons, wiring a button on the fly, adding and removing items.
jquery_taconite2.pl jquery_taconite2.pl does the same sort of thing as jquery_taconite1.pl, except that it uses a run mode to define the reply.
Examples of split windows with a bar for resizing
jquery_treeview.pl Show an expandable tree. You can choose grid lines or folder icons. jquery_heartbeat.pl Show how to update a page every second.
A module needs to provide the following methods
new - to create the object
id - the id of the object. There are some modules that dont need this. This only happens in the case of where an instance does not have any css related to the id.
get_css - returns the css for the instance. The return value may be an array reference. css may be plain text or a JQuery:CSS object.
HTML - returns the HTML text for the instance
get_jquery_code - returns the jQuery code
Peter Gordon, <peter at pg-consultants.com>
Thanks to Brent Pedersen for pointing me in the direction of JQuery and to all contibutors to jQuery from whom css/images/whatever have been plagiarized.
Please report any bugs or feature requests to bug-jquery at rt.cpan.org, or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=JQuery>. I will be notified, and then youll automatically be notified of progress on your bug as I make changes.
You can find documentation for this module with the perldoc command.
You can also look for information at:
o AnnoCPAN: Annotated CPAN documentation o CPAN Ratings o RT: CPANs request tracker
o Search CPAN
Copyright 2007 Peter Gordon, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
|perl v5.20.3||JQUERY (3)||2016-03-17|