Using non-default PEAR libraries in a module: a no-no?

tkott

Joined: 2010-06-07
Posts: 201
Posted: Thu, 2010-07-29 00:29

I'm starting to write a module, and found some PEAR libraries that would be useful so as to not have to rewrite the wheel, so to speak. I was wondering though if this was considered a no-no by the Gallery 3 developers, and if so, if they knew of any ways of extracting PEAR extensions from PEAR.

Thanks,

Tomek!

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7940
Posted: Thu, 2010-07-29 02:43

PEAR libraries are fine with me. You could just rely on having the libraries installed on the system, and in your module's installer you can check to see if they're available. Here's an example check:
http://github.com/gallery/gallery3-contrib/blob/master/modules/ldap/helpers/ldap_installer.php#L21-30
---
Problems? Check gallery3/var/logs
bugs/feature req's | upgrade to the latest code | use git

 
tkott

Joined: 2010-06-07
Posts: 201
Posted: Thu, 2010-07-29 13:23

Thanks bharat,

Here's another question: Isn't PEAR installed by default on all PHP 5+ installations? If so, could I just copy the non-default libraries I need (there are essentially three files), and then modify them to use the modules library path, since all they need is to inherit the PEAR.php class? Would something like that be possible and perhaps more user friendly?

(Edit: way to mispell bharat's name... sheesh. Sorry!)

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 23886
Posted: Thu, 2010-07-29 22:52
Quote:
(Edit: way to mispell bharat's name... sheesh. Sorry!)

You won't believe how it sounds in real life. :-)
It was quite humorous when he introduced himself at the Gallery convention in 2005.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7940
Posted: Sat, 2010-07-31 21:23

:-)

You're pretty much free to do this any way that you'd like. My preference is to keep the code small and require the system to have PEAR installed, and have your module require reasonable versions. But you can also just ship the PEAR libs with your module -- that works too.
---
Problems? Check gallery3/var/logs
bugs/feature req's | upgrade to the latest code | use git