All pastes #207567 Raw Edit

where is it looking?

public text v1 · immutable
#207567 ·published 2006-10-18 02:21 UTC
rendered paste body
#!/usr/bin/perl -w
use lib '/home/neat/www';

use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
use DBI;
use HTMLT::Interpreter;
$CGI::POST_MAX=1024 * 100;  # max 100K posts
$CGI::DISABLE_UPLOADS = 1;  # no uploads

# Initialize Template Variables
my $template_path = "./";
my $namespace = {};

my $dbc = DBI->connect("DBI:mysql:<Database>:localhost",
                "<DB User>",
                "<DB PASSWD>");

$namespace = {
    TEMPLATE => "front.htmlt",
    PIC1      => ($dbc->selectrow_array("SELECT pic FROM WN WHERE id = 3"))[0] || 0,
    PIC1DESC  => ($dbc->selectrow_array("SELECT txt FROM WN WHERE id = 3"))[0] || '',
    PIC2      => ($dbc->selectrow_array("SELECT pic FROM WN WHERE id = 4"))[0] || 0,
    PIC2DESC  => ($dbc->selectrow_array("SELECT txt FROM WN WHERE id = 4"))[0] || '',
    TEXT      => ($dbc->selectrow_array("SELECT txt FROM WN WHERE id = 5"))[0] || '',
    NAV       => generate_nav_namespace($dbc),
};

$dbc->disconnect;

my $interpreter = HTMLT::Interpreter->new($template_path);
print header;
print $interpreter->make_page($namespace);

exit;

sub generate_nav_namespace {
    my $dbc = shift;
    my $nav_sth = $dbc->prepare("SELECT CatID, Description FROM Category WHERE Parent IS NULL ORDER BY Description");
    my $navigation = {};

    $nav_sth->execute;
    my $j = 0;
    while (my ($catid, $description) = $nav_sth->fetchrow_array) {
        $navigation->{$j}{CATID} = $catid;
        $navigation->{$j}{DESCRIPTION} = $description;
        $j++;
    }
    $nav_sth->finish;
    
    return $navigation;
}