| 1 | package | ||||||||||
| 2 | XS::Install::FrozenShit::ParseXS::CountLines; | ||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 1 | our $VERSION = '3.57'; | |||||||||
| 6 | |||||||||||
| 7 | 1 | our $SECTION_END_MARKER; | |||||||||
| 8 | |||||||||||
| 9 | 1 | ▶ | sub TIEHANDLE { | ||||||||
|
Subroutine
TIEHANDLE: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 1 | my ($class, $cfile, $fh) = @_; | |||||||||
| 11 | 1 | $cfile =~ s/\\/\\\\/g; | |||||||||
| 12 | 1 | $cfile =~ s/"/\\"/g; | |||||||||
| 13 | 1 | $SECTION_END_MARKER = qq{#line --- "$cfile"}; | |||||||||
| 14 | |||||||||||
| 15 | 1 | return bless { | |||||||||
| 16 | buffer => '', | ||||||||||
| 17 | fh => $fh, | ||||||||||
| 18 | line_no => 1, | ||||||||||
| 19 | }, $class; | ||||||||||
| 20 | } | ||||||||||
| 21 | |||||||||||
| 22 | 321 | ▶ | sub PRINT { | ||||||||
|
Subroutine
PRINT: called CC=3 SCAR=11.0
| |||||||||||
| 23 | 321 | my $self = shift; | |||||||||
| 24 | 321 | for (@_) { | |||||||||
| 25 | 368 | $self->{buffer} .= $_; | |||||||||
| 26 | 368 | ▶ | while ($self->{buffer} =~ s/^([^\n]*\n)//) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | 548 | my $line = $1; | |||||||||
| 28 | 548 | ++$self->{line_no}; | |||||||||
| 29 | 548 | $line =~ s|^\#line\s+---(?=\s)|#line $self->{line_no}|; | |||||||||
| 30 | 548 | print {$self->{fh}} $line; | |||||||||
| 31 | } | ||||||||||
| 32 | } | ||||||||||
| 33 | } | ||||||||||
| 34 | |||||||||||
| 35 | 4 | ▶ | sub PRINTF { | ||||||||
|
Subroutine
PRINTF: called CC=1 SCAR=0.0
| |||||||||||
| 36 | 4 | my $self = shift; | |||||||||
| 37 | 4 | my $fmt = shift; | |||||||||
| 38 | 4 | $self->PRINT(sprintf($fmt, @_)); | |||||||||
| 39 | } | ||||||||||
| 40 | |||||||||||
| 41 | 1 | ▶ | sub DESTROY { | ||||||||
|
Subroutine
DESTROY: called CC=1 SCAR=0.0
| |||||||||||
| 42 | # Not necessary if we're careful to end with a "\n" | ||||||||||
| 43 | 1 | my $self = shift; | |||||||||
| 44 | 1 | print {$self->{fh}} $self->{buffer}; | |||||||||
| 45 | } | ||||||||||
| 46 | |||||||||||
| 47 | 1 | ▶ | sub UNTIE { | ||||||||
|
Subroutine
UNTIE: called CC=1 SCAR=0.0
| |||||||||||
| 48 | # This sub does nothing, but is necessary for references to be released. | ||||||||||
| 49 | } | ||||||||||
| 50 | |||||||||||
| 51 | 7 | ▶ | sub end_marker { | ||||||||
|
Subroutine
end_marker: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 52 | 7 | return $SECTION_END_MARKER; | |||||||||
| 53 | } | ||||||||||
| 54 | |||||||||||
| 55 | 1 | 1; | |||||||||