OK -- so i have mod_perl set up, created a startup.pl that looks something like this:
#!/usr/local/bin/perl use strict; use lib qw( /webcontent/server_home/rentsavers/test ); $ENV{MOD_PERL} or die "not running mod_perl!: $! \n"; use Apache::Registry; use Apache::DBI (); use DBI (); # Initialize the database connections for each child Apache::DBI->connect_on_init ("DBI:mysql:database=test;host=localhost", "testuser", { PrintError => 1, # warn() on errors RaiseError => 0, # don't die on error AutoCommit => 1, # commit executes immediately } ); 1;
from reading the perldoc, the online guide, and Writing Apache Modules w/ Perl and C ... i can use DBI normally in a handler, and the caching, etc is transparent. but i'm not seeing anything DBI-related with this handler:
package My::Greeting; use strict; use Apache::Constants qw(OK); use Data::Dumper; use DBI; sub handler { my $r = shift; my $now = scalar localtime; my $server_name = $r->server->server_hostname; $r->send_http_header('text/plain'); print <<EOT; Thanks for visiting $server_name. The local time is $now. EOT my $DBH || DBI->connect( "dbi:mysql:localhost", "rentsaver", "ro +ot" ) ; Dumper( $DBH ); return OK; } 1;
am i missing something really obvious? or is there a bigger problem?

In reply to accessing Apache::DBI 'cached connections' by geektron

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.