Re: commit: framework/Imap_Client/lib/Horde/Imap Client.php

Chuck Hagenbuch <[email protected]>
Newsgroups gmane.comp.horde.cvs
Message-ID <[email protected]>
Quoting Michael M Slusarz <[email protected]>:

> Again, though, what is the alternative if Horde_Imap_Client is meant  
> to be used completely separate of Horde (I've already had several  
> inquiries for using the client lib without using any of the optional  
> Horde libs)?  And using this autoload stuff breaks the previous  
> behavior for some of these require/includes, which is if the library  
> is not available disable that feature (I'm guessing autoload wasn't  
> really designed for this purpose).  Now if the library is not  
> available, the entire script dies, which isn't very helpful.

if (class_exists('Auth_SASL')) ...

etc. This will trigger autoload but not fail if autoload fails.

If you want others to have to do _no_ work to use the library, you can  
create a bootstrap.php (or whatever name sounds good) that includes  
all of the files in the library and checks for external dependencies.  
Then people can just include that (kind of like __init__.py files)  
files. I briefly considered this for all Horde 4 lib, and decided that  
it was pretty hokey and hard to maintain. But you could do it  
separately for this if you really want.

> That is why, playing with autoload stuff today, I've come to the  
> realization it is kind of worthless.  It causes just as many  
> problems as it fixes.

I disagree on this pretty strongly. I can get into it more at some  
point but right now I'm too tired to make a good argument, so I won't  
fake it. :)

-chuck

--
To unsubscribe, mail: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.