Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hash keys are not always parsed as strings if the arrow is omitted #4688

Closed
p5pRT opened this issue Dec 12, 2001 · 13 comments
Closed

Hash keys are not always parsed as strings if the arrow is omitted #4688

p5pRT opened this issue Dec 12, 2001 · 13 comments

Comments

@p5pRT
Copy link
Collaborator

@p5pRT p5pRT commented Dec 12, 2001

Migrated from rt.perl.org#8045 (status was 'resolved')

Searchable as RT8045$

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Dec 12, 2001

From @Abigail

Created by abigail@hermione.osp.nl

  use strict;
  print sub {{colour => "blue"}} -> () {colour}, "\n";

This fails to compile with the message​:

  Bareword "colour" not allowed while "strict subs" in use at q.pl line 2.
  Execution of q.pl aborted due to compilation errors.

There's no problem if we add the optional arrow, or if we quote the
bareword​:

  use strict;
  print sub {{colour => "blue"}} -> () -> {colour}, "\n";

  blue

  use strict;
  print sub {{colour => "blue"}} -> () {"colour"}, "\n";

  blue

The same happens in 5.6.1.

Perl Info

Flags:
    category=core
    severity=medium

Site configuration information for perl v5.7.2:

Configured by abigail at Fri Nov 23 17:03:17 CET 2001.

Summary of my perl5 (revision 5.0 version 7 subversion 2 patch 13197) configuration:
  Platform:
    osname=linux, osvers=2.4.5, archname=i686-linux-64int-ld
    uname='linux hermione 2.4.5 #6 fri jun 22 01:38:20 pdt 2001 i686 unknown '
    config_args='-Doptimize=-g -Dusedevel -Duse64bitall -Dusemorebits -Uversiononly -des -Dprefix=/opt/bleadperl'
    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=define
    usemymalloc=n, bincompat5005=define
  Compiler:
    cc='cc', ccflags ='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include -I/opt/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-g',
    cppflags='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include -I/opt/local/include'
    ccversion='', gccversion='2.95.3 20010315 (release)', 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='long double', nvsize=12, Off_t='off_t', lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib -L/opt/local/lib'
    libpth=/usr/local/lib /opt/local/lib /lib /usr/lib
    libs=-lnsl -lndbm -lgdbm -ldl -lm -lc -lcrypt -lutil
    perllibs=-lnsl -ldl -lm -lc -lcrypt -lutil
    libc=/lib/libc-2.2.3.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib -L/opt/local/lib'

Locally applied patches:
    DEVEL13165


@INC for perl v5.7.2:
    /home/abigail/Perl
    /home/abigail/Sybase
    /opt/bleadperl/lib/5.7.2/i686-linux-64int-ld
    /opt/bleadperl/lib/5.7.2
    /opt/bleadperl/lib/site_perl/5.7.2/i686-linux-64int-ld
    /opt/bleadperl/lib/site_perl/5.7.2
    /opt/bleadperl/lib/site_perl
    .


Environment for perl v5.7.2:
    HOME=/home/abigail
    LANG (unset)
    LANGUAGE (unset)
    LC_ALL=POSIX
    LD_LIBRARY_PATH=/home/abigail/Lib:/usr/local/lib:/usr/lib:/lib:/usr/X11R6/lib:/opt/gnome/lib
    LOGDIR (unset)
    PATH=/home/abigail/Bin:/opt/perl/bin:/usr/local/bin:/usr/local/X11/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/X11R6/bin:/usr/games:/opt/povray/bin:/opt/gnome/bin:/opt/opera/bin:/usr/share/texmf/bin:/opt/Acrobat4/bin:/opt/java/blackdown/j2sdk1.3.1/bin:/usr/local/games/bin:/opt/gnuplot/bin
    PERL5LIB=/home/abigail/Perl:/home/abigail/Sybase
    PERLDIR=/opt/perl
    PERL_BADLANG (unset)
    SHELL=/usr/bin/bash


@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Apr 21, 2010

From pepe@cpan.org

This is a bug report for perl from pepe@​cpan.org,
generated with the help of perlbug 1.39 running under perl 5.10.1.


Hi,

$ perl -lwe 'my $foo = sub { return {xyz => 42}; }; print $foo->()->{xyz}'
42

