HTML::Chunks::Super - Chunks with superpowers
1.0
The mutant spawn of HTML::Chunks, this module has all of the abilities of its parent plus additional emerging superpowers. The first enhancement to be added is conditional processing. For full chunk documentation, please see HTML:::Chunks. Only HTML::Chunks::Super enhancements will be discussed here.
While conditional processing does indeed blur the lines between layout/markup and actual programming logic, it can be very powerful when used sparingly and appropriately. We urge you to use this ability only for simple display logic, keeping the chunk side of life mostly pure and uncomplicated. With great power comes great responsibility. :-)
That warning aside, here is the extended chunk syntax:
<!-- IF condition --> normal chunk stuff <!-- ELSIF condition --> more chunks <!-- ELSE --> chunky chunk of chunks <!-- ENDIF -->
The condition can by most any valid perl expression and will usually reference one or more chunk data elements. See the HTML::Chunks documentation for a full descripton of data elements, but as a refresher, they look like ##this## and refer to dynamic data that is merged into a chunk at run-time. For use in conditionals, you can treat them as read-only scalars.
condition
##this##
True if data element ##foo## has a true value (in the perl sense of "true")
##foo##
True if ##foo## begins with "bar"
True if ##foo## contains no non-word characters
True if ##num## is between 1 and 10 inclusive
##num##
You get the idea. Most comparisons and conditions that are possible in straight perl will be possible here as well.
Created, developed and maintained by Mark W Blythe and Dave Balmer, Jr. Contact dbalmer@cpan.org or mblythe@cpan.org for comments or questions.
(C)2001-2009 Mark W Blythe and Dave Balmer Jr, all rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install HTML::Chunks, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTML::Chunks
CPAN shell
perl -MCPAN -e shell install HTML::Chunks
For more information on module installation, please visit the detailed CPAN module installation guide.