File Coverage

examples/parse-pod.pl
Criterion Covered Total %
statement 21 21 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod n/a
total 28 28 100.0


line stmt bran cond sub pod time code
1             #!/usr/bin/perl
2              
3 1     1   495829 use v5.14;
  1         5  
4 1     1   7 use warnings;
  1         2  
  1         96  
5              
6             package PodParser;
7 1     1   7 use base qw( Parser::MGC );
  1         2  
  1         716  
8              
9 1     1   8 use Feature::Compat::Try;
  1         1  
  1         7  
10              
11             sub parse
12             {
13 10     10   16 my $self = shift;
14              
15             $self->sequence_of(
16             sub { $self->any_of(
17              
18 15         85 sub { my ( undef, $tag, $delim ) = $self->expect( qr/([A-Z])(<+)/ );
19 5         48 $self->commit;
20 5         29 +{ $tag => $self->scope_of( undef, \&parse, ">" x length $delim ) }; },
21              
22 10         49 sub { $self->substring_before( qr/[A-Z]
23 15     15   153 ) },
24 10         70 );
25             }
26              
27 1     1   1155 use Data::Dumper;
  1         10290  
  1         306  
28              
29             if( !caller ) {
30             my $parser = __PACKAGE__->new;
31              
32             while( defined( my $line = ) ) {
33             try {
34             my $ret = $parser->from_string( $line );
35             print Dumper( $ret );
36             }
37             catch ( $e ) {
38             print $e;
39             }
40             }
41             }
42              
43             1;