<%init> use AwayMsg; db_connect(); www_begin($r,$m); <%args> $create => undef <%perl> my $textid; if (defined $create) { } else { foreach my $k (keys %ARGS) { if ($k =~ m/^t(\d{0,7})$/) { $textid= $1; last; } } die unless defined $textid; } my $tx; if ($ARGS{'create'}) { my $date = `date --iso-8601=minutes`; chomp $date or die; $tx = { desc => "Message created $date", subject => "Away from my email", textid => "new", text => "" }; } else { my $sth = $dbh->prepare("SELECT * FROM texts WHERE textid=?"); $sth->execute($textid); $tx = $sth->fetchrow_hashref();# } if (!$tx) { die "no such text $textid"; } <& htmlhead, subpage => "Edit \"$tx->{'desc'}\"" &>
<&| txtable, tx => $tx, inputs => 1 &>