HTML::Chunks::Super - Chunks with superpowers
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 -->
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.
True if data element
##foo## has a true value (in the perl sense of "true")
##foo## begins with "bar"
##foo## contains no non-word characters
##num## is between 1 and 10 inclusive
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 firstname.lastname@example.org or email@example.com 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.