Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c65cb56

Browse files
committed
ParseXS: refactor: OUTPUT_handler() use $line vs $_
This is #1 of a small series of commits to refactor the OUTPUT_handler() method and turn it into a Node subclass method. This series is very similar to the one earlier in this branch which did the same for INPUT_handler(). This commit changes the main loop from using $_ to hold the current line, to using the variable $line instead.
1 parent 46a9935 commit c65cb56

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm

+7-5
Original file line numberDiff line numberDiff line change
@@ -1748,15 +1748,15 @@ sub ST {
17481748
sub OUTPUT_handler {
17491749
my ExtUtils::ParseXS $self = shift;
17501750

1751-
$_ = shift;
1751+
my $line = shift;
17521752

17531753
# In this loop: process each line until the next keyword or end of
17541754
# paragraph
17551755

1756-
for (; !/^$BLOCK_regexp/o; $_ = shift(@{ $self->{line} })) {
1757-
next unless /\S/; # skip blank lines
1756+
for (; $line !~ /^$BLOCK_regexp/o; $line = shift(@{ $self->{line} })) {
1757+
next unless $line =~ /\S/; # skip blank lines
17581758

1759-
if (/^\s*SETMAGIC\s*:\s*(ENABLE|DISABLE)\s*/) {
1759+
if ($line =~ /^\s*SETMAGIC\s*:\s*(ENABLE|DISABLE)\s*/) {
17601760
$self->{xsub_SETMAGIC_state} = ($1 eq "ENABLE" ? 1 : 0);
17611761
next;
17621762
}
@@ -1765,7 +1765,7 @@ sub OUTPUT_handler {
17651765
# SomeVar
17661766
# SomeVar sv_setsv(....);
17671767
#
1768-
my ($outarg, $outcode) = /^\s*(\S+)\s*(.*?)\s*$/s;
1768+
my ($outarg, $outcode) = $line =~ /^\s*(\S+)\s*(.*?)\s*$/s;
17691769

17701770
my ExtUtils::ParseXS::Node::Param $param =
17711771
$self->{xsub_sig}{names}{$outarg};
@@ -1803,6 +1803,8 @@ sub OUTPUT_handler {
18031803

18041804
$param->as_output_code($self);
18051805
} # foreach line in OUTPUT block
1806+
1807+
$_ = $line;
18061808
}
18071809

18081810

0 commit comments

Comments
 (0)