develooper Front page | perl.perl5.porters | Postings from January 2009

[perl #62234] Incorrect behaivour of syntax warning.

Thread Next
From:
perlbug-followup
Date:
January 12, 2009 15:53
Subject:
[perl #62234] Incorrect behaivour of syntax warning.
Message ID:
rt-3.6.HEAD-24371-1231764062-1855.62234-75-0@perl.org
# New Ticket Created by  sp@smartspb.net 
# Please include the string:  [perl #62234]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=62234 >



This is a bug report for perl from sp@smartspb.net,
generated with the help of perlbug 1.35 running under perl v5.8.5.

Syntax warning:

``Name "Com::elem" used only once: possible typo at Foo.pm line 6.''

is only available when directly compiling Foo.pm (``perl -w -c Foo.pm'')

If Foo.pm is "use"-ed (required, eval require, etc) by
other module this warning not shown, $@ not set after
eval, $SIG{__WARN__} not called, and you cannot detect
problem "simply".

This is not convenient when making dynamically
"eval 'require Foo';" modules (plug-ins) with diagnostic.

I tested the following versions of Perl:

5.6.1, 5.8.5, 5.8.8 FreeBSD 5.x-6.x;
5.10.0 Windows XP, ActiveState.

How to reproduce:

Create files Foo.pm and Bar.pm in the same directory and execute:

perl -I. -w -c Foo.pm
perl -I. -w -c Bar.pm

--- Foo.pm ---
package Foo;
use strict;
use warnings;
sub foo {
  print($Com::elem, " bar\n");
}
1;
--- Bar.pm ---
package Bar;
use strict;
use warnings;
use Foo;
sub bar {
  print("bar!!\n");
}
1;
--- Results of compilation ---

$ perl -I. -w -c Foo.pm
Name "Com::elem" used only once: possible typo at Foo.pm line 6.
Foo.pm syntax OK
$
$ perl -I. -w -c Bar.pm
Bar.pm syntax OK
$

------------------------------


---
Flags:
    category=core
    severity=none
---
Site configuration information for perl v5.8.5:

Configured by sp at Wed Dec 29 12:55:58 MSK 2004.

Summary of my perl5 (revision 5 version 8 subversion 5) configuration:
  Platform:
    osname=freebsd, osvers=5.3-release-p2, archname=i386-freebsd-64int
    uname='freebsd gra.smartspb.net 5.3-release-p2 freebsd 5.3-release-p2 #0: mon dec 20 12:29:30 msk 2004 amil@gra.smartspb.net:usrobjusrsrcsysstat i386 '
    config_args='-sde -Dprefix=/usr/local -Darchlib=/usr/local/lib/perl5/5.8.5/mach -Dprivlib=/usr/local/lib/perl5/5.8.5 -Dman3dir=/usr/local/lib/perl5/5.8.5/perl/man/man3 -Dman1dir=/usr/local/man/man1 -Dsitearch=/usr/local/lib/perl5/site_perl/5.8.5/mach -Dsitelib=/usr/local/lib/perl5/site_perl/5.8.5 -Dscriptdir=/usr/local/bin -Dsiteman3dir=/usr/local/lib/perl5/5.8.5/man/man3 -Dsiteman1dir=/usr/local/man/man1 -Ui_malloc -Ui_iconv -Uinstallusrbinperl -Dcc=cc -Doptimize=-O -pipe  -Duseshrplib -Dccflags=-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.5/BSDPAN" -Ud_dosuid -Ui_gdbm -Dusethreads=n -Dusemymalloc=y -Duse64bitint'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=define use64bitall=undef uselongdouble=undef
    usemymalloc=y, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.5/BSDPAN" -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -I/usr/local/include',
    optimize='-O -pipe ',
    cppflags='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.5/BSDPAN" -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -I/usr/local/include'
    ccversion='', gccversion='3.4.2 [FreeBSD] 20040728', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='cc', ldflags ='-Wl,-E  -L/usr/local/lib'
    libpth=/usr/lib /usr/local/lib
    libs=-lm -lcrypt -lutil -lc
    perllibs=-lm -lcrypt -lutil -lc
    libc=, so=so, useshrplib=true, libperl=libperl.so
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='  -Wl,-R/usr/local/lib/perl5/5.8.5/mach/CORE'
    cccdlflags='-DPIC -fPIC', lddlflags='-shared  -L/usr/local/lib'

Locally applied patches:
    

---
@INC for perl v5.8.5:
    /usr/local/lib/perl5/site_perl/5.8.5/mach
    /usr/local/lib/perl5/site_perl/5.8.5
    /usr/local/lib/perl5/site_perl
    /usr/local/lib/perl5/5.8.5/BSDPAN
    /usr/local/lib/perl5/5.8.5/mach
    /usr/local/lib/perl5/5.8.5
    .

---
Environment for perl v5.8.5:
    HOME=/root
    LANG=ru_RU.KOI8-R
    LANGUAGE (unset)
    LC_ALL=ru_RU.KOI8-R
    LC_COLLATE=ru_RU.KOI8-R
    LC_CTYPE=ru_RU.KOI8-R
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:/usr/local/sbin
    PERL_BADLANG (unset)
    SHELL=/bin/bash


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About