All,
I'm having some problems with Apache giving me grief, or most probably me
getting my knickers in a complete twist.
I get the following error:-
Can't call method "is_initial_req" without a package or object reference at
.........
It seems to happen when my URL ends like this:-
/somepath/16
but not when it ends like this:-
/somepath/16/
Below is the code which is where the error occurs.
sub handler {
my $r = My::Apache::Request->instance(shift);
print STDERR Dumper($r);
print STDERR "\n\n\nBOOOBS\n\n\n\n\n";
die "$r not defined" unless $r;
return OK unless $r->is_initial_req(); #ERROR OCCURS HERE
my $uri = $r->uri;
my $log = $r->log;
......
}
The handler is simply a multiplexer which based upon a database
configuration adds the relevant method handler to the handlers queue.
The 'instance' routine for My::Apache::Request is inheritted from the
Apache::Request class.
the 'new' routine for My::Apache::Request is as follows:-
sub new
{
my ($class, $r) = @_;
my $length=32;
unless ($r->is_main )
{
print STDERR "Apache::Request is not Main, Getting Main\n";
print STDERR Dumper($r);
$r=$r->main;
print STDERR "Main Apache::Request is:-\n";
print STDERR Dumper($r);
print STDERR "DECLINING!!!!!!!!!!!!\n";
return DECLINED;
}
unless ($r)
{
print STDERR "making a new Request object\n";
$r = Apache->request;
}
$r=Apache::Request->new($r);
my $self = bless {_r => $r}, $class;
my $t=substr(Digest::MD5::md5_hex(Digest::MD5::md5_hex(time(). {}. rand().
$$)), 0, $length);
$self->{XX_created_time_XX}=$t;
my @params=$self->param();
print STDERR "Here's the Parameters for $class\n";
print STDERR Dumper(@params);
my $lang_id=$self->param('lang_id');
if ($lang_id)
{
$lh=My::Maketext->get_handle($class,$lang_id);
}
else
{
$lh=My::Maketext->get_handle($class,My::Conf::DEFAULT_LANGUAGE_ID);
}
print STDERR "Creating ".ref($self)." $t\n";
#$self->interpret_uri;
return $self;
}