Embedded example code
| From: | Richard Heyes | Date: | Thu, 28 Mar 2002 19:40:52 +0000 |
| Subject: | Embedded example code | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-5130@lists.php.net to get a copy of this message | ||
Saw Jon Parise post on the engine2 list regarding example/test code embedded
in class files. Thought this could be useful here.
For example:
class My_Class {
...
function example(){
// ...example code
}
}
if(basename($HTTP_SERVER_VARS['PHP_SELF']) === basename(__FILE__)){
My_Class::example();
}
Any thoughts regarding it? Possible problems I see are:
o Unnecessary code loaded
o Issues when pear directory is inside document root
--
Richard Heyes
"If you have any trouble sounding condescending,
find a Unix user to show you how it's done." - Scott Adams