RE: [PEAR-DEV] Relativ Includes

From: Date: Thu, 31 Oct 2002 14:54:44 +0000
Subject: RE: [PEAR-DEV] Relativ Includes
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-10378@lists.php.net to get a copy of this message
> -----Original Message----- > From: Pierre-Alain Joye [mailto:paj@pearfr.org] > Sent: Thursday, October 31, 2002 3:49 PM > To: smith@dybnet.de > Cc: pear-dev@lists.php.net > Subject: Re: [PEAR-DEV] Relativ Includes > > On Thu, 31 Oct 2002 15:46:03 +0100 > "Lukas Smith" <smith@dybnet.de> wrote: > > > (posted this to pear-general by mistake) > > > > Hi, > > > > well PEAR still has a serious problem imho with the issues we thought > > we could solve with dirname(__FILE__): > > > > ssb response :-) : > <ssb> > > There are two problems that need fixing here: being able to run tests > from within a development tree, and using PEAR on systems where you > can't modify include_path. We have to deal with these, but > dirname(__FILE__) will cause more problems than it solves. > > Consider this a veto. :-) > </ssb> > ops .. should have re-read before re-post anyways I already have an idea to fix things :-) introduction of a PEAR_INCLUDEPATH constant Every package will make their includes as follows: PEAR_INCLUDEPATH.DIRECTORY_SEPERATOR.[old include] For example a driver would be included like so: require_once PEAR_INCLUDEPATH.'MDB/mysql.php'; in factory script of every package (in the case of MDB that would be MDB.php and Manager.php) you would have something like this: // this is only needed for php version before 4.0.6 if(!defined(DIRECTORY_SEPERATOR)) { define('DIRECTORY_SEPERATOR', '/'); } if(!defined(PEAR_INCLUDEPATH)) { // dirname(__FILE__) would obiously only work if the // included file is in the pear root dir // alternatively this could also just be '' and so the includes // would still use the (slow) include search paths as // they are today define('PEAR_INCLUDEPATH ', dirname(__FILE__)); } This way we would stop using the include paths which are slow, but we also ensure that *_once always gets the same relativ path passes so it does not reinclude files that have been included before. Regards, Lukas

« previous php.pear.dev (#10378) next »