On Nov 11, Rob Richardson said:

>$self->{'users'}->{$loginName} = $user;  #<== This is line 47
>
>"Can't use string ("interrobang") as a HASH ref while "strict refs" in
>use at UserList.pm line 47, <USERLIST> line 1."

>"Interrobang" is the login name of the only user in the data file I am
>testing this script against.

Right, and as I'm about to show, it's the first argument to your AddUser()
function.

>sub Load
>{
>       my $self = shift;
>       my $fileName = shift;
>       my $user;

You don't use $user.  Skipping ahead to the trouble-spot:

>       while (<USERLIST>)
>       {
>               chomp;
>               AddUser (split /,/);

That should be $self->AddUser(split /,/)...

>       }
>}

... because if it isn't:

>sub AddUser
>{
>       my $self = shift;

Then $self will be the first value from (split /,/), which is the login
name.

>       my $user = new User;
>       ($user->{'loginName'},
>        $user->{'title'},
>        $user->{'firstName'},
>        $user->{'lastName'},
>        $user->{'phone'},
>        $user->{'email'}) = @_;
>       my $loginName = $user->{'loginName'};
>       $self->{'users'}->{$loginName} = $user;  <== This is line 47

And since $self is a string, and strict is on, $self->{...} is an error.

>}

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to