[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: back-perl suggestions

Leif Johansson wrote:

I have a couple of thoughts on modifications to back-perl and a
general question about the backend-api:


   1. Return an array reference [$return_code,$error_message] from
   backend methods instead of just a scalar return_code.

I realised that it is better to return a hash reference but _check_ for a scalar
return value in the backend. That way passing return values is backwards-
compatible. The other issues are more difficult to do without changing the
api though...

Anyhow, this way your perl backend can do things like this:

my $rc = eval {
# set alarm and die with a message on timeout
# call external stuff ...

   # clear alarm (and return success)
}; if ($@) {
   return $@ ? {code=>1,text=>$@,matched=>$some_where} : $rc;

I am doing a new version of back-perl which I will post in a few days...

       Cheers Leif