develooper Front page | perl.perl5.porters | Postings from April 2014

[perl #121638] 'Global symbol "$identifier" requires explicit package' error message

Thread Previous
Rob Dixon
April 12, 2014 08:44
[perl #121638] 'Global symbol "$identifier" requires explicit package' error message
Message ID:
# New Ticket Created by  Rob Dixon 
# Please include the string:  [perl #121638]
# in the subject line of all future correspondence about this issue. 
# <URL: >

This is a bug report for perl from,
generated with the help of perlbug 1.39 running under perl 5.16.2.


I believe it is high time that the error

    Global symbol "$identifier" requires explicit package

be changed to something more appropriate. I assume it dates back
to perl 4, as these days it is extremely rare that the problem is
really a missing package name, and vastly more likely that the
variable simply hasn't been declared.

Worst of all it confounds Perl beginners, who are the most likely
audience to be forgetting to declare a variable, as packages and
fully-qualified identifiers are mid-level Perl.

I suggest something more like the simple

    Variable "$identifier" has not been declared

is superior. I don't think there is any need at all to mention
the fact that the problem could also be fixed by fully-qualifying
the identifier, as it is the poorest solution of all, and those
that want to access a variable from a different package but don't
know how to do it wouldn't really be helped much by the current

Site configuration information for perl 5.16.2:

Configured by strawberry-perl at Fri Nov  2 00:34:53 2012.

Summary of my perl5 (revision 5 version 16 subversion 2) configuration:

    osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread
    uname='Win32 strawberry-perl #1 Fri Nov  2 00:33:54 2012 i386'
    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
    cc='gcc', ccflags =' -s -O2 -DWIN32  -DPERL_TEXTMODE_SCRIPTS
    optimize='-s -O2',
    ccversion='', gccversion='4.6.3', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='long
long', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='g++', ldflags ='-s -L"C:\strawberry\perl\lib\CORE"
    libpth=C:\strawberry\c\lib C:\strawberry\c\i686-w64-mingw32\lib
    libs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32
-ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32
-lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32
    perllibs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool
-lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid
-lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32
    libc=, so=dll, useshrplib=true, libperl=libperl516.a
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-mdll -s
-L"C:\strawberry\perl\lib\CORE" -L"C:\strawberry\c\lib"'

Locally applied patches:

@INC for perl 5.16.2:

Environment for perl 5.16.2:
    HOME (unset)
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=C:\Program Files (x86)\ImageMagick-6.8.3-Q16;C:\Program
Files\ImageMagick-6.8.3-Q16;C:\Program Files (x86)\NVIDIA
Corporation\PhysX\Common;C:\Program Files (x86)\PC Connectivity
Solution\;C:\Program Files\Common Files\Microsoft Shared\Windows
Live;C:\Program Files
Files\jEdit;C:\usr\local\ppt\bin;C:\Program Files
(x86)\GnuWin32\bin;C:\Program Files (x86)\Smart
Projects\IsoBuster;C:\Program Files (x86)\Oracle\Berkeley DB 11gR2
5.3.15\bin;C:\Program Files (x86)\Git\cmd;C:\Program Files
(x86)\Bazaar;C:\Program Files (x86)\Lua\5.1;C:\Program Files
Files\TortoiseSVN\bin;C:\MediaInfoCLI;C:\Program Files
(x86)\MKVToolNix;C:\Program Files (x86)\Subversion\bin;C:\Program
Files (x86)\Common Files\Ulead Systems\MPEG;C:\Program Files
(x86)\QuickTime\QTSystem\;C:\Program Files\Microsoft Network Monitor
3\;C:\Program Files\Calibre2\;C:\Program Files (x86)\MySQL\MySQL
Utilities 1.3.4\;C:\Program Files (x86)\Common
Files\Acronis\SnapAPI\;C:\Program Files\WinRAR;C:\Program Files\Common
Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common
Files\Hackety Hack\0.r1529\..;C:\Program Files (x86)\IDM Computer
Solutions\UltraCompare\;C:\ffmpeg\bin;C:\Program Files
(x86)\Serviio\lib;C:\Program Files (x86)\Microsoft Visual Studio
10.0\VC\bin\x86_amd64;C:\Program Files (x86)\Microsoft Visual Studio
Files (x86)\IDM Computer
Solutions\UltraEdit\;C:\LuaRocks\2.0;C:\Program Files
Files (x86)\Nmap;C:\MobiPerl
    PERL_BADLANG (unset)
    SHELL (unset)

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About