$ perl -lwe 'my $foo = sub { return {xyz => 42}; }; print $foo->(){xyz}'
Unquoted string "xyz" may clash with future reserved word at -e line 1.
42

$ perl -lwe 'my $foo = sub { return {length => 42}; }; print $foo->()->{length}'
42

$ perl -lwe 'my $foo = sub { return {length => 42}; }; print $foo->(){length}'
Use of uninitialized value $_ in length at -e line 1.
Use of uninitialized value in print at -e line 1.
[empty output line]

In the second and fourth line, the arrow between "()" and "{...}" was omitted.
Somehow this seems to make perl treat the hash key as a bareword​: If it is a
known bareword like "length", it is not treated as a string; if it is an
unknown bareword like "xyz", a warning is shown.

I would think that hash keys in curlies are always parsed as strings,
regardless of the omitting of the arrow. So I'd expect example 4 to
print 42 just like the other ones, and I'd expect none of these examples
to print any warnings.

perlref says​:

  Similarly, because of all the subscripting that is done using single words, we've
  applied the same rule to any bareword that is used for subscripting a hash. So
  now, instead of writing

  $array{ "aaa" }{ "bbb" }{ "ccc" }

  you can write just

  $array{ aaa }{ bbb }{ ccc }

  and not worry about whether the subscripts are reserved words.

While () is not a real subscript, this is no reason to treat the
barewords differently, imho.

Cheers,
Christoph



Flags​:
  category=core
  severity=low


Site configuration information for perl 5.10.1​:

Configured by Debian Project at Sun Feb 7 13​:06​:31 UTC 2010.

Summary of my perl5 (revision 5 version 10 subversion 1) configuration​:
 
  Platform​:
  osname=linux, osvers=2.6.32-trunk-amd64, archname=x86_64-linux-gnu-thread-multi
  uname='linux madeleine 2.6.32-trunk-amd64 #1 smp sun jan 10 22​:40​:40 utc 2010 x86_64 gnulinux '
  config_args='-Dusethreads -Duselargefiles -Dccflags=-DDEBIAN -Dcccdlflags=-fPIC -Darchname=x86_64-linux-gnu -Dprefix=/usr -Dprivlib=/usr/share/perl/5.10 -Darchlib=/usr/lib/perl/5.10 -Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5 -Dvendorarch=/usr/lib/perl5 -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl/5.10.1 -Dsitearch=/usr/local/lib/perl/5.10.1 -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dsiteman1dir=/usr/local/man/man1 -Dsiteman3dir=/usr/local/man/man3 -Dman1ext=1 -Dman3ext=3perl -Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Ud_ualarm -Uusesfio -Uusenm -DDEBUGGING=-g -Doptimize=-O2 -Duseshrplib -Dlibperl=libperl.so.5.10.1 -Dd_dosuid -des'
  hint=recommended, useposix=true, d_sigaction=define
  useithreads=define, usemultiplicity=define
  useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
  use64bitint=define, use64bitall=define, uselongdouble=undef
  usemymalloc=n, bincompat5005=undef
  Compiler​:
  cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
  optimize='-O2 -g',
  cppflags='-D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
  ccversion='', gccversion='4.4.3', gccosandvers=''
  intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
  d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
  ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
  alignbytes=8, prototype=define
  Linker and Libraries​:
  ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
  libpth=/usr/local/lib /lib /usr/lib /lib64 /usr/lib64
  libs=-lgdbm -lgdbm_compat -ldb -ldl -lm -lpthread -lc -lcrypt
  perllibs=-ldl -lm -lpthread -lc -lcrypt
  libc=/lib/libc-2.10.2.so, so=so, useshrplib=true, libperl=libperl.so.5.10.1
  gnulibc_version='2.10.2'
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
  cccdlflags='-fPIC', lddlflags='-shared -O2 -g -L/usr/local/lib -fstack-protector'

