RE: patch full of dark magic

"Jan Dubois" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase.devel
Organization ActiveState Software Inc
Message-ID <[email protected]>
On Mon, 09 Aug 2010, David E. Wheeler wrote:
> On Aug 9, 2010, at 4:21 PM, Jan Dubois wrote:
> 
> > On Mon, 09 Aug 2010, David E. Wheeler wrote:
> >> Tim, I think we're ready for another dev release, especially since I added this test to the MANIFEST.
> >
> > Running tests on the latest ActivePerl shows 2 issues:
> >
> > 1) t/01basics.t fails to load DBD::Oracle (because I don't have the Oracle client
> >   libraries installed on the test machine).  This produces a popup that the user
> >   has to explicitly dismiss.  The test then passes without errors.
> 
> Why does it try to load DBD::Oracle? The DBI has no dependency on any DBDs other than those it ships with.

DBI->installed_versions will attempt to load *all* installed drivers.

But I see now that that test is only executed if you are running from a GIT
or SVN checkout, so maybe it doesn't really matter.  If you want to add
the safeguard for it, here is a tested patch (the untested version was missing
one pair of parens):

Index: t/01basics.t
===================================================================
--- t/01basics.t        (revision 14317)
+++ t/01basics.t        (working copy)
@@ -290,6 +290,10 @@
 SKIP: {
        skip 'developer tests', 4 unless -d ".svn" || -d ".git";

+       if ($^O eq "MSWin32" && eval { require Win32API::File }) {
+           Win32API::File::SetErrorMode(Win32API::File::SEM_FAILCRITICALERRORS());
+       }
+
        print "Test DBI->installed_versions (for @drivers)\n";
        print "(If one of those drivers, or the configuration for it, is bad\n";

        print "then these tests can kill or freeze the process here. That's not the DBI's fault.)\n";

Cheers,
-Jan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.