#!/usr/bin/perl use strict; use warnings; use CGI; use HTML::Entities qw(encode_entities); use Tie::IxHash; print "content-type: text/html \n\n"; my @options = qw(text color background_color); tie my %font, qw(Tie::IxHash); tie my %text, qw(Tie::IxHash); %font = ( style => [qw(normal italic oblique)], variant => [qw(normal small-caps)], weight => [qw(normal bold 100 200 300 400 500 600 700 800 900)], size => [qw(xx-small x-small small medium large x-large xx-large)], family => [qw(serif sans-serif cursive fantasy monospace)], ); %text = ( align => [qw(left right center justify)], decoration => [qw(none underline overline line-through blink)], transform => [qw(none capitalize uppercase lowercase)], ); my $cgi = CGI->new(); my $text = encode_entities($cgi->param('text')) || "The quick brown fox jumps over the lazy dog."; my $color = encode_entities($cgi->param('color')) || "#000"; my $background_color = encode_entities($cgi->param('background_color')) || "transparent"; my $select_style = $cgi->param('select_style'); my $select_variant = $cgi->param('select_variant'); my $select_weight = $cgi->param('select_weight'); my $select_size = $cgi->param('select_size'); my $select_family = $cgi->param('select_family'); my $select_align = $cgi->param('select_align'); my $select_decoration = $cgi->param('select_decoration'); my $select_transform = $cgi->param('select_transform'); sub select_group { my ($value, $hash) = @_; my $display_value = ucfirst $value; print qq{
\n$display_value: \n}; for my $select (keys %$hash) { my $options = $$hash{$select}; print qq{\n}; } print qq{
\n}; } print <<"sec1"; Font, text, and color tests
sec1 for my $option (@options) { my $display_option = ucfirst $option; $display_option =~ tr/_/ /; print qq{
\n\n\n
}; } select_group('font', \%font); select_group('text', \%text); print <<"sec2";
Start over
sec2 #Begin the OH MY GOD THIS IS HUGE! loop for my $style ($select_style ? $select_style : @{$font{'style'}}) { for my $variant ($select_variant ? $select_variant: @{$font{'variant'}}) { for my $weight ($select_weight ? $select_weight : @{$font{'weight'}}) { for my $size ($select_size ? $select_size : @{$font{'size'}}) { for my $family ($select_family ? $select_family : @{$font{'family'}}) { for my $align ($select_align ? $select_align : @{$text{'align'}}) { for my $decoration ($select_decoration ? $select_decoration : @{$text{'decoration'}}) { for my $transform ($select_transform ? $select_transform : @{$text{'transform'}}) { print qq{ #Outdented for visibility and ease of editing
\n
font-
\n
style: $style; variant: $variant; weight: $weight; size: $size; family: $family;
\n
text-
\n
align: $align; decoration: $decoration; transform: $transform;
\n
color
\n
$color
\n
background-color
\n
$background_color
\n
\n }; print qq{ #Outdented for visibility and ease of editing

$text

\n }; } } } } } } } } #End the OH MY GOD THIS IS HUGE! loop print "";