Perhaps you could discuss it on dbu-users in the context of DBI.

Ever wish you could test a new module or version without installing it in the default perl libs? Or set up different sandboxes for various module releases to check them?

The main problem at most sites is control over the
default @INC dir's: they are reserved for the vendor
distribution modules. Modifying one of these, especially
for regression testing, requires an act of Congress (or
worse a SysAdmin).

Here's a fix: FindBin::libs. It walks the file tree
from $FindBin::bin to '/' looking for "lib" directories,
abs_paths them, and does a "use lib" of the distinct
paths found.

This allows you to create multiple sandboxes with
different versions of code found, or have a "lib"
directory for homegrown code outside of the vendor
@INC. You can happily install new modules into, say,
/usr/local/lib and run the code out of /usr/local/bin
without having to "use lib" in every #! or module you
write.

This can also be used for quicker regression testing.
Say a new version of DBD::FooBar comes out and you
use two versions of DBI on site. If the two versions
are installed into /sandbox/DBD-test1 and /sandbox/DBD-test2
you can symlink a bin directory into each of them after
installing the code (the module's POD has examples of
this).

Because lib's closer to $Bin have higher priority you
can also test a module under development by moving it
"up" the /sandbox path to test it on a wider range of
code.

This also helps if you have multiple versions under
development:

        ./sandbox/version-X/lib
        ./sandbox/version-X/bin -> ../bin

        ./sandbox/version-Y/lib
        ./sandbox/version-Y/bin -> ../bin

you can now test anything in bin with version X or Y.

The module can be configured to search for different
dir's (e.g., "mylib") or return an array of the paths
found (for explicit searching). The POD describes a
few ways to set up sandboxes for development and
testing.

The module is currently on CPAN as FindBin::libs.


-- Steven Lembark 2930 W. Palmer Workhorse Computing Chicago, IL 60647 +1 888 359 3508

Reply via email to