Subject: | Incorrect dereference of return value from form_parse? |
First of all, thank you for this very useful module.
For some strange reason, this problem started happening today with 0.37. I upgraded to 0.43
but that did not help. See below for how I made it work:
The problem:
$ perl /tmp/test-rt.pl
Can't use an undefined value as an ARRAY reference at
/usr/lib/perl5/site_perl/5.8.8/RT/Client/REST.pm line 117.
---
The code:
use RT::Client::REST;
use RT::Client::REST::Ticket;
use strict;
my $id = 449086;
my $RT_SERVER = 'https://rt.mydomain.com';
my $RT_USER = 'xxxx';
my $RT_PASS = 'xxxx';
# Create RT object
my $rt = RT::Client::REST->new(server => $RT_SERVER,
timeout => 30,
);
# Log into RT
$rt->login(username=>$RT_USER, password=>$RT_PASS);
my $ticket = RT::Client::REST::Ticket->new(rt => $rt,
id => $id,
)->retrieve;
----
The fix:
--- REST.pm 2012-01-09 10:09:51.000000000 -0800
+++ REST.pm.new 2012-08-13 09:28:31.000000000 -0700
@@ -112,7 +112,7 @@
}
my $form = form_parse($self->_submit("$type/$id")->decoded_content);
- my ($c, $o, $k, $e) = @{$$form[0]};
+ my ($c, $o, $k, $e) = @{$form->[0]};
if (!@$o && $c) {
RT::Client::REST::Exception->_rt_content_to_exception($c)->throw;