#!/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.82 2008-03-21 14:31:39 matthew Exp $ # package Page; use strict; use Carp; use mySociety::CGIFast qw(-no_xhtml); use Error qw(:try); use File::Slurp; use LWP::Simple; use Digest::MD5 qw(md5_hex); use POSIX qw(strftime); use URI::Escape; use mySociety::Config; use mySociety::DBHandle qw/dbh select_all/; use mySociety::EvEl; use mySociety::MaPit; use mySociety::PostcodeUtil; use mySociety::Tracking; 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 mySociety::CGIFast()) { microsite($q); &$func($q); dbh()->rollback() if $mySociety::DBHandle::conf_ok; $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(