Re: package validation (was Re: PHP_Beautifier-0.0.6.1)
| From: | Stefan Neufeind | Date: | Sun, 06 Jun 2004 18:33:10 +0000 |
| Subject: | Re: package validation (was Re: PHP_Beautifier-0.0.6.1) | ||
| References: | 1 | Groups: | php.pear.qa |
| Request: | Send a blank email to pear-qa+get-1394@lists.php.net to get a copy of this message | ||
On 6 Jun 2004 at 14:12, Greg Beaver wrote:
[...]
Thanks VERY much for sharing your thoughts. And I have nothing more
to say to this overly well-done compilation of ideas and source. Now
I see that my doubts were not really justified.
> Perhaps the only sure solution to this issue is to suggest that
internal
> include statements (like include_once 'DB/mysql.php' to load the
mysql
> driver) in new packages use replacements, as in:
>
> if ('@inc@' != '@' . 'inc@') {
> include_once '@inc@/DB/mysql.php';
> } else {
> include_once 'DB/mysql.php';
> }
Well, it would be a solution. But wouldn't it over-complicate
handling of classes too much? You can make sure that the correct PEAR-
packages are used by putting PEAR in front on the include_path as
well :-)) And if your application uses non-standard directories you
might even consider including them via a full path in the
application, like:
include $config['includeDir
].'/DB/mysql.php;
Inside the classes, how about using relative paths to the current
file, like in DB.php you might use:
include dirname(__FILE__).'DB/mysql.php';
This would allow to use the correct drivers for the DB-class no
matter where the DB-class was loaded from ... even if the directory
wasn't in the include-path (or in the wrong place). Seems fine to me!
Stefan