Check these modules:
package simian;
use fields qw (name);
use strict; #very important!
use Apache;
use Apache::Request;
use Apache::Constants qw(:common);
sub new {
my $type = shift;
my class1 $self = fields::new(ref $type || $type);
$self->{name} = 'Jane';
return $self->{name}; # error here
}
sub name {
my $self = shift;
$self->{name} = shift if @_;
return $self->{name};
}
sub handler ($$) {
my ($self, $q);
my $r = Apache::Request->new($q);
# send headers here
print $self->name;
return OK;
}
package macaque;
use base "simian";
sub new {
my macaque $self = fields::new("macaque");
return $self;
}
return 1;
then put this line in your startup.pl or a <Perl> section:
my $tree_climber = macaque->new;
Then set up the mod perl server to use this class for a handler,
and try to access it on the web browser:
You will get an error like the following:
Can't use string ("Exchange::MyAccount3") as a HASH ref while "strict
refs" in use at /usr/local/lib/perl5/site_perl/MyApp/Framework3.pm line
245.
What the heck am I doing wrong?
--Christopher