Greetings!

My program was compiling and running.  It was giving me strange results
from my print() functions.  One of the list members was kind enough to
point out my mistake.  (I was putting "$user->LastName()" into a string
to be printed.)  I fixed it.  Now I my program doesn't compile, and
it's giving me an error message that makes no sense to me:

Can't use string ("UserList") as a HASH ref while "strict refs" in use
at UserList.pm line 66, <USERLIST> line 1.

Here is the function containing line 66:

sub GetUser
{
        my $self = shift;
        my $userName = shift;
        my $user = new User;

        trace ("Getting user for login name $userName\n");
        
        # The following line is line 66
        if (exists $self->{'users'}->{$userName})
        {
                $user = $self->{'users'}->{$userName};
        }
        else
        {
                $user = new User;
                $user->{'loginName'} = 'unknown';
        }
        return $user;
}

UserList.pm contains the "UserList" package, which contains the
UserList class and its methods.  UserList maintains a list of users in
a hash keyed by the user's login name.  

At line 66, the variable $userName contains "interrobang".  "UserList"
is not being used as a hash reference or as anything else at this
point, as far as I know.  What could be causign this error?

This is not the first time a compile error has shown up in a previously
running program.  I need to learn PHP.

  


        
                
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to