# just do it
use strict;
use Carp ();
use Sys::Hostname;

# When adding a new application, add its lib here!
use lib '/app/tools/common/lib';
use lib '/app/tools/appuser/lib';
use lib '/app/tools/data_classes/lib';
use lib '/app/tools/bookpub/lib';

# sanity check
$ENV{MOD_PERL} or die "not running under mod_perl!";

if ( _weWantWarnings() ) {
    $SIG{__WARN__} = \&Carp::cluck;
} else {
    $SIG{__WARN__} = sub { };
}

# Common things
# use Apache::DBI ();
# use DBI ();
# $Apache::DBI::DEBUG = 2;

# the one you all know and love...
use CGI ();
CGI->compile(':all');

sub _weWantWarnings {

    # We want to see lots of warning messages on the dev servers,
    # but we don't want to fill up the logs on the production servers.
    #
    # We might want to provide an environmental variable to enable this, so we can
    # switch it on in the production environment - Should be a distinct flag (i.e.
    # don't use DEBUG...)
    #
    # I'm treating 'staging' as a production machine in this case.
    #
    if ( hostname() =~ /^dev/ ) {
        return 1;
    }

    return;
}

1;
