File Coverage

blib/lib/WriteAt/AUTHOR.pm
Criterion Covered Total %
statement 12 30 40.0
branch 0 2 0.0
condition n/a
subroutine 4 6 66.6
pod 0 2 0.0
total 16 40 40.0


line stmt bran cond sub pod time code
1             #===============================================================================
2             #
3             # DESCRIPTION: Author SECTION
4             #
5             # AUTHOR: Aliaksandr P. Zahatski,
6             #===============================================================================
7             package WriteAt::AUTHOR;
8 1     1   5 use strict;
  1         2  
  1         29  
9 1     1   5 use warnings;
  1         1  
  1         26  
10 1     1   4 use Perl6::Pod::Block;
  1         2  
  1         21  
11 1     1   4 use base 'Perl6::Pod::Block';
  1         2  
  1         366  
12             our $VERSION = '0.01';
13              
14             =pod
15              
16             Convert:
17              
18             *AUTHOR firstname [lineage ] surname
19              
20             *AUTHOR Alex Bred Bom
21             *AUTHOR Alex Bom
22              
23             To
24              
25            
26             Alex
27             Bred
28             Bom
29            
30            
31             =cut
32              
33             sub parse_content {
34 0     0 0   my $self = shift;
35 0           my $t = shift;
36 0           my @words = grep {defined $_ } $t=~m/^ \s* (\S+) \s+ (?:(\S+)\s+)? (\S+)/x;
  0            
37 0           my %items = ();
38 0 0         if (scalar(@words) > 2 ) {
39 0           @items{qw/ firstname lineage surname /} = @words;
40             } else {
41 0           @items{qw/ firstname surname /} = @words;
42             }
43 0           return \%items;
44             }
45              
46             sub to_docbook {
47 0     0 0   my ( $self, $to )= @_;
48 0           my $w = $to->w;
49 0           $w->raw('');
50 0           my $rec = $self->parse_content( $self->childs->[0]->childs->[0] );
51 0           while( my ($k, $v) = each %$rec ) {
52 0           $w->raw("<$k>");
53 0           $w->print("$v");
54 0           $w->raw("");
55             }
56 0           $w->raw('');
57             }
58             1;
59