On Tue, 30 Jan 2001, Ken Williams wrote:

> [EMAIL PROTECTED] (Joe Schaefer) wrote:
> 
> >
> >"Christopher L. Everett" <[EMAIL PROTECTED]> writes:
> >
> >> sub handler ($$) {
> >>   my ($self, $q);
> >> 
> >>   my $r = Apache::Request->new($q);
> >> 
> >>   # send headers here
> >> 
> >>   print $self->name;
> >          ^^^^^^^^^^^^
> >$self is a string ("simian"), not an object ref; for this 
> >line to work, you need to make one by calling "new" somewhere,
> >or guard against misuse via:
> >
> >        print $self->name if ref $self;
> 
> 
> Technically there's nothing wrong with that, it'll call the name()
> method of the "simian" class.  It may not be what you want to do, but
> it's legal.
> 
> The error is that the name() method doesn't expect to be called as a
> class method, it's an object method.  So as Joe points out, you could
> add the following line:
> 
>    sub handler ($$) {
>      my ($self, $q);
> 
>  ->  $self = $self->new(); ??? 8-[   ] who is $self->new() ???

        $self = PackageName->new();

>      my $r = Apache::Request->new($q);
> 
>      # send headers here
> 
>      print $self->name;
>      return OK;
>    }
> 
> 
>   -------------------                            -------------------
>   Ken Williams                             Last Bastion of Euclidity
>   [EMAIL PROTECTED]                            The Math Forum
> 

Vasily Petrushin
+7 (095) 2508363
http://www.interfax.ru
mailto:[EMAIL PROTECTED]

Reply via email to