On Fri, 21 Mar 2003, Tim Bunce wrote:

> Having transparent failover is handy.
>
> You can wrap the "bootstrap" call in an eval { }. Then you've got
> a few choices, either put the perl versions of the XS subs at the
> end after __DATA__ and add "use SelfLoader;", or do a require of a
> separate module with the perl code. I'd suggest the later, it's
> what the DBI uses to load DBI::PurePerl.

That's what I did with Params::Validate when Ilya Martynov re-coded it in
XS.

> Another key issue is the need to automatically test both XS and
> pure perl versions. The DBI has a cute trick for this. For every
> t/*.t file the Makefile.PL writes a t/zz_*.t that just contains:
>
>       #!perl -w
>       $ENV{DBI_PUREPERL}=2;
>       do 't/test-name-here.t' or warn $!;
>       die if $@;
>       exit 0
>
> The env var triggers the DBI to not even try to bootstrap the XS
> code but go straight to loading the pure-perl code.
>
> Having this automated has caught countless would-be-bugs as the DBI
> and it's test suite has evolved.

Ah, clever.  I need to add something like this to Params::Validate as
well.


-dave

/*=======================
House Absolute Consulting
www.houseabsolute.com
=======================*/

Reply via email to