Re: [Arsperl-users] ARSPerl newbie: How to list field values from a form?
Brought to you by:
jeffmurphy
|
From: Thilo S. <thi...@ap...> - 2007-08-09 18:29:49
|
I'm not sure what you are talking about.
ARTermination() is always called on exit because ARS.xs implements a
destructor function for ARControlStructPtr objects.
Perl also closes filehandles automatically.
If you have other resources which need cleanup, you can wrap your code
into an "eval" block:
eval {
...
ars_GetListEntry( .... );
die "Error message\n" if $ars_errstr;
...
}
warn $@ if $@;
# do cleanup here
So, in my opinion, in most cases the use of "die" should be just fine.
Best regards,
Thilo
Jarl Grøneng wrote:
> I does not like the die parameter if you got an error. You may miss
> the clean-up part.
>
> -
> Jarl
>
> On 8/9/07, Thilo Stapff <thi...@ap...> wrote:
>> ars_GetListEntry needs at least one more parameter (firstRetrieve,
>> usually = 0):
>>
>> %entries = ars_GetListEntry($ctrl, $schema, $qual, 0 , 0);
>>
>> instead of
>>
>> %entries = ars_GetListEntry($ctrl, $schema, $qual, 0);
>>
>>
>> Moreover, you should always check for errors after calling an API
>> function, e.g.
>>
>> die "ars_GetListEntry( $schema, $qs ): $ars_errstr\n" if $ars_errstr;
>>
>>
>> You might also try using the field ID of "Category" instead of the field
>> name in the qualifier string.
>>
>>
>> Regards,
>> Thilo Stapff
>>
>>
>> Ravi wrote:
>>> Hi:I am trying query a schema and print a fieldname and values for all
>>> records with a qualifying filter. I can't seem to figure out which
>>> function to use and how. This is what I have now and I get 0 records. Is
>>> asr_GetListEntry the right function? Does someone have a sample script
>>> or point me to the right one in the example dir?
>>>
>>> $schema = "My:Alarm Base";
>>> $qs = qq/'Category' = "Voice"/;
>>> ($qual = ars_LoadQualifier($ctrl,$schema,$qs)) ||
>>> die "error in ars_LoadQualifier";
>>>
>>> %entries = ars_GetListEntry($ctrl, $schema, $qual, 0);
>>>
>>> foreach $entry_id (sort keys %entries) {
>>> printf("%s %s\n", $entry_id, $entries{$entry_id});
>>> }
>>>
>>>
>>> Thanks
>>> Ravi
>>>
>>>
>>> -------------------------------------------------------------------------
>>> This SF.net email is sponsored by: Splunk Inc.
>>> Still grepping through log files to find problems? Stop.
>>> Now Search log events and configuration files using AJAX and a browser.
>>> Download your FREE copy of Splunk now >> http://get.splunk.com/
>>> _______________________________________________
>>> Arsperl-users mailing list
>>> Ars...@ar...
>>> https://lists.sourceforge.net/lists/listinfo/arsperl-users
>>>
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by: Splunk Inc.
>> Still grepping through log files to find problems? Stop.
>> Now Search log events and configuration files using AJAX and a browser.
>> Download your FREE copy of Splunk now >> http://get.splunk.com/
>> _______________________________________________
>> Arsperl-users mailing list
>> Ars...@ar...
>> https://lists.sourceforge.net/lists/listinfo/arsperl-users
>>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Arsperl-users mailing list
> Ars...@ar...
> https://lists.sourceforge.net/lists/listinfo/arsperl-users
>
|