File Coverage

blib/lib/XML/Grammar/Fiction/Struct/Tag.pm
Criterion Covered Total %
statement 15 28 53.5
branch 0 2 0.0
condition n/a
subroutine 5 9 55.5
pod 3 3 100.0
total 23 42 54.7


line stmt bran cond sub pod time code
1             package XML::Grammar::Fiction::Struct::Tag;
2              
3 2     2   15 use strict;
  2         5  
  2         73  
4 2     2   11 use warnings;
  2         4  
  2         56  
5              
6 2     2   11 use MooX 'late';
  2         3  
  2         13  
7              
8 2     2   49596 use List::MoreUtils;
  2         3344  
  2         688  
9              
10              
11             our $VERSION = '0.14.10';
12              
13             has 'name' => (is => "rw", isa => "Str");
14             has 'line' => (is => "rw", isa => "Int");
15             has 'is_standalone' => (is => "rw", isa => "Bool");
16             has 'attrs' => (is => "rw", isa => "ArrayRef");
17             has 'children' => (
18             is => "rw",
19             isa => "Maybe[ArrayRef]",
20             );
21              
22             sub append_children
23             {
24 0     0 1   my ($self, $children) = @_;
25              
26             # This is an assert / sanity check.
27 0 0   0     if (List::MoreUtils::any { !defined ($_) } @$children)
  0            
28             {
29 0           Carp::confess("append_children with undef.");
30             }
31              
32 0           push @{$self->children()}, @$children;
  0            
33              
34 0           return;
35             }
36              
37             sub append_child
38             {
39 0     0 1   my ($self, $child) = @_;
40              
41 0           return $self->append_children( [ $child ] );
42             }
43              
44             sub detach_children
45             {
46 0     0 1   my $self = shift;
47              
48 0           my $children = $self->children();
49              
50 0           $self->children(undef);
51              
52 0           return $children;
53             }
54              
55             package XML::Grammar::Fiction::Struct::Tag::Para;
56              
57 2     2   53 use MooX 'late';
  2         5  
  2         25  
58              
59             extends("XML::Grammar::Fiction::Struct::Tag");
60              
61              
62             1;
63              
64             __END__