|Think about Loose Coupling|
Re: object-oriented composition of model-view with HTML::Seamstressby Rhandom (Curate)
|on Feb 25, 2008 at 18:00 UTC||Need Help??|
Thanks for the softball.
Here is your job. I will give you an array of text strings. Without manipulating the data in the perl layer, please provide one template that shows them in a bullet list and another template that shows them in a table with three columns with data oriented in columns with one item per cell. On the column oriented version fill in wherever there isn't a defined value. Be sure external whitespace is nice and consistent.
For extra credit - make the template decide conditionally that if you have less than n items use the bullet list - otherwise use the table.
For extra extra credit - do this exercise - but do it in a text-only based email that will be sent to a user (ie - no html tags).
Update To me the code layer would be your perl modules and your cgi script (or your mod_perl application). The example given is simplified and contrived - but represents real life situations.
Update 2 s/specifying/manipulating the data/
my @a=qw(random brilliant braindead); print $a[rand(@a)];