perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Russell <...@onlywebdata.com>
Subject pnotes MP1->MP2
Date Mon, 03 Apr 2006 18:20:50 GMT
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.






Mime
View raw message