IWL - A widget library for the web
This documentation refers to IWL version 0.52
use IWL; # create the main container, and a few widgets my $page = IWL::Page->new; my $frame = IWL::Frame->new; my $iconbox = IWL::Iconbox->new (width => '800px', height => '600px'); my $button = IWL::Button->newFromStock ('IWL_STOCK_CANCEL'); my %some_icon_info = ("foo.jpg" => 'foo', "bar.png" => 'bar'); # Setting up the icons and adding them to the iconbox foreach (keys %some_icon_info) { my $icon = IWL::Iconbox::Icon->new; $icon->setImage($_); $icon->setText($some_icon_info{$_}); $icon->setDimensions('64px', '64px'); $icon->setSelected(1) if $_ == 'something'; $iconbox->appendIcon($icon); } $page->appendMetaEquiv("Cache-control" => "no-cache"); $frame->setLabel("Frame label"); # Adding the children to their parents $frame->appendChild($iconbox); $frame->appendChild($button); $page->appendChild($frame); # Finally printing the page $page->print;
The IWL includes several widgets with which consistent web pages can be built quickly. The structure resembles the DOM tree, with the API mimicking Javascript very closely. The widgets themselves can be used either as standalone object in an already existing scripts, or can be used to build new scripts from the grounds up. They can be finalized in both HTML markup, and JSON notation, which can be used for scripts. More advanced widgets like the Iconbox come with Javascript files which are automatically included when the widget is finalized as HTML.
The following widgets have so far been written. They have extensive documentation for their methods
IWL::Anchor - An anchor widget ("<a>") IWL::Break - A break widget ("<br>") IWL::Button - A graphic button widget IWL::Calendar - a calendar widget IWL::Canvas - The html5 canvas element ("<canvas>") IWL::Checkbox - A checkbox widget (checkbox + text) IWL::Combo - A combobox widget ("<select>") IWL::Combo::Option - The content of a combobox ("<option>") IWL::Comment - A widget for placing comments (and conditional comments) IWL::Container - A basic container widget ("<div>") IWL::Contentbox - A generic window-like contentbox IWL::Druid - A step-based druid widget IWL::Entry - An entry widget with support for icons IWL::File - A file upload widget ("<input type="file">") IWL::Form - A form widget ("<form>") IWL::Frame - A frame widget ("<fieldset>") IWL::Hidden - A hidden input object ("<input type="hidden">") IWL::Hbox - A container widget for positioning widgets horizontally IWL::Iconbox - An iconbox widget (holds icons and has keyboard navigation) IWL::Iconbox::Icon - An icon widget for the iconbox IWL::Image - An image widget ("<img>") IWL::Input - A generic input widget ("<input>") IWL::InputButton - A generic button widget ("<input type="button">") IWL::Label - A label widget IWL::List - A widget for creating bulleted or numbered lists IWL::List::Definition - A definition list item IWL::Menu - A menu widget IWL::Menu::Item - A menu item widget for menus and menubars IWL::Menubar - A menubar widget IWL::NavBar - A navigation bar widget IWL::Notebook - A tab notebook widget IWL::Notebook::Tab - A tab widget for the notebook IWL::Page - A page widget, for creating new pages IWL::Page::Link - A link object for the page widget ("<link>") IWL::Page::Meta - A meta object for the page widget ("<meta>") IWL::PageControl - A page control widget for paginating other widgets IWL::RadioButton - A radiobutton widget (radiobutton + text) IWL::RPC - A helper class for ajax connections and cgi parameters IWL::Script - A script object ("<script>") IWL::Slider - A slider widget IWL::Spinner- A spinner widget IWL::Stash - A stash class for form information encapsulation IWL::Stock - A stock object, for buttons and images IWL::Style - A style object ("<style>") IWL::SubmitImage - An input image widget ("<input type="image">") IWL::Table - A table widget ("<table>") IWL::Table::Cell - A cell widget for the table row ("<td>", "<th>") IWL::Table::Row - A row widget for the table ("<tr">) IWL::Text - A simple text container IWL::Textarea - A textarea widget ("<textarea>") IWL::Tooltip - A tooltip widget IWL::Tree - A tree widget (has keyboard navigation) IWL::Tree::Cell - A tree cell widget IWL::Tree::Row - A tree row widget IWL::Upload - A theme-able upload widget
Configuration is done by editing the iwl.conf file. It can be placed in the directory of the scripts that use IWL, or it's full path and name can be fiven in the IWL_CONFIG_FILE environment variable. A default configuration is provided inside IWL::Config(3pm). See IWL::Config(3pm) for more details
In order to actually use the library, the javascript and css files will also have to be installed in the server's document root. To do that, the iwl-install script is provided. It is usually located in '/usr/bin'. The script also creates a iwl.conf file from the user input.
Scalar::Util Locale::Messages Locale::TextDomain HTML::Parser Cwd
- Add more stock items to IWL::Stock - Add an EmbedObject (<object>) and IFrame (<iframe>) widgets
- Create prettier icons (use tango gif icons?)
- In Internet explorer, floats will escape a container with scrollbars, if the positioning on the container is static, or the floats have a relative positioning
Viktor Kojouharov
Copyright (c) 2006-2007 Viktor Kojouharov. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perldoc perlartistic.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
To install IWL, copy and paste the appropriate command in to your terminal.
cpanm
cpanm IWL
CPAN shell
perl -MCPAN -e shell install IWL
For more information on module installation, please visit the detailed CPAN module installation guide.