#!/usr/local/bin/perl # $Id: ApacheDBI.pl,v 1.1 2004-04-29 09:21:28 ivan Exp $ # don't forget to create in postgres the user who is running # the httpd, eg 'createuser nobody' ! # # demo script, tested with: # - PostgreSQL-7.1.1 # - apache_1.3.12 # - mod_perl-1.23 # - perl5.6.0 # - DBI-1.14 use CGI; use DBI; use strict; my $query = new CGI; print $query->header, $query->start_html(-title=>'A Simple Example'), $query->startform, "
Enter the data source: | ", "", $query->textfield(-name=>'data_source', -size=>40, -default=>'dbi:Pg:dbname=template1'), " | ", "
Enter the user name: | ", "", $query->textfield(-name=>'username'), " | ", "
Enter the password: | ", "", $query->textfield(-name=>'auth'), " | ", "
Enter the select command: | ", "", $query->textfield(-name=>'cmd', -size=>40), " | ", "
", "
", join(" | ", @$ary_ref), " |
\n"; $sth->finish; } else { print "