[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-modperl
Subject:    Help needed with OO and mod_perl!
From:       Bryan Coon <bcoon () sequenom ! com>
Date:       2001-07-31 18:38:07
[Download RAW message or body]

Hi, I am trying to convert some of my scripts into a more oo friendly style,
and use them under mod_perl.  For the very simple scripts below, when I run
them through the browser I get the following errors:

From my apache logs:
[Tue Jul 31 11:25:18 2001] null: Attempt to free unreferenced scalar at
/usr/lib/perl5/site_perl/5.6.1/i686-linux/Apache/Registry.pm line 144.

From my browser window:
Software error:
Can't call method "unescape" on an undefined value at
/usr/lib/perl5/5.6.1/CGI.pm line 112.
(I removed the CGI::Carp from the script below).

This only occurs if I run this under mod_perl.  In normal CGI it works fine.
There must be something funky going on that I dont understand... can someone
please help?

Thanks,
Bryan

test.cgi
--------
#!/usr/bin/perl -w

use TestMOD;
use CGI qw(:standard);

my $cmod = new TestMOD;
my $q    = new CGI;

print $q->header();

my ($log, $lev) = $cmod->AOut();
print "Log: $log", " ", "Level: $lev";


TestMOD.pm
----------
package TestMOD;

use 5.006;
use strict;
use warnings;

use CGI qw(:standard);
use CGI::Cookie;

our $VERSION = '0.01';

sub new {
  my $proto=shift;
  my $class=ref($proto) || $proto;
  my $self = {string=>shift || ""};  # create a reference

  return bless $self, $class;        # make it part of this class
}

sub AOut {
  my $self = shift;
  return ("bryan", "testpass");
}

1;

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic