File Coverage

blib/lib/HTML/Hyphenate/DOM.pm
Criterion Covered Total %
statement 8 8 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 11 11 100.0


line stmt bran cond sub pod time code
1             # -*- cperl; cperl-indent-level: 4 -*-
2             # Copyright (C) 2009-2021, Roland van Ipenburg
3             package HTML::Hyphenate::DOM v1.1.8;
4 11     11   91 use Moose;
  11         27  
  11         100  
5 11     11   79773 use utf8;
  11         27  
  11         99  
6 11     11   481 use 5.016000;
  11         45  
7             ## no critic qw(ProhibitCallsToUndeclaredSubs)
8             extends q{Mojo::DOM};
9              
10             ## no critic qw(ProhibitCallsToUndeclaredSubs)
11             override 'replace' => sub {
12             ## use critic
13             my ( $self, $string ) = @_;
14             if ( $string ne $self->to_string ) {
15             ## no critic qw(ProhibitCallsToUndeclaredSubs)
16             super();
17             ## use critic
18             }
19             };
20              
21             1;
22              
23             __END__
24              
25             =encoding utf8
26              
27             =for stopwords Bitbucket Ipenburg merchantability Mojolicious DOM
28              
29             =head1 NAME
30              
31             HTML::Hyphenate::DOM - DOM helper for HTML::Hyphenate
32              
33             =head1 VERSION
34              
35             This document describes HTML::Hyphenate::DOM version C<v1.1.8>.
36              
37             =head1 SYNOPSIS
38              
39             use HTML::Hyphenate::DOM;
40              
41             $dom = new HTML::Hyphenate::DOM();
42              
43             =head1 DESCRIPTION
44              
45             Extends L<Mojo::DOM|Mojo::DOM>.
46              
47             =head1 SUBROUTINES/METHODS
48              
49             Inherits everything from Mojo::DOM but changes a few methods:
50              
51             =over 4
52              
53             =item $dom-E<gt>replace()
54              
55             Because we sometimes end up replacing 90% of the nodes with the value it
56             already had - the case when no hyphens were added because all words were
57             shorter than the minimum length - we have added a check so the expensive super
58             method is only called when the given value differs from the current value.
59             This speeds up the process enormously.
60              
61             =back
62              
63             =head1 CONFIGURATION AND ENVIRONMENT
64              
65             =head1 DEPENDENCIES
66              
67             =over 4
68              
69             =item * Perl 5.16
70              
71             =item * L<Moose|Moose>
72              
73             =item * L<Mojolicious|Mojolicious> for L<Mojo::Dom|Mojo::Dom>
74              
75             =back
76              
77             =head1 INCOMPATIBILITIES
78              
79             This module has the same limits as Mojo::DOM.
80              
81             =head1 DIAGNOSTICS
82              
83             =head1 BUGS AND LIMITATIONS
84              
85             Please report any bugs or feature requests at
86             L<Bitbucket|https://bitbucket.org/rolandvanipenburg/html-hyphenate/issues>.
87              
88             =head1 AUTHOR
89              
90             Roland van Ipenburg, E<lt>roland@rolandvanipenburg.comE<gt>
91              
92             =head1 LICENSE AND COPYRIGHT
93              
94             Copyright (C) 2009-2021, Roland van Ipenburg
95              
96             This library is free software; you can redistribute it and/or modify
97             it under the same terms as Perl itself, either Perl version 5.14.0 or,
98             at your option, any later version of Perl 5 you may have available.
99              
100             =head1 DISCLAIMER OF WARRANTY
101              
102             BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
103             FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
104             OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
105             PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
106             EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
107             WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
108             ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
109             YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
110             NECESSARY SERVICING, REPAIR, OR CORRECTION.
111              
112             IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
113             WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
114             REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE
115             LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
116             OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
117             THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
118             RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
119             FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
120             SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
121             SUCH DAMAGES.
122              
123             =cut