On Thu, 2 Dec 2004, Ray Chuan wrote: > >- can you use, for example, DBI, in a simple mod_perl > >handler? > > no, even a bare script which invokes connect than > disconnect fails, as with the first post: > === > #!F:/Net/Perl/bin/Perl.exe > ## > ## Perl eg > use strict; > use DBI; > > my $dbh = DBI->connect("DBI:mysql:webdb;localhost", "foo", "p", > {PrintError=>0,RaiseError=>1}); > $dbh->disconnect(); > ===
Sorry I wasn't clear - I meant to try this in a handler other then ModPerl::Registry, something like: ===================================================== # file Apache/Hello.pm package Apache::Hello; use strict; use Apache::RequestRec (); # for $r->content_type use Apache::RequestIO (); # for $r->print use Apache::Const -compile => ':common'; use DBI; sub handler { my $r = shift; my $dbh = DBI->connect("DBI:mysql:webdb;localhost", "foo", "p", {PrintError=>0,RaiseError=>1}); $dbh->disconnect(); my $time = scalar localtime(); my $package = __PACKAGE__; $r->content_type('text/html'); $r->print(<<"END"); <HTML><BODY> <H3>Hello</H3> Hello from <B>$package</B>! The time is $time. </BODY></HTML> END return Apache::OK; } 1; =========================================================== saved in F:\Net\Perl\site\lib\Apache2\Apache\Hello.pm, and then invoked in your httpd.conf as =========================================================== PerlModule Apache::Hello <Location /hello> SetHandler perl-script PerlResponseHandler Apache::Hello </Location> ========================================================== and accessed as http://localhost/hello. One other thing - is your Apache installation also on the F drive? If not, and if possible, can you try an Apache on F to see if that works (or try moving Perl to the drive Apache is on)? -- best regards, randy -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html