In MP1 it was possible to do..

Authorization Phase

sub handler {

  my $dbh;

  $dbh = DBI->connect(..)
      || return "Error connecting.\n $DBI::errstr\n";

  $r->pnotes(DBH => $dbh);


Response Phase

sub handler($$) {

  my $dbh = $r->pnotes('DBH');

However this doesn't work in MP2 because $dbh is a hash

==============================================================

So I have tried

Authorization Phase

sub handler {

  my $dbh;

  $dbh = DBI->connect(..)
      || return "Error connecting.\n $DBI::errstr\n";

  $r->pnotes(DBH => %$dbh);

which stops mod perl 2 crashing

---------------------------------------------------------------

Response Phase

sub handler($$){

  # restore hash to reference
  my %dbh_hash = $r->pnotes('DBH');
  my $dbh = {%dbh_hash};

  $dbh->do("..");

fails with error..

Can't call method "do" on unblessed reference

================================================================

Any suggestions greatly appreciated, thank you.

John.





Reply via email to