Re: [PEPr] Proposal for HTTP::HTTP_Spider
| From: | Stefan Neufeind | Date: | Fri, 05 Mar 2004 18:28:02 +0000 |
| Subject: | Re: [PEPr] Proposal for HTTP::HTTP_Spider | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-26142@lists.php.net to get a copy of this message | ||
On 5 Mar 2004 at 13:15, Matthew Feinberg wrote:
> Is it okay to just return false instead of a pear error? Is it
> preferred to return a pear error even if you only need a boolean so
> that future development is easier, e.g. you've added new logic to a
> function which requires the the addition of more fine grained errors.
> (Sorry, I'm new to PEAR development)
Depends on the way you implement your API. Generally I'd say it's
okay to return false from a simple function. But please note that
returning a PEAR_Error at a later revision of your package would mean
a BC break (backward-compatibility). So if you just don't throw a
PEAR_Error *now* but will do in the next revision, maybe already
implement at least a simply error.
> > >* What purpose does the empty constructor serve?
> Again, none. I looked at some other classes to try to understand how
> some of the PEAR coding standards are used in practice. The class I
> looked at, PEAR_PackageFileManager, has an empty constructor. I'll
> remove mine.
PEAR_PackafeFileManager just has it for documentation purpose. Have a
look at the comments above:
http://cvs.php.net/co.php/pear/PEAR_PackageFileManager/PackageFileMana
ger.php?r=1.34
This wouldn't have been possible without an empty constructur.
[...]
In general I like your proposal. But as said, you should try to
PEARify it more, use existing PEAR-packages instead of reinventing
the wheel etc. where apropriate. Then feel free to ask for comments
again here on pear-dev.
Thank you for your decision to contribute to PEAR. Regards,
Stefan