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

[perl #68264] Perl generates a spurious "pkg::var" used only once warning

Thread Next
From:
Matthew Kidd
Date:
August 7, 2009 02:30
Subject:
[perl #68264] Perl generates a spurious "pkg::var" used only once warning
Message ID:
rt-3.6.HEAD-2466-1249600786-882.68264-75-0@perl.org
# New Ticket Created by  "Matthew Kidd" 
# Please include the string:  [perl #68264]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=68264 >


This is a bug report for perl from matthew.j.kidd@gmail.com,
generated with the help of perlbug 1.36 running under perl 5.10.0.


-----------------------------------------------------------------
[Please enter your report here]

Perl generates a spurious "pkg::var" used only once warning when
a variable assigned in another package is used only once in a
given package. The "used only once" warning often catches serious
errors where a variable is used before it is assigned, but here
Perl is giving the warning without knowing whether the variable
is used before it is assigned.

Z:> perl -c -w usedonlyonce.pm
Name "main::ROOTDIR" used only once: possible typo at usedonlyonce.pm line
7.
usedonlyonce.pm syntax OK

Here is sample code for usedonlyonce.pm

#!/usr/bin/perl
package usedonlyonce;
use strict;
sub cachePath { return $main::ROOTDIR . '\\' . 'Cache'; }
print cachePath(), "\n";


[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=low
---
Site configuration information for perl 5.10.0:

Configured by SYSTEM at Sun May 24 12:17:14 2009.

Summary of my perl5 (revision 5 version 10 subversion 0) configuration:
  Platform:
    osname=MSWin32, osvers=5.00, archname=MSWin32-x86-multi-thread
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    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='gcc', ccflags ='-DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT
-DHAVE_DES_FCRYP
T -DUSE_SITECUSTOMIZE -DPRIVLIB_LAST_IN_INC -DPERL_IMPLICIT_CONTEXT
-DPERL_IMPLI
CIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX -DHASATTRIBUTE
-fno-strict-aliasing -
mms-bitfields',
    optimize='-O2',
    cppflags='-DWIN32'
    ccversion='', gccversion='3.4.4 (cygming special, gdc 0.12, using dmd
0.125)
', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64',
lseeksi
ze=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='g++', ldflags ='-L"C:\Perl\lib\CORE"'
    libpth=\lib
    libs=-lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32
-lshell32
-lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion
-lodbc32 -
lodbccp32 -lmsvcrt
    perllibs=-lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32
-lshel
l32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion
-lodbc
32 -lodbccp32 -lmsvcrt
    libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl510.lib
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-mdll -L"C:\Perl\lib\CORE"'

Locally applied patches:
    ACTIVEPERL_LOCAL_PATCHES_ENTRY
    f7bbab select() generates 'Invalid parameter' messages on Windows Vista.
    8dc00b fix buffer overflow in win32_select()
    36f064 do/require don't treat '.\foo' or '..\foo' as absolute paths on
Windo
ws
    287a96 fix -p function and Fcntl::S_IFIFO constant under Microsoft VC
compil
er
    406878 avoids segfaults invoking S_raise_signal() (on Linux)
    40c7cc Win32 process ids can have more than 16 bits
    37589e Load 'loadable object' with non-default file extension
    d374f9 64-bit fix for Time::Local

---
@INC for perl 5.10.0:
    C:/Perl/site/lib
    C:/Perl/lib
    .

---
Environment for perl 5.10.0:
    HOME (unset)
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
 
PATH=C:\WINDOWS\system32\;C:\WINDOWS\;C:\WINDOWS\system32\wbem\;c:\bin\;c:\b
in\sysint;C:\Perl\site\bin;C:\Perl\bin;c:\bin\systemtools;c:\program
files\image
magick-6.4.0-q8;c:\cygwin\bin;c:\bin\psutils;c:\bin\support
tools;c:\bin\dheapmo
n;c:\program files\microsoft office\office11\business contact
manager\im\;c:\pro
gram files\microsoft office\office11\business contact manager\;c:\program
files\
microsoft sql server\80\tools\binn\;C:\Program
c:\emacs-21.3\bin;;C:\WINDOWS\sys
tem32\WindowsPowerShell\v1.0;C:\Program
Files\TortoiseSVN\bin;;Y:\Apps\x86;Y:\Ap
ps\x86\BLAST\bin;Y:\Apps\x86\gnuplot\bin;C:\Documents and Settings\kiddm\My
Docu
ments\Eclipse\Perl
    PERL_BADLANG (unset)
    SHELL (unset)


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