On Thu, Apr 04, 2002 at 01:28:06PM -0800, Jeff Zucker wrote:
> Here's the latest DBI::PurePerl.  I'm sure I've taken some inappropriate
> shortcuts, but the results on DBI-1.21/t/* are looking pretty good, much
> improved over last version:
> 
> Failed Test   Total Fail  Failed 
> ---------------------------------
> 
> t\basics.t       36    9  25.00%
> t\examp.t       201   40  19.90%  # strange $@ behaviour here
> t\preparse.t     23   16  69.57%
> t\subclass.t     15    3  20.00%
> 
> 1 test skipped. (proxy.t)
> 
> Failed 4/8 test scripts, 50.00% okay. 68/301 subtests failed, 77.41%
> okay.
> 
> 233 down, 68 to go :-)

Great work!

Some random comments...

> use constant IMA_HAS_USAGE    => 0x0001; #/* check parameter usage    */
> use constant IMA_FUNC_REDIRECT        => 0x0002; #/* is $h->func(..., "method")*/
> use constant IMA_KEEP_ERR     => 0x0004; #/* don't reset err & errstr */
> use constant IMA_spare                => 0x0008; #/* */
> use constant IMA_NO_TAINT_IN          => 0x0010; #/* don't check for tainted args*/
> use constant IMA_NO_TAINT_OUT   => 0x0020; #/* don't taint results    */
> use constant IMA_COPY_STMT    => 0x0040; #/* copy sth Statement to dbh */
> use constant IMA_END_WORK     => 0x0080; #/* set on commit & rollback */
> use constant IMA_STUB         => 0x0100; #/* donothing eg $dbh->connected */

You need to use IMA_KEEP_ERR and IMA_COPY_STMT in _install_method now.
The others can wait. That'll probably fix more tests.

Try to emulate more of what the dispatch() code in DBI.xs is doing.

>             if ( $param_hash and defined $param_hash->{'U'}

Don't bother with usage checking.

>            and $param_hash->{'O'} == 0x0080

Test bit fields with "... | IMA_...", not ==

> sub set_err {
>     my($h,$errnum,$msg,$state)=@_;
>     $msg = $errnum unless defined $msg;
>     #z
>     # Avert your eyes if you don't want to see a horrendous kludge
>     #   (and check DBI::var::FETCH for the other half)
>     $DBI::zerr    = $errnum;
>     $DBI::zerrstr = $msg;
>     $DBI::zstate  = $state;
>     $h->{'zerrstr'}=$msg;
>     $h->{'errstr'}=$msg;
>     $h->{'state'}=$state if $state;
>     $h->{'err'}=$errnum;

You can reasonably assume that's going in the wrong direction :)
Talk to me about the problems you were trying to solve here.
There's bound to be a better way.

> sub preparse {

Do go there! Just have PurePerl.pm set $DBI::PurePerl = 1;
and have t/preparse.t skip the tests if that's set.

Tim.

Reply via email to