Hi Paizo,

In the programs that I've written, I usually check the size of the
hash or array as opposed to checking for ARWARN 1200.  I'll provide
two examples of how to do this.  The first example is with a hash and
the second is with an array.

The first example is untested code that I put together by doing some
googling.  The keys() function might be helpful.  For example:

%entries = ars_GetListEntry($ctrl, $ARSschema, $qual, 0, 0);
$hash_size = keys(%entries);

if ($hash_size eq 0) {
    print "ARWARN 1200: Nothing was found\n");
    ars_Logoff($ctrl) || exit 0;
    exit 0;
}

A lot of programs that I've written in the past use an array
instead of a hash and then branch based on the size of the array.

Partial code from an actual working program:

  @entries = ars_GetListEntry($c, $s_ho, $q, 0, 0);
  if ($#entries eq -1) {
    print MAIL ("There are no $holdtypes.\n");
  } elsif ($#entries eq 1) {
    print MAIL ("There is one $holdtype:\n\n");
    $entry_num = $entries[0];
    &PrintHeader;
    &PrintEntry($entry_num, $startorend, $holdtype);
  } else {
    $ent_num = ($#entries + 1) / 2;
    print MAIL ("There are $ent_num $holdtypes:\n");
    &PrintHeader;
    for ($i = 0; $i <= $#entries; $i +=2 ) {
      $entry_num = $entries[$i];
      &PrintEntry($entry_num, $startorend, $holdtype);
    }
  }

Hope that helps!
Alex

On Fri, Oct 05, 2007 at 10:31:00AM +0200, Paizo wrote:
> Hi listeners,
> 
> I'm making a perl script to check the presence of some kind of tickets.
> Usually there are no tickets of this kind causing a ARWARN 1200.
> I would like to handle this warning but i miss something....
> 
> 
> $arwarn = "";
> (%entries = ars_GetListEntry($ctrl, $ARSschema, $qual, 0, 0)) || ($arwarn =
> $ars_errstr);
> 
> print "$arwarn\n"; # $arwarn is empty!
> 
> if ($arwarn=~ m/\ARWARN 1200/i)
> {
>     ars_Logoff($ctrl) || exit 0;
>     exit 0;
> }
> 
> what's wrong with that code?
> Seems also that $arwarn is empty because it print nothing at all.
> 
> 
> thank you for your time.
> 
> 
> -- 
> --------------------
> A me cugin na volta xe nd? dal geataro e el ga domand? na coppetta trigusto
> co i gusti seegheta, sarexe e schie co na fettina de poenta.
> El geataro pena sentio che? goduriosa scelta, el se ga messo subito el
> pigiama de banane e el ghe ga messo in testa a corona de poegge medie e lo
> ga fatto diventare Re dei Gelati Biricchini.
> -----------------------
> Confezione trigusto seegheta/sarexe/chie co pratico contenitore par e fete
> de poenta, stile estat? o quea dea ciocoeata
> Altri gusti poe essere bigadini/kiwi/lasonil co socoi de vacca da tociare o
> erbagatta/straciatella/calsina co coe de sorxe da tociare
> ------------
> Rileggendo a firma diria che se poe puntare al mercato dei ghiaccioli col el
> gusto crema al diserbo e parafl? ricoperta da una soffice crosta de pus co
> al posto del bacheto un termometro anale pratico pa misurarse a freve dopo
> aver magn? el geato (chi xe che no lo fa al giorno d'oggi?!?!). Garantite
> scorese bitonali e solfeggi anali.

> -------------------------------------------------------------------------
> 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
> Arsperl-users@arsperl.org
> https://lists.sourceforge.net/lists/listinfo/arsperl-users


-- 
O--------------O--O---------------------------------O
|   Alex Agle   \/ Systems Support Specialist III   |
O---------------/\  Georgia Institute of Technology |
|(404)894-6165 //\\  ITS - Applications Support     |
| Atlanta, GA //\/\\  alex.agle(@)oit.gatech.edu    |
O------------O-\/\/-O-------------------------------O

-------------------------------------------------------------------------
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
Arsperl-users@arsperl.org
https://lists.sourceforge.net/lists/listinfo/arsperl-users

Reply via email to