Massimiliano Pala schrieb:
> 
> Michael Bell wrote:
> 
> > > The undef value is ok so we can use check like:
> > >
> > >         if ( not $obj->sub() ) {
> > >                 error!;
> > >         } else {
> > >                 ok!;
> > >         }
> >
> > Ups, this doen't work. If $obj->sub () returns 0 then the operation was
> > successful but 0 is a false value! I'm using in the module DBI "if (not
> > defined $obj->sub())".
> 
> we actually have to choose it : I would prefer the 0 = FALSE = Error way,
> anyway if this will require much work we could start restyling the other
> modules...

I think the way proposed by you is much more error proof than the way
with defined and not defined values but if we choose this way of
implementation I would be a little bit more general too.

Could we allow all FALSE values and strongly recommend "undef" or "0" if
the function fails? The following if-statement is at every time correct:

if (not $obj->sub ())

Regards Michael

The definitions until now are:
* $obj->errno ();
* $obj->errval();
* FAILED operations return a false value
* FAILED operations SHOULD return "undef" or "0"
* a failed call to OpenCA::MODULE->new () should made available
   # OpenCA::MODULE->errno ();
   # OpenCA::MODULE->errval ();
   
-----------------------------------------------------------------------
Michael Bell                       E-Mail: [EMAIL PROTECTED]
Rechenzentrum - Datacenter           Tel.: +49+(0)30-2093-2482
Humboldt-University of Berlin        Fax.: +49+(0)30-2093-2959
Unter den Linden 6
10099 Berlin
Germany

Kryptographische Unterschrift mit S/MIME

Reply via email to