Locally applied patches​:
  DEBPKG​:debian/arm_thread_stress_timeout - http​://bugs.debian.org/501970 Raise the timeout of ext/threads/shared/t/stress.t to accommodate slower build hosts
  DEBPKG​:debian/cpan_config_path - Set location of CPAN​::Config to /etc/perl as /usr may not be writable.
  DEBPKG​:debian/cpan_definstalldirs - Provide a sensible INSTALLDIRS default for modules installed from CPAN.
  DEBPKG​:debian/db_file_ver - http​://bugs.debian.org/340047 Remove overly restrictive DB_File version check.
  DEBPKG​:debian/doc_info - Replace generic man(1) instructions with Debian-specific information.
  DEBPKG​:debian/enc2xs_inc - http​://bugs.debian.org/290336 Tweak enc2xs to follow symlinks and ignore missing @​INC directories.
  DEBPKG​:debian/errno_ver - http​://bugs.debian.org/343351 Remove Errno version check due to upgrade problems with long-running processes.
  DEBPKG​:debian/extutils_hacks - Various debian-specific ExtUtils changes
  DEBPKG​:debian/fakeroot - Postpone LD_LIBRARY_PATH evaluation to the binary targets.
  DEBPKG​:debian/instmodsh_doc - Debian policy doesn't install .packlist files for core or vendor.
  DEBPKG​:debian/ld_run_path - Remove standard libs from LD_RUN_PATH as per Debian policy.
  DEBPKG​:debian/libnet_config_path - Set location of libnet.cfg to /etc/perl/Net as /usr may not be writable.
  DEBPKG​:debian/m68k_thread_stress - http​://bugs.debian.org/495826 Disable some threads tests on m68k for now due to missing TLS.
  DEBPKG​:debian/mod_paths - Tweak @​INC ordering for Debian
  DEBPKG​:debian/module_build_man_extensions - http​://bugs.debian.org/479460 Adjust Module​::Build manual page extensions for the Debian Perl policy
  DEBPKG​:debian/perl_synopsis - http​://bugs.debian.org/278323 Rearrange perl.pod
  DEBPKG​:debian/prune_libs - http​://bugs.debian.org/128355 Prune the list of libraries wanted to what we actually need.
  DEBPKG​:debian/use_gdbm - Explicitly link against -lgdbm_compat in ODBM_File/NDBM_File.
  DEBPKG​:fixes/assorted_docs - http​://bugs.debian.org/443733 [384f06a] Math​::BigInt​::CalcEmu documentation grammar fix
  DEBPKG​:fixes/net_smtp_docs - http​://bugs.debian.org/100195 [rt.cpan.org #36038] Document the Net​::SMTP 'Port' option
  DEBPKG​:fixes/processPL - http​://bugs.debian.org/357264 [rt.cpan.org #17224] Always use PERLRUNINST when building perl modules.
  DEBPKG​:debian/perlivp - http​://bugs.debian.org/510895 Make perlivp skip include directories in /usr/local
  DEBPKG​:fixes/pod2man-index-backslash - http​://bugs.debian.org/521256 Escape backslashes in .IX entries
  DEBPKG​:debian/disable-zlib-bundling - Disable zlib bundling in Compress​::Raw​::Zlib
  DEBPKG​:fixes/kfreebsd_cppsymbols - http​://bugs.debian.org/533098 [3b910a0] Add gcc predefined macros to $Config{cppsymbols} on GNU/kFreeBSD.
  DEBPKG​:debian/cpanplus_definstalldirs - http​://bugs.debian.org/533707 Configure CPANPLUS to use the site directories by default.
  DEBPKG​:debian/cpanplus_config_path - Save local versions of CPANPLUS​::Config​::System into /etc/perl.
  DEBPKG​:fixes/kfreebsd-filecopy-pipes - http​://bugs.debian.org/537555 [16f708c] Fix File​::Copy​::copy with pipes on GNU/kFreeBSD
  DEBPKG​:fixes/anon-tmpfile-dir - http​://bugs.debian.org/528544 [perl #66452] Honor TMPDIR when open()ing an anonymous temporary file
  DEBPKG​:fixes/abstract-sockets - http​://bugs.debian.org/329291 [89904c0] Add support for Abstract namespace sockets.
  DEBPKG​:fixes/hurd_cppsymbols - http​://bugs.debian.org/544307 [eeb92b7] Add gcc predefined macros to $Config{cppsymbols} on GNU/Hurd.
  DEBPKG​:fixes/autodie-flock - http​://bugs.debian.org/543731 Allow for flock returning EAGAIN instead of EWOULDBLOCK on linux/parisc
  DEBPKG​:fixes/archive-tar-instance-error - http​://bugs.debian.org/539355 [rt.cpan.org #48879] Separate Archive​::Tar instance error strings from each other
  DEBPKG​:fixes/positive-gpos - http​://bugs.debian.org/545234 [perl #69056] [c584a96] Fix \\G crash on first match
  DEBPKG​:debian/devel-ppport-ia64-optim - http​://bugs.debian.org/548943 Work around an ICE on ia64
  DEBPKG​:debian/dynaloader-config - http​://bugs.debian.org/549170 Make DynaLoader work without Config_heavy.pl again
  DEBPKG​:fixes/trie-logic-match - http​://bugs.debian.org/552291 [perl #69973] [0abd0d7] Fix a DoS in Unicode processing [CVE-2009-3626]
  DEBPKG​:fixes/hppa-thread-eagain - http​://bugs.debian.org/554218 make the threads-shared test suite more robust, fixing failures on hppa
  DEBPKG​:fixes/crash-on-undefined-destroy - http​://bugs.debian.org/564074 [perl #71952] [1f15e67] Fix a NULL pointer dereference when looking for a DESTROY method
  DEBPKG​:patchlevel - http​://bugs.debian.org/567489 List packaged patches for 5.10.1-11 in patchlevel.h


