File Coverage

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


line stmt bran cond sub pod time code
1             #!/usr/bin/perl
2              
3 1     1   531 use strict;
  1         2  
  1         34  
4 1     1   5 use warnings;
  1         2  
  1         48  
5              
6             package PodParser;
7 1     1   4 use base qw( Parser::MGC );
  1         2  
  1         640  
8              
9 1     1   8 use Feature::Compat::Try;
  1         2  
  1         9  
10              
11             sub parse
12             {
13 10     10   18 my $self = shift;
14              
15             $self->sequence_of(
16             sub { $self->any_of(
17              
18 15         58 sub { my ( undef, $tag, $delim ) = $self->expect( qr/([A-Z])(<+)/ );
19 5         19 $self->commit;
20 5         23 +{ $tag => $self->scope_of( undef, \&parse, ">" x length $delim ) }; },
21              
22 10         51 sub { $self->substring_before( qr/[A-Z]
23 15     15   96 ) },
24 10         71 );
25             }
26              
27 1     1   1190 use Data::Dumper;
  1         7737  
  1         288  
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;