summaryrefslogtreecommitdiff
path: root/opcode.h
diff options
context:
space:
mode:
authorAristotle Pagaltzis <pagaltzis@gmx.de>2016-03-02 03:30:30 +0100
committerAristotle Pagaltzis <pagaltzis@gmx.de>2016-03-02 03:30:30 +0100
commit67ba812d5fe08169b8a39cdc1f4945c5e08f32e1 (patch)
tree3dde2d686828c844514ed565d2fd0ea32ab35a26 /opcode.h
parentf24480bcc6bbe9061c0ff1595df8d3eadb2ab8db (diff)
downloadperl-67ba812d5fe08169b8a39cdc1f4945c5e08f32e1.tar.gz
narrow the filename check in strict.pm/warnings.pm
• The code previously assumed that any filename basename besides `strict.pm` meant that the user mistyped `use strict` (e.g. as `use Strict`). But that could just mean the file was not loaded from the filesystem, e.g. due to naïve fatpacking. This is fixed by adding a guard to check that an unexpected value really is a mis-capitalised variant of `strict.pm`. • The code previously insisted on either slash or backslash as the directory separator, which is not strictly portable (though nobody noticed in years; apparently nobody has tried to run a recent-ish on a MacOS Classic or RiscOS system). This is fixed by switching to \b as a best effort, to avoid going down the rabbit hole of platform-specific separators. • The code previously used an `unless` statement, declared lexical variables inside its block, and used ${\EXPR} to interpolate the __PACKAGE__ constant into the regexp. Each of these increases the size of the optree, which is only ever executed once, then sticks around wasting some hundred(s) bytes in almost every single Perl program in the world. This is fixed for warnings.pm by rewriting the code with no use of any temporary variables and single-quoted strings instead of regexp literals. In strict.pm, we can do even better by moving the code to the BEGIN block, since BEGIN CVs are freed after running. (We do not add one to warnings.pm since BEGIN blocks have a creation cost.)
Diffstat (limited to 'opcode.h')
0 files changed, 0 insertions, 0 deletions