我是 Perl 的新手,真的很难理解如何做到这一点。我正在尝试使用 Perl 模块 RT::Client::REST 创建票证,这是我到目前为止的代码。
#!/usr/bin/env perl
use strict;
use warnings;
use RT::Client::REST;
use Rt::Client::REST::Ticket;
my $rt = RT::Client::REST->new(
server => ($ENV{RTSERVER} || 'http://rt.myrturl.com'),
);
$rt->login(
username => 'user',
password => 'pass',
);
my $ticket = RT::Client::REST::Ticket->new(
rt => $rt,
queue => "General - unassigned",
subject => "Perl Create Ticket Test",
);
$ticket->store("I'm a ticket");
这段代码没有出票,我不知道如何从 Perl 获得任何良好的调试输出。根据RT::Client::REST::Ticket的 RT::Client::REST 文档, $ticket->store() 应该创建票证。有没有人熟悉可以提供帮助的模块?
编辑:我在整个代码中添加了打印语句,如下所示:
#!/usr/bin/env perl
use strict;
use warnings;
use RT::Client::REST;
use Rt::Client::REST::Ticket;
my $rt = RT::Client::REST->new(
server => ($ENV{RTSERVER} || 'http://rt.myrturl.com'),
);
print "1";
$rt->login(
username => 'user',
password => 'pass',
);
print "2";
my $ticket = RT::Client::REST::Ticket->new(
rt => $rt,
queue => "General - unassigned",
subject => "Perl Create Ticket Test",
);
print "3";
$ticket->store("I'm a ticket");
在 print 2 行抛出以下错误:
Unknown code ref type given ''. Check your usage & try again at CreateRTTicket.pl line 19