Ok here is what I am using so far: (very raw)
#!/opt/local/bin/perl # # Script to keep track of peoples' access to their data sources # # # sub showparams{ foreach $a (param()){ $b=param($a); print "param $a has value :$b: <br>"; } } BEGIN { use CGI qw/:standard *table/; use Text::CSV::Simple; $datafile='/dma/lib/www/fst/datachecklist/dataaccess.txt'; my $parser = Text::CSV::Simple->new; my @data = $parser->read_file($datafile); print header(); if (!param('editbutton')){ @now=localtime; #month returned by localtime() are zero-indexed. #got to pad the zeroes for the time/date elements $timestamp=sprintf("%02d-%02d-%04d",$now[4]+1,$now[3],$now[5]+19 +00); @params=param(); unless (param('Cancel')){ foreach $d (@params){ if ($d =~ /-/){ @param1=split(/-/,$d); if ($d =~ /Add/){ unless (param('New service') eq ""){push(@data,[$param1[0],par +am('New service')]);} sub servicesort { $a->[0] cmp $b->[0] } @data=sort servicesort @data; }else{ foreach $c (@data){ if ($c->[0] eq $param1[0]){ if ($c->[1] eq $param1[1]){ $c->[2]=$timestamp; $c->[3]=$param1[2]; } } } } } } } open(FH,">$datafile") || die "Couldn't open datafile: $!"; foreach $g (@data){ print FH join(',', @$g), "\n"; } close(FH); print start_html( -title => "Data Access", -bgcolor => 'purple' +); print start_form(); showparams(); print h6({-align=>'right'},"Today is $timestamp"); my $lastuser; $lastuser=""; foreach $i (@data){ if ($i->[0] ne $lastuser){ print end_table(); print br(),table({-width=>'33%'},Tr(th({-align=>'left'},[$i->[0] +,submit('editbutton',"edit $i->[0]")]))), br(); print start_table({-width=>'33%',-cellpadding=>2,-cellspacing=>0 +,-border=>2,-frame=>'box'}); print Tr(th(['Data Source','Date Last Checked','Check Result'])) +; } print Tr(td($i->[1]),td($i->[2]),td($i->[3])); $lastuser=$i->[0]; } print end_table(); print "\n"; } else{ $user=substr(param('editbutton'),6); print start_html( -title =>"Edit $user", -bgcolor => 'purple' ); print start_form(); showparams(); print h2($user); print start_table({-cellpadding=>2,-cellspacing=>0,-border=>2,-f +rame=>'box'}); print Tr(th(['Data Source','Date Last Checked','Last Check Resul +t','Report Success','Report Failure'])); foreach $i (@data){ if (@$i[0] eq $user){ print Tr(td($i->[1]),td($i->[2]),td($i->[3]),td(submit("$user-$i +->[1]-Pass","Report Success")),td(submit("$user-$i->[1]-Fail","Report + Failure"))); } } print end_table(); print textfield(-name=>'New service'),submit("$user-Addbutton",' +Add new service'),br(); print submit('cancel','Cancel'); } print end_form(); print end_html(); }
I am grappling with how to manipulate the data once it's updated and write it back to the file right now. I could probably cook up a simple routine to write out the CSV data, but I am also going to have to look up how to insert a record into an array at a certain point.

Any and all comments appreciated. T.

_________________________________________________________________________________
Without me, it's just aweso

In reply to Re: A web-based checklist in the manner of the checklists in the bathrooms of fast-food restaurants by OfficeLinebacker
in thread A web-based checklist in the manner of the checklists in the bathrooms of fast-food restaurants by OfficeLinebacker

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.