On Tuesday, Nov 11, 2003, at 10:23 US/Pacific, Rob Richardson wrote: [..]

The error message is: "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.


[..]
I assume that you mean that the following is
in a separate Package:

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

        open (USERLIST, $fileName) || die "cannot open database $fileName:
$!\n";     
        if ($^O ne "MSWin32")
        {       
                flock(USERLIST, 1);
        }

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

wouldn't it be nice if that was say


$self->AddUser(split /,/);

        }
}

sub AddUser
{
        my $self = shift;
        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
}

[..]

That way when we get INTO the AddUser() method and
shift off the $self, we know which Self we are talking
about, rather than shifting off the first element in
the line we read from <USERLIST>, eh no?


ciao drieux

---


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



Reply via email to