@​INC for perl 5.10.1​:
  /home/pepe/root/perl/lib/perl/5.10.1
  /home/pepe/root/perl/share/perl/5.10.1
  /home/pepe/root/perl/lib/perl/5.10.1
  /home/pepe/root/perl/lib/perl
  /home/pepe/root/perl/lib/perl5/x86_64-linux-gnu-thread-multi
  /home/pepe/root/perl/lib/perl5
  /home/pepe/root/perl/share/perl/5.10.1
  /home/pepe/root/perl/share/perl
  /etc/perl
  /usr/local/lib/perl/5.10.1
  /usr/local/share/perl/5.10.1
  /usr/lib/perl5
  /usr/share/perl5
  /usr/lib/perl/5.10
  /usr/share/perl/5.10
  /usr/local/lib/site_perl
  .


Environment for perl 5.10.1​:
  HOME=/home/pepe
  LANG=en_US.UTF-8
  LANGUAGE=en_US​:en
  LD_LIBRARY_PATH (unset)
  LOGDIR (unset)
  PATH=/home/pepe/.bin​:/usr/local/bin​:/usr/bin​:/bin​:/usr/bin/X11​:/usr/games
  PERL5LIB=/home/pepe/root/perl/lib/perl/5.10.1​:/home/pepe/root/perl/share/perl/5.10.1​:/home/pepe/root/perl/lib/perl​:/home/pepe/root/perl/lib/perl5​:/home/pepe/root/perl/share/perl
  PERL_BADLANG (unset)
  SHELL=/bin/bash

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Apr 22, 2010

From @Abigail

On Wed, Apr 21, 2010 at 08​:26​:08AM -0700, Christoph Bussenius wrote​:

# New Ticket Created by Christoph Bussenius
# Please include the string​: [perl #74554]
# in the subject line of all future correspondence about this issue.
# <URL​: http​://rt.perl.org/rt3/Ticket/Display.html?id=74554 >

This is a bug report for perl from pepe@​cpan.org,
generated with the help of perlbug 1.39 running under perl 5.10.1.

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

Hi,

$ perl -lwe 'my $foo = sub { return {xyz => 42}; }; print $foo->()->{xyz}'
42

$ perl -lwe 'my $foo = sub { return {xyz => 42}; }; print $foo->(){xyz}'
Unquoted string "xyz" may clash with future reserved word at -e line 1.
42

$ perl -lwe 'my $foo = sub { return {length => 42}; }; print $foo->()->{length}'
42

$ perl -lwe 'my $foo = sub { return {length => 42}; }; print $foo->(){length}'
Use of uninitialized value $_ in length at -e line 1.
Use of uninitialized value in print at -e line 1.
[empty output line]

This is a duplicate of #8045, which has been open since 2001.

Abigail

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Apr 22, 2010

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Jun 12, 2013

From rob.dixon@gmx.com

