| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package EBook::MOBI::Driver; | 
| 2 |  |  |  |  |  |  |  | 
| 3 |  |  |  |  |  |  | our $VERSION = '0.7'; # VERSION (hook for Dist::Zilla::Plugin::OurPkgVersion) | 
| 4 |  |  |  |  |  |  |  | 
| 5 | 10 |  |  | 10 |  | 57 | use strict; | 
|  | 10 |  |  |  |  | 17 |  | 
|  | 10 |  |  |  |  | 351 |  | 
| 6 | 10 |  |  | 10 |  | 51 | use warnings; | 
|  | 10 |  |  |  |  | 66 |  | 
|  | 10 |  |  |  |  | 484 |  | 
| 7 |  |  |  |  |  |  |  | 
| 8 |  |  |  |  |  |  | # This constants are used for internal replacement | 
| 9 |  |  |  |  |  |  | # See interior_sequence() and _html_enc() for usage | 
| 10 | 10 |  |  |  |  | 1172 | use constant { GT  => '1_qpdhcn_thisStringShouldNeverOccurInInput', | 
| 11 |  |  |  |  |  |  | LT  => '2_udtcqk_thisStringShouldNeverOccurInInput', | 
| 12 |  |  |  |  |  |  | AMP => '3_pegjyq_thisStringShouldNeverOccurInInput', | 
| 13 |  |  |  |  |  |  | COL => '4_jdkmso_thisStringShouldNeverOccurInInput', | 
| 14 |  |  |  |  |  |  | QUO => '5_wuehlo_thisStringShouldNeverOccurInInput', | 
| 15 |  |  |  |  |  |  | DQUO=> '6_jrgwpm_thisStringShouldNeverOccurInInput', | 
| 16 | 10 |  |  | 10 |  | 51 | }; | 
|  | 10 |  |  |  |  | 18 |  | 
| 17 |  |  |  |  |  |  |  | 
| 18 |  |  |  |  |  |  | # IMPORTANT | 
| 19 |  |  |  |  |  |  | # This constant ist JUST a shortcut for readability. | 
| 20 |  |  |  |  |  |  | # Because it is used in hases ($parser->{}) a + is used so that it is not | 
| 21 |  |  |  |  |  |  | # interpreted as a string, so it looks like this: $parser->{+P . 'bla'} | 
| 22 |  |  |  |  |  |  | # See http://perldoc.perl.org/constant.html for details | 
| 23 | 10 |  |  | 10 |  | 52 | use constant { P   => 'EBook_MOBI_Pod2Mhtml_' }; | 
|  | 10 |  |  |  |  | 21 |  | 
|  | 10 |  |  |  |  | 3094 |  | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | sub new { | 
| 26 | 3 |  |  | 3 | 1 | 5049 | my $self = shift; | 
| 27 | 3 |  |  |  |  | 10 | my $ref = {}; | 
| 28 |  |  |  |  |  |  |  | 
| 29 | 3 |  |  |  |  | 11 | bless($ref, $self); | 
| 30 | 3 |  |  |  |  | 12 | return $ref; | 
| 31 |  |  |  |  |  |  | } | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | sub parse { | 
| 34 | 0 |  |  | 0 | 1 | 0 | die ("method parse() not overriden.\n"); | 
| 35 |  |  |  |  |  |  | } | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | sub set_options { | 
| 38 | 0 |  |  | 0 | 1 | 0 | die ("method set_options() not overriden.\n"); | 
| 39 |  |  |  |  |  |  | } | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | sub debug_on { | 
| 42 | 0 |  |  | 0 | 1 | 0 | my ($self, $ref_to_debug_sub) = @_; | 
| 43 |  |  |  |  |  |  |  | 
| 44 | 0 |  |  |  |  | 0 | $self->{ref_to_debug_sub} = $ref_to_debug_sub; | 
| 45 |  |  |  |  |  |  |  | 
| 46 | 0 |  |  |  |  | 0 | &$ref_to_debug_sub('DEBUG mode on'); | 
| 47 |  |  |  |  |  |  | } | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | sub debug_off { | 
| 50 | 0 |  |  | 0 | 1 | 0 | my ($self) = @_; | 
| 51 |  |  |  |  |  |  |  | 
| 52 | 0 | 0 |  |  |  | 0 | if ($self->{ref_to_debug_sub}) { | 
| 53 | 0 |  |  |  |  | 0 | &{$self->{ref_to_debug_sub}}('DEBUG mode off'); | 
|  | 0 |  |  |  |  | 0 |  | 
| 54 | 0 |  |  |  |  | 0 | $self->{ref_to_debug_sub} = 0; | 
| 55 |  |  |  |  |  |  | } | 
| 56 |  |  |  |  |  |  | } | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | # Internal debug method | 
| 59 |  |  |  |  |  |  | sub debug_msg { | 
| 60 | 79 |  |  | 79 | 1 | 285 | my ($self,$msg) = @_; | 
| 61 |  |  |  |  |  |  |  | 
| 62 | 79 | 50 |  |  |  | 872 | if ($self->{ref_to_debug_sub}) { | 
| 63 | 0 |  |  |  |  |  | &{$self->{ref_to_debug_sub}}($msg); | 
|  | 0 |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  | } | 
| 65 |  |  |  |  |  |  | } | 
| 66 |  |  |  |  |  |  |  | 
| 67 |  |  |  |  |  |  | 1; | 
| 68 |  |  |  |  |  |  |  | 
| 69 |  |  |  |  |  |  | __END__ |