#!/usr/bin/perl # # Page.pm: # Various HTML stuff for the BCI site. # # Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org; WWW: http://www.mysociety.org/ # # $Id: Page.pm,v 1.60 2007-08-23 11:45:44 matthew Exp $ # package Page; use strict; use Carp; use CGI::Fast qw(-no_xhtml); use Error qw(:try); use File::Slurp; use LWP::Simple; use POSIX qw(strftime); use mySociety::Config; use mySociety::DBHandle qw/select_all/; use mySociety::EvEl; use mySociety::WatchUpdate; use mySociety::Web qw(ent NewURL); BEGIN { mySociety::Config::set_file("$FindBin::Bin/../conf/general"); } sub do_fastcgi { my $func = shift; try { my $W = new mySociety::WatchUpdate(); while (my $q = new CGI::Fast()) { &$func($q); $W->exit_if_changed(); } } 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"; ent($msg); print "Status: 500\nContent-Type: text/html; charset=iso-8859-1\n\n", q(
Please try again later, or email us to let us know.
), q(The text of the error was:
), qq($msg), q(