Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best practice for using slightly modifying module from CPAN?

Tags:

perl

cpan

I'm using DBI and DBD::SQLite, and now I'd like to use the R*Tree feature of SQLite. Since this feature is not compiled by DBD::SQLite by default, I have to add a -DSQLITE_ENABLE_RTREE=1 to the @CC_DEFINE variable in DBD::SQLite's Makefile.PL. If I do a 'perl Makefile.PL && make && make install', everything works fine locally on my machine, but this ultimately needs to be deployable/distributable to end users.

What should I do in a case like this? Should I copy the source, grep the source, and create a DBD::SQLite::WithRTree? Create a private version of DBD::SQLite 1.31.1 (Where 1.31 is the current version of DBD::SQLite)? Perhaps a better way altogether?

All other distributions in the project are deployed/distributed via a non-public CPAN::Mini mirror + CPAN::Mini::Inject.

like image 966
cespinoza Avatar asked Jan 11 '11 22:01

cespinoza


2 Answers

I have to add a '-DSQLITE_ENABLE_RTREE=1' to the @CC_DEFINE variable in DBD::SQLite's Makefile.PL

You're doing this wrong, perl Makefile.PL DEFINE='-DSQLITE_ENABLE_RTREE=1' works. This is documented in ExtUtils::MakeMaker. Now that you know that, a simple solution involving Distroprefs will likely fall in place.

like image 74
daxim Avatar answered Oct 20 '22 06:10

daxim


For similar problems, I have installed the modified distribution in a separate directory (without changing any module names), and using use lib qw(the/special/directory) or setting $PERL5LIB for scripts that need to use the enhanced module.

Tweaking the name of the module would also do the job, but that sound like a lot more work to make and test.

like image 32
mob Avatar answered Oct 20 '22 06:10

mob