Subject: | Error in CPAN Documentation |
Date: | Mon, 18 Aug 2014 22:25:27 +0000 |
To: | "bug-RT-Client-REST [...] rt.cpan.org" <bug-RT-Client-REST [...] rt.cpan.org> |
From: | Ben Miller <bmiller [...] myriad.com> |
This webpage: http://search.cpan.org/~dams/RT-Client-REST-0.36/lib/RT/Client/REST.pm
Includes an incorrect code example (I think). Read on for incorrect code and it's replacement.
Example code from webpage:
my @ids = $rt->search(
type => 'ticket',
query => "Status = 'stalled'",
);
for my $id (@ids) {
my ($ticket) = $rt->show(type => 'ticket', ids => [$id]);
print "Subject: ", $t->{Subject}, "\n";
}
I have similar code which returns a list of ticket ids and was attempting to use this code example to display the subject of each ticket, but the last line of the example code seems to be the problem. The code was always returning "" as the subject until I replaced:
"print "Subject: ", $t->{Subject}, "\n";"
with
"print "Subject: ", $ticket->{_subject}, "\n";"
This might be an issue with the documentation, or with my understanding of it, but I couldn't get the example code to work until I made this change.