Re: Optionally include a script
| From: | Justin Patrin | Date: | Wed, 02 Nov 2005 22:55:19 +0000 |
| Subject: | Re: Optionally include a script | ||
| References: | 1 | Groups: | php.pear.qa |
| Request: | Send a blank email to pear-qa+get-3216@lists.php.net to get a copy of this message | ||
On 11/1/05, bertrand Gugger <bertrand@toggg.com> wrote:
> Bonsoir,
> As discussed in the "Silencing @" thread,
> silencing optional includes can be very bad.
>
> Someone said it's bad design, but I know/encounter 2 cases:
>
> - a package has an optional dependency but has calls to it hard coded,
> how could pear installer notify it is there or not ?
> or should this package give an interface to force the caller to say: I
> have the dependency in, I agree ?
> e.g. Net_Monitor
Packages with optional dependencies should not try to use them unless
told to do so by the caller / configuration. If a package wishes to do
automatic inclusion of optional dependencies they *must* use the
include_path/file_exists set to make sure a file exists before
including it. @ on includes is not ok.
>
> - a package provides dynamic , post installation possibly includes,
> there's no other ways as the include_path scan mentionned, imho
> e.g. Text_Wiki_Tiki , rule Plugin
>
You mean a driver system, right? Same as for DB/MDB/etc? These should
also not use @. Either an include should be done and cause an
error/failure if it returns false and the PHP error should be left
as-is, or the include_path/file_exists system should be used which
would also raise an error. I'm in favor of no checking, just include
or require it and let the dev deal with missing file warnings.
> Should it be a dev-list discussion ?
> a+
> --
> bertrand "toggg" Gugger
>
> --
> PEAR QA Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Justin Patrin