HTML Generation Code
-
#!/usr/bin/perl
-
use strict; use warnings; use XML::Twig; use Regexp::Common 'URI';
-
my $PLANT_FILE="plant.xml";
-
my $twig= XML::Twig->new( twig_handlers => { # here handlers are declared as anonymous subs, $_ is the element common => sub { $_->set_tag( 'h1') }, # $_ is the element botanical => sub { $_->set_tag_class( 'p') }, # set tag to 'p' and zone => sub { $_->set_tag_class( 'p'); # class to the tag $_->prefix( "Grows in zone "); }, light => sub { $_->set_tag_class( 'p'); }, price => sub { $_->set_tag_class( 'p'); }, available => sub { $_->set_tag_class( 'span'); $_->prefix( ", available "); $_->move( last_child => $_->prev_sibling); },
-