Bug#931418: perl: no errors with strict subs and bareword following a minus operator
Vincent Lefevre
vincent at vinc17.net
Thu Jul 4 13:10:22 BST 2019
Package: perl
Version: 5.28.1-6
Severity: normal
The following does no yield any error:
perl -e 'use strict; my $x = - Inf;'
This does not seem to be intended.
The strict(3perl) man page says:
"strict subs"
This disables the poetry optimization, generating a compile-time
error if you try to use a bareword identifier that's not a
subroutine, unless it is a simple identifier (no colons) and that
it appears in curly braces or on the left hand side of the "=>"
symbol.
use strict 'subs';
$SIG{PIPE} = Plumber; # blows up
$SIG{PIPE} = "Plumber"; # fine: quoted string is always ok
$SIG{PIPE} = \&Plumber; # preferred form
and the perldata(1) man page says:
Some people may wish to outlaw barewords entirely. If you say
use strict 'subs';
then any bareword that would NOT be interpreted as a subroutine call
produces a compile-time error instead. [...]
There does not seem to be an exception after a minus operator.
-- System Information:
Debian Release: 10.0
APT prefers unstable-debug
APT policy: (500, 'unstable-debug'), (500, 'stable-updates'), (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.19.0-5-amd64 (SMP w/12 CPU cores)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=POSIX, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=POSIX (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages perl depends on:
ii dpkg 1.19.7
ii libperl5.28 5.28.1-6
ii perl-base 5.28.1-6
ii perl-modules-5.28 5.28.1-6
Versions of packages perl recommends:
ii netbase 5.6
Versions of packages perl suggests:
pn libb-debug-perl <none>
pn liblocale-codes-perl <none>
pn libterm-readline-gnu-perl | libterm-readline-perl-perl <none>
ii make 4.2.1-1.2
ii perl-doc 5.28.1-6
-- no debconf information
More information about the Perl-maintainers
mailing list