Re: [PEPr] +1 for Networking::Net_TrackBack
| From: | Cipriano Groenendal | Date: | Tue, 20 Apr 2004 15:35:52 +0000 |
| Subject: | Re: [PEPr] +1 for Networking::Net_TrackBack | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-28151@lists.php.net to get a copy of this message | ||
> > At 20 Apr 2004 13:00:09 -0000,
> > PEPr wrote:
> > > I'm +1 on this so long as you only include PEAR.php when raising
> > > errors, instead of including it everytime.
> > Hummm...., Do you recomend like this code?
> > I think it is not cool. Why must not include PHP.php everytime?
> First of all, I guess you meant "PEAR.php"? And no, it's not included
> everytime. There is a require_once, and it is only included when
> needed. So imho in case you just need PEAR.php to throw an error this
> is a viable solution. You usually expect a package to work, not to
> fail, so in the success-case PEAR.php wouldn't be included (loaded,
> parsed, compiled, ...) at all.
Theoreticly speaking, Stefan is correct. Only including PEAR when you raise
an error /does/ save on resources since all the read/parse/compile for
PEAR.php is skipped. In this specific case, however, Net_Trackback depends
on HTTP_Request which depends on Net_Socket which extends PEAR, so it'll get
included anyway.
Thus, for clarity's sake, I'd suggest to put the include PEAR in the top
with the rest of the code :)
Cipri