Re: [svn:dbi] r13312 - dbi/trunk

"H.Merijn Brand" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase.devel
Message-ID <[email protected]>
On Sun, 13 Sep 2009 11:12:38 +0100, Tim Bunce <[email protected]>
wrote:

> On Sat, Sep 12, 2009 at 02:39:48AM -0700, [email protected] wrote:
> > Author: hmbrand
> > Date: Sat Sep 12 02:39:44 2009
> > New Revision: 13312
> > 
> > Modified:
> >    dbi/trunk/DBI.xs
> > 
> > Log:
> > perl-5.10.x sets filename to "*main::STDERR" when using 'DBI->trace (0, *STDERR);'
> > 
> > Modified: dbi/trunk/DBI.xs
> > ==============================================================================
> > --- dbi/trunk/DBI.xs	(original)
> > +++ dbi/trunk/DBI.xs	Sat Sep 12 02:39:44 2009
> > @@ -814,7 +814,8 @@
> >      else {
> >  	filename = (SvOK(file)) ? SvPV_nolen(file) : Nullch;
> >  	/* undef arg == reset back to stderr */
> > -	if (!filename || strEQ(filename,"STDERR")) {
> > +	if (!filename || strEQ(filename,"STDERR")
> > +		      || strEQ(filename,"*main::STDERR")) {
> >  	    close_trace_file(aTHX);
> >  	    DBILOGFP = PerlIO_stderr();
> 
> Wouldn't it be better to detect when a glob is being passed and use the
> filehandle in the glob? That way it would work for any *FOO fh.

That's what Nick said too. I am looking onto this, but as STDERR was
being referred to here specifically, I thought this at least fixes the
special case for all backwards compatibility issues. (My tests suddenly
started creating files with the name "*main::STDERR", and upgrading DBI
is way easier than upgrading perl.

Feel free to beat me in doing it right though.

-- 
H.Merijn Brand  http://tux.nl      Perl Monger  http://amsterdam.pm.org/
using & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00,
11.11, 11.23, and 11.31, OpenSuSE 10.3, 11.0, and 11.1, AIX 5.2 and 5.3.
http://mirrors.develooper.com/hpux/           http://www.test-smoke.org/
http://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/
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.