geektron has asked for the wisdom of the Perl Monks concerning the following question:
i have the following code that gives me this error:
and here's the handler that accompanies it:[Fri Jul 25 00:58:42 2003] [error] Can't locate object method "server" + via package "My::Greeting" at /webcontent/server_home/test/My/Greeti +ng.pm line 24.
i understand the error, and know i could fix it by using @ISA ... even if that's not the *right* way to fix it. what's the best way of going about this?package My::Greeting; use strict; use vars qw( $DBH ); use Apache::Constants qw(OK); use Data::Dumper; sub new($$) { my ( $class , %args ) = @_; ## stash a DBH in the object ... $DBH = $args{DBH} || DBI->connect( "dbi:mysql:rentsavers", "root", + "", ) ; my $self = bless { _DBH => $DBH }, $class; return $self; } sub handler($$) { my ( $r, $class ) = @_; my $now = scalar localtime; my $server_name = $r->server->server_hostname; $r->send_http_header('text/plain'); print <<EOT; Thanks for visiting $server_name. The local time is $now. EOT print Dumper( $class ); return OK; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: mod_perl and objects
by lestrrat (Deacon) on Jul 25, 2003 at 07:04 UTC | |
by geektron (Curate) on Jul 25, 2003 at 08:33 UTC | |
|
Re: mod_perl and objects
by blokhead (Monsignor) on Jul 25, 2003 at 07:02 UTC | |
by grantm (Parson) on Jul 25, 2003 at 09:14 UTC | |
by geektron (Curate) on Jul 25, 2003 at 09:30 UTC | |
by grantm (Parson) on Jul 28, 2003 at 10:11 UTC | |
by geektron (Curate) on Jul 28, 2003 at 18:06 UTC | |
| |
by geektron (Curate) on Jul 25, 2003 at 08:38 UTC | |
|
Re: mod_perl and objects
by ViceRaid (Chaplain) on Jul 25, 2003 at 12:41 UTC | |
by geektron (Curate) on Jul 25, 2003 at 17:53 UTC | |
|
Re: mod_perl and objects
by geektron (Curate) on Jul 25, 2003 at 06:15 UTC |