| 1 | package Mail::Karmasphere::Parser::Simple::List; | ||||||||||
| 2 | |||||||||||
| 3 | 5 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 5 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 5 | ▶ | use base 'Mail::Karmasphere::Parser::Base'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 4 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=5 SCAR=17.3
Pod
undocumented
| |||||||||||
| 8 | 4 | my $class = shift; | |||||||||
| 9 | # print STDERR "new: \$class = $class\n"; | ||||||||||
| 10 | # print STDERR "new: \$class->_streams() = @{[$class->_streams()]}\n";; | ||||||||||
| 11 | 0 | ▶ | my $self = ($#_ == 0) ? { %{ (shift) } } : { @_ }; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 12 | 4 | ▶ | unless (exists $self->{Streams}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 13 | 4 | ▶ | $self->{Type} = $class->_type() unless $self->{Type}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 14 | 4 | $self->{Streams} = [ $class->_streams() ]; | |||||||||
| 15 | } | ||||||||||
| 16 | 4 | $self = $class->SUPER::new($self); | |||||||||
| 17 | 4 | ▶ | $self->{Value} = 1000 unless exists $self->{Value}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 18 | 4 | return $self; | |||||||||
| 19 | } | ||||||||||
| 20 | |||||||||||
| 21 | 35 | ▶ | sub _parse { | ||||||||
|
Subroutine
_parse: called CC=4 SCAR=13.9
| |||||||||||
| 22 | 35 | my $self = shift; | |||||||||
| 23 | 35 | for (;;) { | |||||||||
| 24 | 35 | my $line = $self->fh->getline; | |||||||||
| 25 | 35 | ▶ | return undef unless $line; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | 31 | ▶ | next if $line =~ /^#/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | 31 | ▶ | next unless $line =~ /\S/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | 31 | chomp($line); $line =~ s/\r$//g; # strip trailing CRLF | |||||||||
| 29 | 31 | $line =~ s/[\s;].+$//; | |||||||||
| 30 | return new Mail::Karmasphere::Parser::Record( | ||||||||||
| 31 | s => 0, | ||||||||||
| 32 | i => $line, | ||||||||||
| 33 | v => $self->{Value}, | ||||||||||
| 34 | 31 | ); | |||||||||
| 35 | } | ||||||||||
| 36 | } | ||||||||||
| 37 | |||||||||||
| 38 | 0 | ▶ | sub _type { "Parser::Simple::* subclass must define _type()" } | ||||||||
|
Subroutine
_type: not called CC=1 SCAR=6.9
| |||||||||||
| 39 | |||||||||||
| 40 | 5 | 1; | |||||||||