You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Patton, Billy N" <bi...@h3net.com> on 2014/10/22 22:10:48 UTC
[users@httpd] OO perl in CGI
I’ve just recently upgraded my mac to the new Yosemite.
My app was working before this upgrade. I had no Idea that it would destroy so much, but I’ve got most of it back.
It’s the inheritance between perl modules that is killing me.
I know my machine candles inheritance(see example below).
Yesterday I was running Apache 2.2, today I’m running 2.4.9
I have a hierarchy like this
index.html
cp.cgi
cp.cgi
use CP;
$cp = CP->new();
CP.pm
use base “Base”;
sub new { # tried this out of desperation
my $self = shift;
$self->SUPER::new();
}
1;
__END__
Base.pm
use base ‘CGI::Application’;
sub new {
my $self = shift;
$self->SUPER::new();
}
1;
__END__
I’m getting the error message
Can't locate object method "new" via package "CP" at /Users/bpatto/tool_box/cportal/App/CP.pm line 21.
Just to make sure it is working on my mac I created the following and it works perfectly
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
package Dad { sub new { my $pkg = shift @_; my $self = {}; bless $self , $pkg; }}
package Mom { use base "Dad”; }
package Baby { use base "Mom”; }
my $stuff = new Baby;
print Dumper $stuff;