develooper Front page | perl.perl5.porters | Postings from August 2012

Re: un(der?)documented dbmopen return value

Thread Previous
From:
Nicholas Clark
Date:
August 2, 2012 06:43
Subject:
Re: un(der?)documented dbmopen return value
Message ID:
20120802134312.GH9583@plum.flirble.org
On Sat, May 07, 2011 at 09:05:45AM -0600, Tom Christiansen wrote:
> As far as I can tell, dbmopen returns the tied 
> object; that is, it returns whatever tie AnyDBM_File
> ends up returning.  Looking at pp_dbmopen in pp_sys.c
> gives me no particular reason to think otherwise.
> 
> However, the dbmopen entry in perlfunc makes no mention
> of this.  I think it should say that it's returning the
> tie object.

The dbmopen entry is arguably somewhat worse than this. It says:

                                                      To prevent creation of
    the database if it doesn't exist, you may specify a MODE
    of 0, and the function will return a false value if it
    can't find an existing database.

So it definitely does return a false value in those cases.

Does it return a false value on success? Possibly :-)
The documentation only implies that it returns something truthful.
I think that we should fix that to be clear that it returns truthful, and
as I doubt that it's ever going to changed, documenting that it returns
the tie object seems sane.


> Is there any argument that it should *not* be so documented?

It seems that no-one replied at all, implying that no-one objected.

Did you have a suitable chunk of text somewhere that can be re-used?
Or would you like me to fix it?

Nicholas Clark

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About