
Hi,
-----Original Message----- From: otrs-bounces@otrs.org [mailto:otrs-bounces@otrs.org] On Behalf Of Juan Manuel Clavero Almirón Sent: Wednesday, October 19, 2011 12:22 PM To: User questions and discussions about OTRS. Subject: [otrs] Problems with RPC response
I have two cases. In the first case, I try to get TicketObject->ArticleGet providing ArticleID and UserID. In this case, XML response has the information about the article, but my perl var only has the first component. When I declare the var as an array, it only has one element and it contains the same first component.
I remember running through this stuff a while ago, I couldn't get the exact cause, it might be a perl bug (or some feature I don't understand). The key is, don't use '||', use 'or' for the die part. A bit of testing I've done back then: ====== #!/usr/bin/perl use Data::Dumper; sub foo{ my %a = qw(a b c d e f); return %a; } my %good = foo() or die $!; my %bad = foo() || die $!; my @almost = {foo()} || die $!; print "The good:\n" . Dumper \%good; print "The bad:\n" . Dumper \%bad; print "And the wannabe:\n" . Dumper \@almost; [kroozo@pirx ~]$ ./test.pl The good: $VAR1 = { 'e' => 'f', 'c' => 'd', 'a' => 'b' }; The bad: $VAR1 = { '3/8' => undef }; And the wannabe: $VAR1 = [ { 'e' => 'f', 'c' => 'd', 'a' => 'b' } ]; ======= Hope this helps, Cheers, tamas