[dev] Autoloader suggestions
Chuck Hagenbuch
chuck at horde.org
Mon Nov 17 01:46:19 UTC 2008
Quoting Michael M Slusarz <slusarz at horde.org>:
> Having spent a good portion of last night trying to get autoload to
> work with an application's library files, below find a patch to
> Autoloader to attempt to overcome some shortcomings. The main
> advantage of these changes is that we can do a call like this (e.g.
> in IMP):
>
> Horde_Autoloader::addClassPattern('/^IMP_/', IMP_BASE . '/lib/');
>
> which will allow us to load things like 'IMP_Message' via
> autoloading. Also uses include_once instead of include (prevents
> redefinition errors if a library is attempted to be loaded manually
> after autoloading) and exits immediately from the classPatterns loop
> if the library file was successfully loaded.
I've marked these changes to look at later, but just to get it out there:
- loading from application lib/ directories - interesting take on it;
I've been assuming we'd reorganize the apps for Horde 4, making this
moot. But we'll see.
- include_once - this should be unnecessary and adds overhead that
we're trying to avoid with autoload. I think this should only be an
issue if mixing autoload and non-autoload for the same library.
-chuck
More information about the dev
mailing list