TechnoGeek

Looking for example(s) of how to return a table from a Perl callback

Discussion created by TechnoGeek on Mar 7, 2012
Latest reply on Mar 7, 2012 by 1_keithk

I am trying to write a callback procedure in Perl that needs to return a table of values to the requester and I can not find any example of how to do this. Basically, I need to return a table that should look like this:

 

NimID  CaseNumber

XXXXX  YYYYYYY

XXXXY  YYYYYYX

[...]

 

I used the code wizard and created a callback like this:

 

--------------------------------------------------------

sub show_incidents {

    nimLog(3,"starting show_incidents");

    my ($hMsg) = @_;

    my $reply = pdsCreate();

    my $incident;

 

                foreach $incident (keys %Xincidents) {

                                pdsPut_PCH($reply,"$Xincidents{$incident}"  ,  "$incident");

                }   

 

    nimSendReply($hMsg,0,$reply);

    pdsDelete($reply);

    nimLog(3,"Sent reply - $message");

}

 

-------------------------------------

 

and this appears to crash on the pdsPut_PC command. Changing that to

    pdsPut_PCH($reply,"data","$Xincidents{$incident} = $incident");

 

works, but only shows the last value rather than the list, so I assume that I need to create a pds list, but I can not find any useful examples of how to do this.

 

Can you please point me in the right direction (example or documentation that I can look at)?

 

Thanks!

 

Marc

Outcomes