- 论坛徽章:
- 0
|
client(tcl实现)使用xmlrpc和server(perl实现)通信时收到如下错误,请哪位帮忙看一下什么意思?我只负责client的实现,不懂perl。谢过了
Can't use string ("abc@abc.com") as a HASH ref while "strict refs" in use
at Bugzilla/WebService/User.pm line 45.
client代码:- package require XMLRPC
- XMLRPC::create "User.login" -proxy http://bugzilla/bugzilla/tr_xmlrpc.cgi \
- -params {login string password string remember boolean}
- set result [User.login abc@abc.com 123456 0]
- puts $result
复制代码 User.pm代码:- # -*- Mode: perl; indent-tabs-mode: nil -*-
- #
- # The contents of this file are subject to the Mozilla Public
- # License Version 1.1 (the "License"); you may not use this file
- # except in compliance with the License. You may obtain a copy of
- # the License at http://www.mozilla.org/MPL/
- #
- # Software distributed under the License is distributed on an "AS
- # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- # implied. See the License for the specific language governing
- # rights and limitations under the License.
- #
- # The Original Code is the Bugzilla Bug Tracking System.
- #
- # Contributor(s): Marc Schumann <wurblzap@gmail.com>
- # Max Kanat-Alexander <mkanat@bugzilla.org>
- # Mads Bondo Dydensborg <mbd@dbc.dk>
- # Noura Elhawary <nelhawar@redhat.com>
- package Bugzilla::WebService::User;
- use strict;
- use base qw(Bugzilla::WebService);
- use Bugzilla;
- use Bugzilla::Constants;
- use Bugzilla::Error;
- use Bugzilla::User;
- use Bugzilla::Util qw(trim);
- use Bugzilla::Token;
- use Bugzilla::WebService::Util qw(filter validate);
- # Don't need auth to login
- use constant LOGIN_EXEMPT => {
- login => 1,
- offer_account_by_email => 1,
- };
- ##############
- # User Login #
- ##############
- sub login {
- my ($self, $params) = @_;
- my $remember = $params->{remember};
- # Username and password params are required
- foreach my $param ("login", "password") {
- defined $params->{$param}
- || ThrowCodeError('param_required', { param => $param });
- }
- # Convert $remember from a boolean 0/1 value to a CGI-compatible one.
- if (defined($remember)) {
- $remember = $remember? 'on': '';
- }
- else {
- # Use Bugzilla's default if $remember is not supplied.
- $remember =
- Bugzilla->params->{'rememberlogin'} eq 'defaulton'? 'on': '';
- }
- # Make sure the CGI user info class works if necessary.
- my $cgi = Bugzilla->cgi;
- $cgi->param('Bugzilla_login', $params->{login});
- $cgi->param('Bugzilla_password', $params->{password});
- $cgi->param('Bugzilla_remember', $remember);
- Bugzilla->login;
- return { id => $self->type('int', Bugzilla->user->id) };
- }
- sub logout {
- my $self = shift;
- Bugzilla->logout;
- return undef;
- }
复制代码 |
|