Re: Comments about PHPTAL package proposal?
| From: | Greg Beaver | Date: | Sun, 19 Apr 2009 16:56:50 +0000 |
| Subject: | Re: Comments about PHPTAL package proposal? | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-51757@lists.php.net to get a copy of this message | ||
Kornel Lesiński wrote:
>> Some thoughts:
>>
>> - use System_Folders to retrieve temporary folder
>
> That's doable, but implementation in System_Folders is weaker - it just
> blindly assumes /tmp/ on Linux/OS X rather than querying the system
> (which sys_get_temp_dir() does properly).
>
>> - do not prefix your includes with PHPTAL_DIR (require_once
>> PHPTAL_DIR.'PHPTAL/FileSource.php';) this is handled by the system
>> configuration. In PEAR packages we just use require_once
>> 'PHPTAL/FileSource.php';
>
> This is needed to avoid mix-up of files from PEAR and other
> installations of PHPTAL, e.g.:
>
> include "my/framework/libs/PHPTAL.php";
>
> won't work properly without enforced path prefix. There's same problem
> when running test suite. Does PEAR have solution to this?
Yes. Look at how phpDocumentor handles this. You provide a stub file
that modifies include_path which other installations then use.
Incidentally, it is never wise to use constructs like:
include CONSTNAME . '/path/to/blah.php';
because opcode caches will never cache your code at compile-time, as the
path cannot be safely resolved until run-time. It makes your code
intrinsically slower even with an opcode cache.
Greg