#!/usr/bin/perl -w -I/home/chris/projects/planning/lib # # orightml: # Display the original HTML from which the planning information was extracted. # # Copyright (c) 2003 Chris Lightfoot. All rights reserved. # Email: chris@ex-parrot.com; WWW: http://www.ex-parrot.com/~chris/ # my $rcsid = ''; $rcsid .= '$Id: orightml,v 1.3 2003/11/08 19:37:10 chris Exp $'; use strict; use Error qw(:try); use CGI qw(-no_xhtml); use CGI::Fast; use DBI; use HTML::Entities; use Planning; try { my $dbh = Planning::database(); while (my $q = new CGI::Fast()) { if (my $num = $q->param('appnumber')) { my $A = Planning::Application->new_by_id($dbh, $num); print $q->header(-type => 'text/html', -charset => 'iso-8859-1', -expires => '+1d'), $q->start_html(-title => "Original text of application " . encode_entities($num), -style => { -src => '../std.css' }), $q->p("This is the original HTML for application", encode_entities($num), "from which information about the application was extracted:"), $q->div($A->orightml()), $q->hr(), $q->pre(encode_entities($A->orightml())), Planning::copyright_blurb($q), $q->end_html(); } else { throw Error::Simple("No application specified"); } $dbh->rollback(); # XXX work around SQLite brokenness } $dbh->disconnect(); } catch Error::Simple with { my $E = shift; my $msg = sprintf('%s:%d: %s', $E->file(), $E->line(), $E->text()); warn "caught fatal exception: $msg"; warn "aborting"; encode_entities($msg); print "Status: 500\nContent-Type: text/html; charset=iso-8859-1\n\n", CGI::start_html(-title => "Cambridge Planning: error", -style => { -src => '../std.css' }), CGI::h1("Error"), q(
Unfortunately, something went wrong. The text of the error was:
), qq($msg), q(
Please try again later.), CGI::end_html(); };