BEGIN { use CGI ':all'; use XML::Simple; use XML::LibXML; use Data::Dumper; use File::Copy; use Tie::IxHash; my $htmlfile = "whiteboard.html"; my $xmlfile = "whiteboard.xml"; tie %$xml, "Tie::IxHash", %{XMLin($xmlfile, SuppressEmpty => undef, )}; #no forcearray needed here because we know the elements don't double. if ( (!(param("Apply Edit"))) && (!(param("Cancel"))) ) #so if the page is a first load, or a change in selection, or the "Clear" button was pressed { print header(); print start_html( -title => "Edit Whiteboard", -bgcolor => 'purple' ) ; print font( { -color => 'yellow' } ), h1("Whiteboard Editor"); print h5("Type <br> to create a new line in the webpage display."); print start_form(); @keys = keys( %{ $xml->{name} } ); print popup_menu( -name => 'selname', -values => \@keys, -align => 'top', -onChange => "submit();" ); if ( param('selname') ) { if ( param("Clear") ) { param( 'thenote', "" ); } else { param( 'thenote', "" ); #we need this to clear the note if it's already blank, otherwise the #text from the defined note will persist param( 'thenote', $xml->{name}->{ param('selname') }->{note} ); } print textarea( -name => 'thenote', -rows => 10, -columns => 55 ); } else { param( 'thenote', $xml->{name}->{ $keys[0] }->{note} ); print textarea( -name => 'thenote', -rows => 10, -columns => 55 ); } print br(), br(), submit("Apply Edit"), "\t ", submit("Cancel"), "\t ", submit("Clear"); print end_form(); my $mtime = localtime( ( stat "edit.pl" )[9] ); print hr(), font( { -size => '-1' }, "Modified $mtime", br(), "Created and maintained by Terry Tate, Office Linebacker" ); print end_html(); } #end if !param else { #this is a repost