Re: [PEPr] Proposal for HTTP::HTTP_Spider
| From: | Martin Jansen | Date: | Fri, 05 Mar 2004 18:32:56 +0000 |
| Subject: | Re: [PEPr] Proposal for HTTP::HTTP_Spider | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-26143@lists.php.net to get a copy of this message | ||
On Fri Mar 05, 2004 at 01:1547PM -0500, Matthew Feinberg wrote:
> > >* Why is PEAR.php included, if no feature that is provided by this file
> > > is used?
>
> Good question. No good answer. I wrote the class without pear for something
> I was working on, and now I'm trying to 'Pearize' it. I felt I should use
> PEAR because 'all the other classes are doing it'. I'll stop extending pear.
>
> Is it okay to just return false instead of a pear error?
That depends on the situation: In case you want to provide detailed
information about the error, which caused the script to return false,
you should use raiseError(). _Personally_ I prefer to always raise
PEAR_Error instances in methods, which are directly exposed to the user
or the view in MVC applications. I then catch those errors with a
application-wide error handler method, which renders a adequate view
then.
> Is it preferred to
> return a pear error even if you only need a boolean so that future
> development is easier,
There is no strict rule about that, but I'd choose that way.
> > >* There is a bunch of cool HTTP packages in PEAR, which should be used
> > > within HTTP_Spider. (E.g. HTTP_Request)
> Agreed. I am especially interested in HTTP_Client, because of its Cookie
> support, though it is listed as beta. I'll look at integrating
> > >HTTP_Request.
HTTP_Request was just an example. Maybe there is another package, which
fits even better into HTTP_Spider.
> > >* I do not think that it is a good idea to directly print debugging
> > > messages to stdout. Instead, Log should be used to faciliate a
> > > fine grained logging mechanism.
>
> I haven't looked into Log before. Great idea.
From what I know, there is no other class, which is using Log for this
purpose at the moment. Nonetheless I like the idea :).
--
- Martin Martin Jansen
http://martinjansen.com/