Subject: | scalar reference to stderr option does not work |
Date: | Fri, 24 Oct 2008 23:42:31 -0700 |
To: | bug-Perl-Tidy [...] rt.cpan.org |
From: | "Justin Davis" <jrcd83 [...] gmail.com> |
When passing a scalar reference as an argument to the stderr option to
perltidy() I still have messages printed to STDERR. The messages are
all "## Please see file perltidy.ERR". I am using perltidy in a cgi
script and this spams up the error log.
Also, as an aside since I'm here... the -syn flag apparently doesn't
do anything when added to the argv option. I suppose this is because
there is no file to check with perl -c and checking with perl -c -e is
rather awkward. Maybe the documentation should mention this. But I
digress.
My system information:
(I am using Archlinux)
[justin@lapdawg public_html]$ uname -a
Linux lapdawg 2.6.27-ARCH #1 SMP PREEMPT Sun Oct 12 15:16:25 CEST 2008
i686 Intel(R) Celeron(R) M processor 1.30GHz GenuineIntel GNU/Linux
[justin@lapdawg public_html]$ perl -V
Summary of my perl5 (revision 5 version 10 subversion 0) configuration:
Platform:
osname=linux, osvers=2.6.25-arch, archname=i686-linux-thread-multi
uname='linux arch 2.6.25-arch #1 smp preempt thu jul 3 20:29:23
cest 2008 i686 intel(r) core(tm)2 cpu t7200 @ 2.00ghz genuineintel
gnulinux '
config_args='-des -Dusethreads -Doptimize=-march=i686
-mtune=generic -O2 -pipe -Dprefix=/usr -Dinstallprefix=/usr
-Dvendorprefix=/usr -Dprivlib=/usr/share/perl5/core_perl
-Darchlib=/usr/lib/perl5/core_perl
-Dsitelib=/usr/share/perl5/site_perl/5.10.0
-Dsitearch=/usr/lib/perl5/site_perl/5.10.0
-Dvendorlib=/usr/share/perl5/vendor_perl
-Dvendorarch=/usr/lib/perl5/vendor_perl
-Dotherlibdirs=/usr/lib/perl5/current:/usr/lib/perl5/site_perl/current
-Dscriptdir=/usr/bin/perlbin/core -Dsitescript=/usr/bin/perlbin/site
-Dvendorscript=/usr/bin/perlbin/vendor -Dman1ext=1perl
-Dman3ext=3perl'
hint=recommended, useposix=true, d_sigaction=define
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=undef, use64bitall=undef, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing
-pipe -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64',
optimize='-march=i686 -mtune=generic -O2 -pipe',
cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe
-I/usr/local/include'
ccversion='', gccversion='4.3.1 20080626 (prerelease)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
libc=/lib/libc-2.8.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version='2.8'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
cccdlflags='-fPIC', lddlflags='-shared -march=i686 -mtune=generic
-O2 -pipe -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV
PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_ITHREADS
USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API
Built under linux
Compiled at Jul 7 2008 23:01:56
%ENV:
PERL5LIB="/home/justin/lib/perl5:/home/justin/lib/perl5/i686-linux-thread-multi"
@INC:
/home/justin/lib/perl5/i686-linux-thread-multi
/home/justin/lib/perl5
/home/justin/lib/perl5/i686-linux-thread-multi
/usr/lib/perl5/site_perl/5.10.0
/usr/share/perl5/site_perl/5.10.0
/usr/lib/perl5/vendor_perl
/usr/share/perl5/vendor_perl
/usr/share/perl5/vendor_perl
/usr/lib/perl5/core_perl
/usr/share/perl5/core_perl
/usr/lib/perl5/current
/usr/lib/perl5/site_perl/current/i686-linux-thread-multi
/usr/lib/perl5/site_perl/current
.
[justin@lapdawg public_html]$
The module is not installed under my home directory but it is in the
machine-wide location.
I will try to look into the module later to try to trace this, but
quite frankly it is intimidating.
I thought I would report this, but this is not really a big deal
because I have found a workaround:
my $errors;
open my $tmpstderr, '>', \$errors or die "open for temp STDERR: $!";
my $oldstderr = *STDERR;
*STDERR = $tmpstderr;
perltidy(source => \$code, destination => \$tidied,
stderr => \$errors, argv => '-w');
*STDERR = $oldstderr;
close $tmpstderr;
die 'Probably not proper perl code' if($errors);