summaryrefslogtreecommitdiff
path: root/regen
diff options
context:
space:
mode:
authorRichard Leach <richardleach@users.noreply.github.com>2022-10-31 21:20:08 +0000
committerYves Orton <demerphq@gmail.com>2023-02-22 12:58:26 +0100
commitb625025e93c87eab6565ea086e7d9c60245d6bd3 (patch)
treefa4bdcaa58cd273f4a8339532387656a42725872 /regen
parentc19e3e4e83b25cf2c13581094e9c56bca2f44e1e (diff)
downloadperl-b625025e93c87eab6565ea086e7d9c60245d6bd3.tar.gz
Prefer scalar assignment to get caller's first return value
Multiple forms of syntax can be used to obtain a package name from `caller`, which emits this as its first return value, and assign that name to a lexical scalar. The following each achieve the same result, but with varying efficiency: * `sub callme { my $package = caller(2); ...}` * `sub callme { my ($package) = caller(2); ...}` * `sub callme { my $package = (caller(2))[0]; ...}` In the first example, `pp_caller` determines only the package name and pushes it to the stack. In the other two examples, the other 10 of `caller`'s return values are calculated and pushed onto the stack, before being discarded. This commit changes non-CPAN-first instances of the latter two forms in core to the first form. Note: There is a special exception to the equivalence described above, when caller is use in list context within the DB package. Such a usage instance in regen/warnings.pl therefore remains unchanged.
Diffstat (limited to 'regen')
-rw-r--r--regen/warnings.pl4
1 files changed, 2 insertions, 2 deletions
diff --git a/regen/warnings.pl b/regen/warnings.pl
index 98e6b6cab9..21ee95d9b1 100644
--- a/regen/warnings.pl
+++ b/regen/warnings.pl
@@ -16,7 +16,7 @@
#
# This script is normally invoked from regen.pl.
-$VERSION = '1.62';
+$VERSION = '1.63';
BEGIN {
require './regen/regen_lib.pl';
@@ -849,7 +849,7 @@ sub __chk
unless defined $offset;
}
else {
- $category = (caller(1))[0] ;
+ $category = caller(1);
$offset = $Offsets{$category};
Croaker("package '$category' not registered for warnings")
unless defined $offset ;