From 640de3695dc6b9a77793ee3c1c03c5f062906295 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 31 May 2010 12:28:19 -0500 Subject: named args for add_package_symbol --- lib/Package/Stash.pm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'lib/Package/Stash.pm') diff --git a/lib/Package/Stash.pm b/lib/Package/Stash.pm index d3c3071..d632c37 100644 --- a/lib/Package/Stash.pm +++ b/lib/Package/Stash.pm @@ -136,7 +136,7 @@ sub _valid_for_type { } sub add_package_symbol { - my ($self, $variable, $initial_value) = @_; # extra args unpacked below + my ($self, $variable, $initial_value, %opts) = @_; my ($name, $sigil, $type) = ref $variable eq 'HASH' ? @{$variable}{qw[name sigil type]} @@ -150,15 +150,16 @@ sub add_package_symbol { # cheap fail-fast check for PERLDBf_SUBLINE and '&' if ($^P and $^P & 0x10 && $sigil eq '&') { - my (undef, undef, undef, $filename, $firstlinenum, $lastlinenum) = @_; + my $filename = $opts{filename}; + my $first_line_num = $opts{first_line_num}; - (undef, $filename, $firstlinenum) = caller + (undef, $filename, $first_line_num) = caller if not defined $filename; - $lastlinenum = $firstlinenum ||= 0 - if not defined $lastlinenum; + + my $last_line_num = $opts{last_line_num} || ($first_line_num ||= 0); # http://perldoc.perl.org/perldebguts.html#Debugger-Internals - $DB::sub{$pkg . '::' . $name} = "$filename:$firstlinenum-$lastlinenum"; + $DB::sub{$pkg . '::' . $name} = "$filename:$first_line_num-$last_line_num"; } } -- cgit v1.2.3-54-g00ecf