IWL::Environment - An environment pseudo-object
IWL::Error -> IWL::Object -> IWL::Environment
The IWL::Environment provides a pseudo-object, used to manage snippets of IWL::Objects for a page. Its main purpose is managing shared resources, such as javascript files, whenever IWL::Page is not used. Unlike IWL::Page, IWL::Environment does not produce any code, only the code of its children.
use IWL; use IWL::Environment; my $env = IWL::Environment->new; # Building some IWL hierarchy my $container = IWL::Container->new; my $label = IWL::Label->new; my $button = IWL::Button->new; $label->setText('This button does not do anything'); $button->setLabel('Click me!'); $container->appendChild($label, $button); $env->appendChild($container); ... # Print out the env content, # as was as any shared resource (in this case, 'button.js') # The environment child stack is cleared $html .= $env->getContent; ... my $button2 = IWL::Button->newFromStock('IWL_STOCK_NEW'); $env->appendChild($button2); ... # Print out only $button2, since the previous content was # already obtained. The shared resource, 'button.js', # is not printed again. $html .= $env->getContent; ... # Adding scripts as shared resources $env->requiredJs('/foo/bar.js'); $html .= $env->getContent;
IWL::Environment->new ([%ARGS])
Where %ARGS is an optional hash parameter with with key-values.
Returns the markup for the environment's children, and removes them from its stack.
Returns the environment's children as a new object, with a structure needed for JSON
Copyright (c) 2006-2008 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.
1 POD Error
The following errors were encountered while parsing the POD:
You forgot a '=back' before '=head1'
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.