This is a bug report for perl from rob.dixon@​gmx.com,
generated with the help of perlbug 1.39 running under perl 5.16.2.

use strict;
use warnings;
use 5.016;

my $hashsub = sub {
  { key => 'val' }
};

# These work fine

print $hashsub->()->{key}, "\n";
print $hashsub->(){'key'}, "\n";

# But this throws `Bareword "key" not allowed while "strict subs" in use`

print $hashsub->(){key}, "\n";


Flags​:
  category=core
  severity=medium


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​:
  Platform​:
  osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread
  uname='Win32 strawberry-perl 5.16.2.1 #1 Fri Nov 2 00​:33​:54 2012 i386'
  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 =' -s -O2 -DWIN32 -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fno-strict-aliasing -mms-bitfields',
  optimize='-s -O2',
  cppflags='-DWIN32'
  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" -L"C​:\strawberry\c\lib"'
  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
  gnulibc_version=''
  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​:
  C​:/strawberry/perl/site/lib/MSWin32-x86-multi-thread
  C​:/strawberry/perl/site/lib
  C​:/strawberry/perl/vendor/lib
  C​:/strawberry/perl/lib
  .


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 (x86)\PHP\;C​:\Windows\system32;C​:\Windows;C​:\Windows\System32\Wbem;C​:\Windows\System32\WindowsPowerShell\v1.0\;C​:\Program 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)\Calibre2\;C​:\Program Files (x86)\Bazaar;C​:\Program Files (x86)\Lua\5.1;C​:\Program Files (x86)\Lua\5.1\clibs;C​:\strawberry\c\bin;C​:\strawberry\perl\site\bin;C​:\strawberry\perl\bin;C​:\Program Files\TortoiseSVN\bin;C​:\MediaInfoCLI;C​:\Program Files (x86)\MKVToolNix;C​:\Program Files\WinRAR;C​:\Program Files\Common Files\Microsoft Shared\Windows Live;C​:\Program Files (x86)\Co
mmon 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 10.0\VC\bin\amd64;C​:\SWIG;C​:\MinGW\bin;C​:\MinGW\MSYS\1.0\bin;C​:\Python27;C​:\Curl;C​:\pkg-config\bin;C​:\glib\bin;C​:\gettext-runtime\bin;C​:\Program Files (x86)\IDM Computer Solutions\UltraEdit\;C​:\LuaRocks\2.0;C​:\Program Files (x86)\Android\android-sdk\platform-tools;C​:\Ruby193\bin;C​:\Ruby193.DevKit\bin;C​:\Program Files (x86)\Nmap;C​:\Program Files (x86)\EaseUS\Todo Backup\bin\x64\
  PERL_BADLANG (unset)
  SHELL (unset)


Flags​:
  category=core
  severity=medium


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​:
  Platform​:
  osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread
  uname='Win32 strawberry-perl 5.16.2.1 #1 Fri Nov 2 00​:33​:54 2012 i386'
  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 =' -s -O2 -DWIN32 -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fno-strict-aliasing -mms-bitfields',
  optimize='-s -O2',
  cppflags='-DWIN32'
  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" -L"C​:\strawberry\c\lib"'
  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
  gnulibc_version=''
  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​:
  C​:/strawberry/perl/site/lib/MSWin32-x86-multi-thread
  C​:/strawberry/perl/site/lib
  C​:/strawberry/perl/vendor/lib
  C​:/strawberry/perl/lib
  .


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 (x86)\PHP\;C​:\Windows\system32;C​:\Windows;C​:\Windows\System32\Wbem;C​:\Windows\System32\WindowsPowerShell\v1.0\;C​:\Program 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)\Calibre2\;C​:\Program Files (x86)\Bazaar;C​:\Program Files (x86)\Lua\5.1;C​:\Program Files (x86)\Lua\5.1\clibs;C​:\strawberry\c\bin;C​:\strawberry\perl\site\bin;C​:\strawberry\perl\bin;C​:\Program Files\TortoiseSVN\bin;C​:\MediaInfoCLI;C​:\Program Files (x86)\MKVToolNix;C​:\Program Files\WinRAR;C​:\Program Files\Common Files\Microsoft Shared\Windows Live;C​:\Program Files (x86)\Co
mmon 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 10.0\VC\bin\amd64;C​:\SWIG;C​:\MinGW\bin;C​:\MinGW\MSYS\1.0\bin;C​:\Python27;C​:\Curl;C​:\pkg-config\bin;C​:\glib\bin;C​:\gettext-runtime\bin;C​:\Program Files (x86)\IDM Computer Solutions\UltraEdit\;C​:\LuaRocks\2.0;C​:\Program Files (x86)\Android\android-sdk\platform-tools;C​:\Ruby193\bin;C​:\Ruby193.DevKit\bin;C​:\Program Files (x86)\Nmap;C​:\Program Files (x86)\EaseUS\Todo Backup\bin\x64\;C​:\Program Files (x86)\TextPad 6
  PERL_BADLANG (unset)
  SHELL (unset)

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Jun 12, 2013

