source: trunk/npemap.org.uk/scripts/content/update_stats.pl @ 230

Last change on this file since 230 was 230, checked in by Dominic Hargreaves, 14 years ago

Better stats stuff

  • Property svn:executable set to *
File size: 783 bytes
RevLine 
[178]1#!/usr/bin/perl
2#
3# Copyright (c) 2006 Dominic Hargreaves
4# See accompanying file "LICENCE" for licence details
5
6use strict;
7use warnings;
8
[220]9use FindBin;
10use DBI;
[219]11
[220]12# Find our private perl libraries
13use lib "$FindBin::Bin/../../perllib";
[219]14use NPEMap::Postcodes;
[230]15use NPEMap;
[220]16
[178]17sub print_err;
18sub setup_dbh;
19
20my $dbh;
21
22    # In case the database went away, make sure we have a connection
[230]23    unless ($dbh = setup_dbh()) {
[178]24        print_internal_err('Error setting up database connection');
25    }
26
[219]27build_home_stats($dbh);
[178]28
29$dbh->disconnect;
30
31# Helper routines
32sub print_err {
33    my $err = shift;
34    print header("text/plain", "400 $err");
35    print "Error: $err\n";
36}
37
38sub print_internal_err {
39    my $err = shift;
40    print header("text/plain", "500 $err");
41    print "Error: $err\n";
42}
Note: See TracBrowser for help on using the repository browser.