File Coverage

blib/lib/MsOffice/Word/Surgeon/BookmarkBoundary.pm
Criterion Covered Total %
statement 18 18 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod 2 2 100.0
total 27 27 100.0


line stmt bran cond sub pod time code
1             package MsOffice::Word::Surgeon::BookmarkBoundary;
2 4     4   65 use 5.24.0;
  4         17  
3 4     4   26 use Moose;
  4         10  
  4         29  
4 4     4   32200 use Moose::Util::TypeConstraints qw(enum);
  4         9  
  4         39  
5 4     4   2156 use MooseX::StrictConstructor;
  4         10  
  4         40  
6              
7 4     4   15364 use namespace::clean -except => 'meta';
  4         11  
  4         47  
8              
9             #======================================================================
10             # ATTRIBUTES
11             #======================================================================
12              
13             has 'kind' => (is => 'ro', isa => enum([qw/Start End/]), required => 1);
14             has 'id' => (is => 'ro', isa => 'Str', required => 1);
15             has 'xml_before' => (is => 'rw', isa => 'Str', default => "");
16             has 'node_xml' => (is => 'rw', isa => 'Str', default => "");
17             has 'name' => (is => 'ro', isa => 'Str', default => "");
18              
19             #======================================================================
20             # METHODS
21             #======================================================================
22              
23 21     21 1 29 sub prepend_xml {my ($self, $more_xml) = @_; substr $self->{node_xml}, 0, 0, $more_xml;}
  21         71  
24 21     21 1 25 sub append_xml {my ($self, $more_xml) = @_; $self->{node_xml} .= $more_xml;}
  21         60  
25              
26            
27              
28             1;
29              
30             __END__
31              
32             =encoding ISO-8859-1
33              
34             =head1 NAME
35              
36             MsOffice::Word::Surgeon::BookmarkBoundary - internal representation for a MsWord bookmark
37              
38             =head1 DESCRIPTION
39              
40             This is used internally by L<MsOffice::Word::Surgeon> for storing
41             bookmark fragments.
42              
43              
44             =head1 METHODS
45              
46             =head2 new
47              
48             my $field = MsOffice::Word::Surgeon::Bookmark(%args);
49              
50             Constructor for a new bookmark object. Arguments are :
51              
52             =over
53              
54             =item kind
55              
56             Either C<Start> or C<End>
57              
58             =item id
59              
60             Numerical identifier for the bookmark
61              
62             =item name
63              
64             The bookmark name. Only present in C<Start> boundaries.
65              
66             =item xml_before
67              
68             A string containing arbitrary XML preceding that bookmark in the complete document.
69              
70             =item node_xml
71              
72             The complete XML for this node.
73              
74             =back
75              
76             =head1 METHODS
77              
78             =head2 prepend_xml
79              
80             Adds an XML fragment in front of the current node_xml.
81              
82             =head2 append_xml
83              
84             Adds an XML fragment after the current node_xml.
85              
86             =head1 AUTHOR
87              
88             Laurent Dami, E<lt>dami AT cpan DOT org<gt>
89              
90             =head1 COPYRIGHT AND LICENSE
91              
92             Copyright 2024 by Laurent Dami.
93              
94             This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0.