#!/usr/bin/perl use warnings; use strict; use Fatal qw(:void open close); use AnyData; use CGI qw(:standard -no_xhtml *div *table); #use CGI::Pretty; # rgb.html is a table gotten from http://www.pitt.edu/~nisg/cis/web/cgi/rgb.html # but it's all one huge long page.. this simplifies it a bit, # and removes the need for all the  's use HTML::TableExtract; # current bog in AnyData requires knowing this in advance, otherwise the require ignores TREE constant sub my $table = adTie('HTMLtable', 'rgb.html'); my $src=<<"END"; html > body { font-size: 76%; margin: 0; } .Floater { float: left; } table { border-collapse: collapse; font-size: 1em; margin: 0 2em; border: thin dotted black; padding-bottom: 2em; } table td { border-left: thin dotted black; padding: 3px; border-spacing: 2px 2px; white-space:nowrap; } table th { border-bottom: thin solid black; } caption { font-size: 2em; font-weight: bolder; } p { clear: both; margin: 2em auto; width: 34em; font-weight: bolder; font-size: 0.85em; text-align: center; } END my @tablestart = (start_table({-class=>"Floater"},), caption("500 colors of HTML")); my( $first, $header ) = 0; print start_html( -title=>"RGB/HTML COLOR PICKER", -Style=>{ -code=>$src }, ), start_div({-id=>"MainContent"}), @tablestart; my %known; while (my $row = each %$table){ if ($first > 1 && !($first % 168)) { print end_table(), @tablestart, $header; } unless ($first) { $header = Tr( th( [ split / /, q(# RGB Hex Name Appearance) ])); print $header; } ++$first; use warnings FATAL => 'uninitialized'; # die if any of our values aren't really there. my $hex = $row->{Hexadecimal}; if (!exists $known{ $hex } ) { $known{ $hex } = $first; } else { #warn ("$hex exists already in row $known{$hex} " ); --$first; next; } #DEBUG print comment($first); chomp $row->{Name}; $row->{Name} =~ s/\s{2,}//g; $row->{rgb} =~ s/\s+$//g; #DEBUG print "$row->{rgb}, $row->{Hexadecimal}, $row->{Name}\n"; print Tr( td($first), td($row->{rgb}), td("#$row->{Hexadecimal}"), td($row->{Name}), td({-style=>"background-color: #$row->{Hexadecimal};"}, ), ); } print end_table(), end_div(), div({-id=>"Footer"}, p( a({-href=>"colors.pl.txt"}, "Generated"), " by ", a({-href=>"http://search.cpan.org/~jzucker/AnyData-0.10/"}, "AnyData"), ",", a({-href=>"http://search.cpan.org/~msisk/HTML-TableExtract-1.08/"},"HTML::TableExtract"), ", and ", a({-href=>"http://search.cpan.org/~lds/CGI.pm-3.05/"},"CGI.pm"), ", using ", a({-href=>"http://www.pitt.edu/~nisg/cis/web/cgi/rgb.html"}, "rgb.html"), " as our original source of info, realigned and split programmatically to provide a three column layout if your monitor is wide enough (1280x1024), and in addition considerably compressing the resultant html so it downloads somewhat faster."),), end_html();