API/YPP/Parser.pm

filter: Statementstmt 100% 30 / 30 Branchbran 100% 6 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 1 totaltotal 97.7% 43 / 44 SCAR 13.9
CC
4
Cov
100%
parse
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 4.0
« API.pm ↑ Summary API/XS.pm »
1 package YAML::LibYAML::API::YPP::Parser;
2 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 3 ▶use YAML::LibYAML::API::Parser;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use Scalar::Util qw/ openhandle /;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 ▶use base 'YAML::PP::Parser';
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 ▶use Carp qw/ croak /;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 sub parse {
11 3 ▶ my ($self) = @_;
Subroutine parse: called CC=4 SCAR=13.9
Pod undocumented
12 3 my $reader = $self->reader;
13 3 my $parser = YAML::LibYAML::API::Parser->new;
14 3 ▶ if ($reader->can('open_handle')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($reader->can('open_handle')) { } 2 1 3
15 2 ▶ if (openhandle($reader->input)) {
Branch: 1 branch
BranchTrueFalseTotal
if (&openhandle(scalar $reader->input)) { } 1 1 2
16 1 $parser->set_input_filehandle($reader->input);
17 }
18 else {
19 1 croak "Currently parsing a file is not supported, see documentation of YAML::LibYAML::API::Parser";
20 }
21 }
22 else {
23 1 my $yaml = $reader->read;
24 1 $parser->set_input_string($yaml);
25 }
26 2 ▶ while (my $event = $parser->parse) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $event = $parser->parse) 32 2 34
27 32 $self->callback->( $self, $event->{name} => $event );
28 }
29 }
30  
31 3 1;
« API.pm ↑ Summary API/XS.pm »