httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Moss" <>
Subject [users@httpd] Method Handler Gives class string, not class Ref
Date Wed, 02 Apr 2003 17:39:43 GMT

I'm trying to work out the exact process for method handlers. I have a
method handler, which has a 'new' subroutine and the following handler

#sub handler : method        #Either of these is fine??????
sub handler ($$)

  my ($self,$r)=@_;

  #unless (ref($self))
    #print STDERR "Making NEW Object!!!!!!!!!\n";

  my $uh=$r->user_object();
  $self->{user}=$uh;    #Get Error Here!!!! (Can't use string
("Bficient::Admin::Apache::Home") as a HASH ref while "strict refs" in use


The problem I have is that $self is a 'classname string' not a class object.
Is this right? I thought that $self should be an object reference.
I'd seen an example in the mod_perl cookbook which treats $self as an
object. So I thought the above code should work, but it doesn't it gives me
an error of

"Can't use string ("Bficient::Admin::Apache::Home") as a HASH ref while
"strict refs" in use at etc..."

I am pre-loading Bficient::Admin::Apache::Home in my, as I must
dynamically load modules based upon configuration files.
my 'new' subroutine is:-

sub new
  # inherited by all classes
  my $proto = shift;
  my $args=shift;
  my $class = ref($proto) || $proto;
  my $self = {};

  #print STDERR "In Bficient::Apache::Object for
  bless $self, $class;




  return $self;

Can anybody tell me If I'm assuming something that isn't or have I done
something wrong.

Kind regards


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message