From @jkeenan

On Wed Jun 12 09​:49​:51 2013, rob.dixon@​gmx.com wrote​:

This is a bug report for perl from rob.dixon@​gmx.com,
generated with the help of perlbug 1.39 running under perl 5.16.2.

use strict;
use warnings;
use 5.016;

Problem confirmed, but it should be noted that 'use 5.016;' can be
commented out without preventing the problem from manifesting.

my $hashsub = sub {
{ key => 'val' }
};

# These work fine

print $hashsub->()->{key}, "\n";
print $hashsub->(){'key'}, "\n";

# But this throws `Bareword "key" not allowed while "strict subs" in
use`

print $hashsub->(){key}, "\n";

---
Flags​:
category=core
severity=medium
---
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​:
Platform​:
osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread
uname='Win32 strawberry-perl 5.16.2.1 #1 Fri Nov 2 00​:33​:54 2012
i386'
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 =' -s -O2 -DWIN32 -DPERL_TEXTMODE_SCRIPTS
-DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fno-strict-aliasing
-mms-bitfields',
optimize='-s -O2',
cppflags='-DWIN32'
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"
-L"C​:\strawberry\c\lib"'
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
gnulibc_version=''
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​:
C​:/strawberry/perl/site/lib/MSWin32-x86-multi-thread
C​:/strawberry/perl/site/lib
C​:/strawberry/perl/vendor/lib
C​:/strawberry/perl/lib
.

---
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

(x86)\PHP\;C​:\Windows\system32;C​:\Windows;C​:\Windows\System32\Wbem;C​:\Windows\System32\WindowsPowerShell\v1.0\;C​:\Program

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)\Calibre2\;C​:\Program Files (x86)\Bazaar;C​:\Program Files
(x86)\Lua\5.1;C​:\Program Files

(x86)\Lua\5.1\clibs;C​:\strawberry\c\bin;C​:\strawberry\perl\site\bin;C​:\strawberry\perl\bin;C​:\Program

Files\TortoiseSVN\bin;C​:\MediaInfoCLI;C​:\Program Files
(x86)\MKVToolNix;C​:\Program Files\WinRAR;C​:\Program Files\Common
Files\Microsoft Shared\Windows Live;C​:\Program Files (x86)\Co
mmon 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

10.0\VC\bin\amd64;C​:\SWIG;C​:\MinGW\bin;C​:\MinGW\MSYS\1.0\bin;C​:\Python27;C​:\Curl;C​:\pkg-

config\bin;C​:\glib\bin;C​:\gettext-runtime\bin;C​:\Program Files
(x86)\IDM Computer Solutions\UltraEdit\;C​:\LuaRocks\2.0;C​:\Program
Files (x86)\Android\android-sdk\platform-
tools;C​:\Ruby193\bin;C​:\Ruby193.DevKit\bin;C​:\Program Files
(x86)\Nmap;C​:\Program Files (x86)\EaseUS\Todo Backup\bin\x64\
PERL_BADLANG (unset)
SHELL (unset)
---
Flags​:
category=core
severity=medium
---
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​:
Platform​:
osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread
uname='Win32 strawberry-perl 5.16.2.1 #1 Fri Nov 2 00​:33​:54 2012
i386'
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 =' -s -O2 -DWIN32 -DPERL_TEXTMODE_SCRIPTS
-DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fno-strict-aliasing
-mms-bitfields',
optimize='-s -O2',
cppflags='-DWIN32'
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"
-L"C​:\strawberry\c\lib"'
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
gnulibc_version=''
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​:
C​:/strawberry/perl/site/lib/MSWin32-x86-multi-thread
C​:/strawberry/perl/site/lib
C​:/strawberry/perl/vendor/lib
C​:/strawberry/perl/lib
.

---
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

(x86)\PHP\;C​:\Windows\system32;C​:\Windows;C​:\Windows\System32\Wbem;C​:\Windows\System32\WindowsPowerShell\v1.0\;C​:\Program

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)\Calibre2\;C​:\Program Files (x86)\Bazaar;C​:\Program Files
(x86)\Lua\5.1;C​:\Program Files

(x86)\Lua\5.1\clibs;C​:\strawberry\c\bin;C​:\strawberry\perl\site\bin;C​:\strawberry\perl\bin;C​:\Program

Files\TortoiseSVN\bin;C​:\MediaInfoCLI;C​:\Program Files
(x86)\MKVToolNix;C​:\Program Files\WinRAR;C​:\Program Files\Common
Files\Microsoft Shared\Windows Live;C​:\Program Files (x86)\Co
mmon 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

10.0\VC\bin\amd64;C​:\SWIG;C​:\MinGW\bin;C​:\MinGW\MSYS\1.0\bin;C​:\Python27;C​:\Curl;C​:\pkg-

config\bin;C​:\glib\bin;C​:\gettext-runtime\bin;C​:\Program Files
(x86)\IDM Computer Solutions\UltraEdit\;C​:\LuaRocks\2.0;C​:\Program
Files (x86)\Android\android-sdk\platform-
tools;C​:\Ruby193\bin;C​:\Ruby193.DevKit\bin;C​:\Program Files
(x86)\Nmap;C​:\Program Files (x86)\EaseUS\Todo
Backup\bin\x64\;C​:\Program Files (x86)\TextPad 6
PERL_BADLANG (unset)
SHELL (unset)

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Jun 12, 2013

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Jun 13, 2013

From @cpansprout

On Wed Jun 12 09​:49​:51 2013, rob.dixon@​gmx.com wrote​:

This is a bug report for perl from rob.dixon@​gmx.com,
generated with the help of perlbug 1.39 running under perl 5.16.2.

use strict;
use warnings;
use 5.016;

my $hashsub = sub {
{ key => 'val' }
};

# These work fine

print $hashsub->()->{key}, "\n";
print $hashsub->(){'key'}, "\n";

# But this throws `Bareword "key" not allowed while "strict subs" in
use`

print $hashsub->(){key}, "\n";

Thank you for the report. BTW, this is a duplicate of #8045.

--

Father Chrysostomos

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Jan 16, 2018

From zefram@fysh.org

For this problem to occur, it is not sufficient that the arrow preceding
the open brace is omitted. It is also necessary that the preceding
subscript be of parenthesised type, as opposed to being in square brackets
or braces. The problem is that PL_expect is set incorrectly in the
"){" case. In addition to losing bareword autoquoting, this also screws
up PL_expect after the close brace, breaking recognition of operators​:

$ perl -lwe '$a = sub { +{a=>5} }; print $a->(){"a"} - 1'
syntax error at -e line 1, near "} -"
Execution of -e aborted due to compilation errors.

This dates right back to the introduction of arrow-omitted syntax in
commit fad39ff, which naturally added
no tests.

I've fixed it in commit 097ff42.

-zefram

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Jan 16, 2018

From @jkeenan

I have confirmed that the posters' examples now work as intended. Resolving ticket pending release.

Thank you very much.

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Jan 16, 2018

@jkeenan - Status changed from 'open' to 'pending release'

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Jun 23, 2018

From @khwilliamson

Thank you for filing this report. You have helped make Perl better.

With the release yesterday of Perl 5.28.0, this and 185 other issues have been
resolved.

Perl 5.28.0 may be downloaded via​:
https://metacpan.org/release/XSAWYERX/perl-5.28.0

If you find that the problem persists, feel free to reopen this ticket.

@p5pRT p5pRT closed this Jun 23, 2018
@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Jun 23, 2018

@khwilliamson - Status changed from 'pending release' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.