| 1 | package WWW::BookBot; | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use 5.008; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 3 | ▶ | no warnings qw(uninitialized); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 3 | ▶ | use base qw(Exporter); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 3 | ▶ | use vars qw($VERSION @EXPORT @EXPORT_OK); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 3 | $VERSION = "0.12"; | |||||||||||||||||||||||||||||||||||||||||||||
| 10 | 3 | @EXPORT = qw(); | |||||||||||||||||||||||||||||||||||||||||||||
| 11 | 3 | @EXPORT_OK = @EXPORT; | |||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 3 | ▶ | use Encode; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 3 | ▶ | use File::Basename; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 3 | ▶ | use File::Spec::Functions; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 3 | ▶ | use File::Path; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 3 | ▶ | use Fcntl; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 3 | ▶ | use WWW::BookBot::FakeCookies; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 3 | ▶ | use LWP::UserAgent; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 3 | ▶ | use HTTP::Request::Common; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 3 | ▶ | use HTTP::Response; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 3 | ▶ | use HTTP::Date; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 3 | ▶ | use URI; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 3 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 3 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 3 | ▶ | use POSIX qw(ceil floor); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 3 | our %entity2char; #for html entities decoding | |||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||
| 30 | #------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 31 | # Create objects and initialize | ||||||||||||||||||||||||||||||||||||||||||||||
| 32 | # $bot->new(\%args) => $bot | ||||||||||||||||||||||||||||||||||||||||||||||
| 33 | # $class->default_settings => \%settings | ||||||||||||||||||||||||||||||||||||||||||||||
| 34 | # $bot->initialize => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 35 | # $bot->work_dir($dir) => $work_dir | ||||||||||||||||||||||||||||||||||||||||||||||
| 36 | #------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 21 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=14.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 21 | ▶ | my $class = ref($_[0]) || $_[0]; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
ref $_[0] || $_[0]
MC/DC0%0/2
ref $_[0] || $_[0]
ref $_[0]
$_[0]
Truth table33%1/3
A || B
A= ref $_[0]B= $_[0]
| |||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 21 | ▶ | my $pargs = ref($_[1]) ? $_[1] : {} ; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 21 | my $self = $class->default_settings; | |||||||||||||||||||||||||||||||||||||||||||||
| 41 | 21 | bless($self, $class); | |||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||
| 43 | # Set default work dir | ||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 21 | my $dirname=$self->{classname}; | |||||||||||||||||||||||||||||||||||||||||||||
| 45 | 21 | $dirname=~s/^WWW:://; | |||||||||||||||||||||||||||||||||||||||||||||
| 46 | 21 | $self->{work_dir}=catfile($ENV{HOME}, split(/::/,$dirname)); | |||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||
| 48 | # Set user defined args | ||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 21 | foreach (keys %$pargs) { | |||||||||||||||||||||||||||||||||||||||||||||
| 50 | 27 | $self->{$_} = $pargs->{$_}; | |||||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||
| 53 | # initialize and return | ||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 21 | $self->initialize; | |||||||||||||||||||||||||||||||||||||||||||||
| 55 | 21 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 21 | ▶ | sub default_settings { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_settings: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 58 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 21 | classname => shift, #cureent classname | |||||||||||||||||||||||||||||||||||||||||||||
| 60 | book_get_num => 0, #statistics of books, to be used in file title | ||||||||||||||||||||||||||||||||||||||||||||||
| 61 | book_has_chapters => 1, #0-only 1 chapter, 1-multiple chapters | ||||||||||||||||||||||||||||||||||||||||||||||
| 62 | book_max_levels => 5, #max levels of book - chapters - chapters - chapters .. | ||||||||||||||||||||||||||||||||||||||||||||||
| 63 | book_max_chapters => 500, #max chapters in 1 book | ||||||||||||||||||||||||||||||||||||||||||||||
| 64 | catalog_max_pages => 500, #max catalog pages | ||||||||||||||||||||||||||||||||||||||||||||||
| 65 | get_agent_name => "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; AIRF)", | ||||||||||||||||||||||||||||||||||||||||||||||
| 66 | get_agent_proxy => "Default", | ||||||||||||||||||||||||||||||||||||||||||||||
| 67 | #Default Use default IE proxy | ||||||||||||||||||||||||||||||||||||||||||||||
| 68 | #No Don't use proxy | ||||||||||||||||||||||||||||||||||||||||||||||
| 69 | #196.23.147.34:80 Use given proxy | ||||||||||||||||||||||||||||||||||||||||||||||
| 70 | #Default;202.105.138.19:8080;202.110.220.14:80;... | ||||||||||||||||||||||||||||||||||||||||||||||
| 71 | # Use multiple proxy, one visit use one proxy in turn | ||||||||||||||||||||||||||||||||||||||||||||||
| 72 | get_delay_second => 0, #if get_delay_second>0 then delay get_delay_second+rand seconds | ||||||||||||||||||||||||||||||||||||||||||||||
| 73 | get_delay_second_rand => 2, | ||||||||||||||||||||||||||||||||||||||||||||||
| 74 | get_fail_showtype => '', #''-show simplified info, 'Detail'-show detailed info | ||||||||||||||||||||||||||||||||||||||||||||||
| 75 | get_file_directory => './saved', #debug save and read file from this directory | ||||||||||||||||||||||||||||||||||||||||||||||
| 76 | get_from_file => 0, #0-normal operation, 1-get from file only | ||||||||||||||||||||||||||||||||||||||||||||||
| 77 | get_language => "en", #get headers: language | ||||||||||||||||||||||||||||||||||||||||||||||
| 78 | get_max_retries => 5, #max retries of 1 get | ||||||||||||||||||||||||||||||||||||||||||||||
| 79 | get_save_file => 0, #0-normal operation, 1-save to file for latter debug | ||||||||||||||||||||||||||||||||||||||||||||||
| 80 | get_skip_zip => 1, #skip fetch zip files | ||||||||||||||||||||||||||||||||||||||||||||||
| 81 | get_skip_media => 1, #skip fetch media files | ||||||||||||||||||||||||||||||||||||||||||||||
| 82 | get_timeout => 40, #get timeout | ||||||||||||||||||||||||||||||||||||||||||||||
| 83 | get_trunk_size => 50000, #define 1 trunk = xxxBytes for display | ||||||||||||||||||||||||||||||||||||||||||||||
| 84 | get_trunk_fresh_size => 5000, #if get size > xxxBytes, then refresh trunk display | ||||||||||||||||||||||||||||||||||||||||||||||
| 85 | get_visited_url_num => 0, #statistics of visted urls, to be used in get_from_file/get_save_file | ||||||||||||||||||||||||||||||||||||||||||||||
| 86 | language_decode => "utf8", #to read with encoding | ||||||||||||||||||||||||||||||||||||||||||||||
| 87 | language_encode => "utf8", #to save with encoding | ||||||||||||||||||||||||||||||||||||||||||||||
| 88 | process_all => 0, #process all pages of catalog | ||||||||||||||||||||||||||||||||||||||||||||||
| 89 | result_no_crlf => 1, #0-with crlf, 1-no crlf | ||||||||||||||||||||||||||||||||||||||||||||||
| 90 | space_leading_remove => 1, #remove leading spaces | ||||||||||||||||||||||||||||||||||||||||||||||
| 91 | space_leading_max => 20, #max leading spaces | ||||||||||||||||||||||||||||||||||||||||||||||
| 92 | space_inner_remove => 1, #remove inner spaces | ||||||||||||||||||||||||||||||||||||||||||||||
| 93 | space_inner_min_words => 5, #minimal length of word with inner spaces | ||||||||||||||||||||||||||||||||||||||||||||||
| 94 | text_paragraph_type => 'br', #type of paragraph split methods | ||||||||||||||||||||||||||||||||||||||||||||||
| 95 | # br one br as end of paragraph | ||||||||||||||||||||||||||||||||||||||||||||||
| 96 | # brbr two br as end of paragraph | ||||||||||||||||||||||||||||||||||||||||||||||
| 97 | # cr one cr as end of paragraph | ||||||||||||||||||||||||||||||||||||||||||||||
| 98 | # crcr two cr as end of paragraph | ||||||||||||||||||||||||||||||||||||||||||||||
| 99 | # crandspace one cr and followed with space as end of paragraph | ||||||||||||||||||||||||||||||||||||||||||||||
| 100 | screen_limit_trunk => 25, #max trunks to be displayed | ||||||||||||||||||||||||||||||||||||||||||||||
| 101 | screen_limit_title => 14, #max title to be displayed | ||||||||||||||||||||||||||||||||||||||||||||||
| 102 | }; | ||||||||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 21 | ▶ | sub initialize { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
initialize: called CC=8 SCAR=21.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 21 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||
| 107 | # Initialize languages | ||||||||||||||||||||||||||||||||||||||||||||||
| 108 | $self->{lang_encode}=find_encoding($self->{language_encode}) | ||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 21 | ▶ | if $self->{language_encode} ne ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 110 | $self->{lang_decode}=find_encoding($self->{language_decode}) | ||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 21 | ▶ | if $self->{language_decode} ne ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||
| 113 | # Initialize messages | ||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 21 | $self->trandict_init; | |||||||||||||||||||||||||||||||||||||||||||||
| 115 | 21 | $self->msg_init; | |||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||
| 117 | # Create work directory | ||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 21 | $self->work_dir( $self->{work_dir} ); | |||||||||||||||||||||||||||||||||||||||||||||
| 119 | 21 | eval {mkpath($self->{work_dir})}; | |||||||||||||||||||||||||||||||||||||||||||||
| 120 | 21 | ▶ | $self->fatal_error("FailMkDir", dir=>$self->{work_dir}, errmsg=>$@) if $@; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||
| 122 | # Check debug directory | ||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 21 | $self->{get_file_directory_save}=catfile($self->{get_file_directory}, $self->get_alias()); | |||||||||||||||||||||||||||||||||||||||||||||
| 124 | 21 | $self->{get_file_directory_read}=$self->{get_file_directory_save}; | |||||||||||||||||||||||||||||||||||||||||||||
| 125 | 21 | $self->{get_file_directory_read}=~s,\\,/,sg; | |||||||||||||||||||||||||||||||||||||||||||||
| 126 | 21 | $self->{get_file_directory_read}=~s,/+$,,sg; | |||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | eval {mkpath($self->{get_file_directory_save})} | |||||||||||||||||||||||||||||||||||||||||||||
| 128 | 21 | ▶ | if $self->{get_from_file} or $self->{get_save_file}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{"get_from_file"} or $self->{"get_save_file"}
MC/DC0%0/2
$self->{"get_from_file"} or $self->{"get_save_file"}
$self->{"get_from_file"}
$self->{"get_save_file"}
Truth table33%1/3
A or B
A= $self->{"get_from_file"}B= $self->{"get_save_file"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||||||
| 130 | # Initialize patterns | ||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 21 | $self->{patterns} = {}; | |||||||||||||||||||||||||||||||||||||||||||||
| 132 | 21 | foreach ($self->getpattern_lists) { | |||||||||||||||||||||||||||||||||||||||||||||
| 133 | 546 | my $sub="getpattern_".$_; | |||||||||||||||||||||||||||||||||||||||||||||
| 134 | 546 | my $sub_data=$sub."_data"; | |||||||||||||||||||||||||||||||||||||||||||||
| 135 | 546 | ▶ | $self->{patterns}->{$_} = $self->can($sub) ? | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 136 | $self->$sub : $self->parse_patterns($self->$sub_data); | ||||||||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||
| 139 | # Content Type Initialize | ||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 21 | $self->contenttype_init; | |||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||
| 142 | # Initialize LWP user agents | ||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 21 | $self->agent_init; | |||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||
| 145 | # Initialize DB | ||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 21 | $self->db_init; | |||||||||||||||||||||||||||||||||||||||||||||
| 147 | 21 | $self->db_load; | |||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||
| 149 | # Try to login | ||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 21 | $self->go_login; | |||||||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 21 | ▶ | sub work_dir { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
work_dir: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 21 | my ($self, $work_dir) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 154 | 21 | ▶ | return $self->{work_dir} if $work_dir eq ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||
| 156 | # Reset default work directory, log file, db file | ||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 21 | $self->{work_dir}=$work_dir; | |||||||||||||||||||||||||||||||||||||||||||||
| 158 | 21 | $self->{file_log}=catfile($work_dir, "0000log.txt"); | |||||||||||||||||||||||||||||||||||||||||||||
| 159 | 21 | $self->{file_DB}=catfile($work_dir, "0000db.txt"); | |||||||||||||||||||||||||||||||||||||||||||||
| 160 | 21 | return $work_dir; | |||||||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||
| 163 | #------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 164 | # Debug functions | ||||||||||||||||||||||||||||||||||||||||||||||
| 165 | # $bot->dump_class => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 166 | # $bot->dump_var(@vars) => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 167 | # $bot->test_pattern($pattern_name, $content) => 1-match 0-no match | ||||||||||||||||||||||||||||||||||||||||||||||
| 168 | #------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | ▶ | sub dump_class { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dump_class: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | local $Data::Dumper::Maxdepth=1; #only show 1 level | |||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | local $Data::Dumper::Sortkeys=1; #sort keys | |||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | local $Data::Dumper::Quotekeys=0; #no quote | |||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | local $Data::Dumper::Varname=$self->{classname}; | |||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | print Dumper($self); | |||||||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | ▶ | sub dump_var { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dump_var: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | foreach (@_) { | |||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | local $Data::Dumper::Sortkeys=1; #sort keys | |||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | local $Data::Dumper::Quotekeys=0; #no quote | |||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | local $Data::Dumper::Varname=$self->{classname}."->{$_}"; | |||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | print Dumper($self->{$_}); | |||||||||||||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | sub test_pattern { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
test_pattern: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | my ($self, $pattern_name) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||||||
| 189 | # get pattern, verify and print its encoded content | ||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | my $pattern = $self->{patterns}->{$pattern_name}; | |||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | croak "Invalid pattern name: $pattern" if not(defined($pattern)); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | printf "[Pattern $pattern_name]=\"%s\"\n", $self->en_code($pattern); | |||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | my $result=1; | |||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | ▶ | if( $_[0] ne '' ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 196 | # test content if specified | ||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | my $str=$self->de_code($_[0]); | |||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | my $result=($str=~/$pattern/); | |||||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | ▶ | printf " Test with \"%s\": %s\n", | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 200 | $_[0], | ||||||||||||||||||||||||||||||||||||||||||||||
| 201 | $result ? 'match' : 'no match'; | ||||||||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | return $result; | |||||||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||
| 206 | #------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 207 | # Pattern utility functions | ||||||||||||||||||||||||||||||||||||||||||||||
| 208 | # $bot->parse_patterns("a\n'b\nc\n") => [aA]|\'[bB]|[cC] | ||||||||||||||||||||||||||||||||||||||||||||||
| 209 | # add \ before /"'`$& automatically | ||||||||||||||||||||||||||||||||||||||||||||||
| 210 | # encoding -> decoding | ||||||||||||||||||||||||||||||||||||||||||||||
| 211 | # auto-case insensitive conversion except 2: | ||||||||||||||||||||||||||||||||||||||||||||||
| 212 | # first line is (case) | ||||||||||||||||||||||||||||||||||||||||||||||
| 213 | # [...] | ||||||||||||||||||||||||||||||||||||||||||||||
| 214 | #------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 540 | ▶ | sub parse_patterns { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_patterns: called CC=10 SCAR=23.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 540 | my ($self, $str) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 217 | 540 | ▶ | $str='' if not(defined($str)); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||||||
| 219 | # simplify pattern construction by add \ before /"'`$& automatically | ||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 540 | $str=~s,(?=\/|\"|\'|\`|\$|\&),\\,g; | |||||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||||||
| 222 | # multiplie lines -> | | ||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 540 | my $pattern = ""; | |||||||||||||||||||||||||||||||||||||||||||||
| 224 | 540 | foreach ( split /\r\n|\r|\n/, $str ) { | |||||||||||||||||||||||||||||||||||||||||||||
| 225 | 4009 | ▶ | $pattern .= $_.'|' if $_ ne ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 540 | $pattern=~s/\|$//; | |||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||||
| 229 | # parse \n | ||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 540 | $pattern=~s/\\n/\n/sg; | |||||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||||||
| 232 | # decode | ||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 540 | $str=$self->de_code($pattern); | |||||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||||||
| 235 | # case sensitive and insensitive | ||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 540 | ▶ | if( $str=~/^\(case\)\|/s ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 237 | # case sensitive | ||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 10 | $str=~s/^\(case\)\|//s; | |||||||||||||||||||||||||||||||||||||||||||||
| 239 | 10 | $pattern=$str; | |||||||||||||||||||||||||||||||||||||||||||||
| 240 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 241 | # change to case insensitive form | ||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 530 | $pattern=""; | |||||||||||||||||||||||||||||||||||||||||||||
| 243 | 530 | my $meet_left=0; | |||||||||||||||||||||||||||||||||||||||||||||
| 244 | 530 | foreach (split /(\\.|[\[\]])/, $str) { | |||||||||||||||||||||||||||||||||||||||||||||
| 245 | 4806 | ▶ | $meet_left=1 if $_ eq '['; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 4806 | ▶ | $meet_left=0 if $_ eq ']'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 4806 | ▶ | s,([a-zA-Z]),'['.lc($1).uc($1).']',eg if $meet_left==0 and not(/^\\/); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$meet_left == 0 and not /^\\/
MC/DC100%2/2
$meet_left == 0 and not /^\\/
$meet_left == 0
not /^\\/
Truth table100%3/3
A and not(B)
A= $meet_left == 0B= not /^\\/
| |||||||||||||||||||||||||||||||||||||||||||||||
| 248 | # skip [...] and \d | ||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 4806 | $pattern.=$_; | |||||||||||||||||||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||||||
| 253 | # return | ||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 540 | return $pattern; | |||||||||||||||||||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||||||
| 257 | #------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 258 | # Message functions | ||||||||||||||||||||||||||||||||||||||||||||||
| 259 | # $bot->trandict_init => $bot->{translate_dict} | ||||||||||||||||||||||||||||||||||||||||||||||
| 260 | # $bot->msg_init => $bot->{messages} | ||||||||||||||||||||||||||||||||||||||||||||||
| 261 | # $bot->msg_format($msgid, \%args) => $msgstr | ||||||||||||||||||||||||||||||||||||||||||||||
| 262 | # $bot->fatal_error($msgid, \%args) => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 263 | #------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 14 | ▶ | sub trandict_init { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
trandict_init: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 265 | shift->{translate_dict} = { | ||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 14 | 'log' => "log", | |||||||||||||||||||||||||||||||||||||||||||||
| 267 | 'result' => "result", | ||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 'DB' => "DB", | ||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 'debug' => 'debug', | ||||||||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 14 | ▶ | sub msg_init { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
msg_init: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 14 | my $skip_info="\n".'$pargs->{levelspace} url=$pargs->{url}'."\n"; | |||||||||||||||||||||||||||||||||||||||||||||
| 274 | shift->{messages} = { | ||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 14 | TestMsg => 'Test: $pargs->{TestInfo} $pargs->{TestNum}', | |||||||||||||||||||||||||||||||||||||||||||||
| 276 | BookBinaryOK => '$pargs->{data_len_KB} $pargs->{write_file}'."\n", | ||||||||||||||||||||||||||||||||||||||||||||||
| 277 | BookChapterErr => ' cannot parse'.$skip_info, | ||||||||||||||||||||||||||||||||||||||||||||||
| 278 | BookChapterMany => '[$pargs->{chapter_num}CH]', | ||||||||||||||||||||||||||||||||||||||||||||||
| 279 | BookChapterOne => '[0001CH]', | ||||||||||||||||||||||||||||||||||||||||||||||
| 280 | BookChapterOK => '$pargs->{data_len_KB}'."\n", | ||||||||||||||||||||||||||||||||||||||||||||||
| 281 | BookStart => '$pargs->{levelspace} [$pargs->{bpos_limit}/$pargs->{book_num}] $pargs->{title_limit} ', | ||||||||||||||||||||||||||||||||||||||||||||||
| 282 | BookTOCFinish => '$pargs->{TOC_len_KB}'."\n", | ||||||||||||||||||||||||||||||||||||||||||||||
| 283 | CatalogInfo => 'Get Catalog: ', | ||||||||||||||||||||||||||||||||||||||||||||||
| 284 | CatalogResultErr=> ' 0 books'."\n", | ||||||||||||||||||||||||||||||||||||||||||||||
| 285 | CatalogResultOK => ' $pargs->{book_num} books'."\n", | ||||||||||||||||||||||||||||||||||||||||||||||
| 286 | CatalogURL => '$pargs->{url}', | ||||||||||||||||||||||||||||||||||||||||||||||
| 287 | CatalogURLEmpty => '[Fail] catalog url is empty'."\n", | ||||||||||||||||||||||||||||||||||||||||||||||
| 288 | DBHead => <<'DATA', | ||||||||||||||||||||||||||||||||||||||||||||||
| 289 | #!$pargs->{perlcmd} | ||||||||||||||||||||||||||||||||||||||||||||||
| 290 | ##====================================== | ||||||||||||||||||||||||||||||||||||||||||||||
| 291 | ## Auto-generated DB File of $pargs->{classname} | ||||||||||||||||||||||||||||||||||||||||||||||
| 292 | ## Create time: $pargs->{createtime} | ||||||||||||||||||||||||||||||||||||||||||||||
| 293 | ##====================================== | ||||||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||||||
| 295 | use $pargs->{classname}; | ||||||||||||||||||||||||||||||||||||||||||||||
| 296 | my \$bot = new $pargs->{classname}; | ||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||
| 298 | DATA | ||||||||||||||||||||||||||||||||||||||||||||||
| 299 | DBCatalogErr => ' \$bot->go_catalog({$pargs->{allargs}});'."\t#Err\n", | ||||||||||||||||||||||||||||||||||||||||||||||
| 300 | DBCatalogOK => '#\$bot->go_catalog({$pargs->{allargs}});'."\n", | ||||||||||||||||||||||||||||||||||||||||||||||
| 301 | DBBookErr => "\t".' \$bot->go_book({$pargs->{allargs}});'."\t#Err\n", | ||||||||||||||||||||||||||||||||||||||||||||||
| 302 | DBBookOK => "\t".'#\$bot->go_book({$pargs->{allargs}});'."\n", | ||||||||||||||||||||||||||||||||||||||||||||||
| 303 | FailClearDB => 'Fail to clear DB file $pargs->{filename}: $pargs->{errmsg}', | ||||||||||||||||||||||||||||||||||||||||||||||
| 304 | FailClose => 'Fail to close $self->{translate_dict}->{$pargs->{filetype}} file $pargs->{filename}: $pargs->{errmsg}', | ||||||||||||||||||||||||||||||||||||||||||||||
| 305 | FailMkDir => 'Fail to mkdir $pargs->{dir}: $pargs->{errmsg}', | ||||||||||||||||||||||||||||||||||||||||||||||
| 306 | FailOpen => 'Fail to open $self->{translate_dict}->{$pargs->{filetype}} file $pargs->{filename}: $pargs->{errmsg}', | ||||||||||||||||||||||||||||||||||||||||||||||
| 307 | FailWrite => 'Fail to write $self->{translate_dict}->{$pargs->{filetype}} file $pargs->{filename}: $pargs->{errmsg}', | ||||||||||||||||||||||||||||||||||||||||||||||
| 308 | GetFail404 => <<'DATA', | ||||||||||||||||||||||||||||||||||||||||||||||
| 309 | [$pargs->{code},Fail] No such file | ||||||||||||||||||||||||||||||||||||||||||||||
| 310 | $pargs->{url_real} | ||||||||||||||||||||||||||||||||||||||||||||||
| 311 | DATA | ||||||||||||||||||||||||||||||||||||||||||||||
| 312 | GetFail404Detail=> <<'DATA', | ||||||||||||||||||||||||||||||||||||||||||||||
| 313 | [$pargs->{code},Fail] No such file | ||||||||||||||||||||||||||||||||||||||||||||||
| 314 | >>>>Request | ||||||||||||||||||||||||||||||||||||||||||||||
| 315 | $pargs->{req_content}<<<<Response | ||||||||||||||||||||||||||||||||||||||||||||||
| 316 | $pargs->{status_line} | ||||||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||||||
| 318 | DATA | ||||||||||||||||||||||||||||||||||||||||||||||
| 319 | GetFailRetries => <<'DATA', | ||||||||||||||||||||||||||||||||||||||||||||||
| 320 | [$pargs->{code},Fail] Exceed retry limits | ||||||||||||||||||||||||||||||||||||||||||||||
| 321 | $pargs->{url_real} | ||||||||||||||||||||||||||||||||||||||||||||||
| 322 | DATA | ||||||||||||||||||||||||||||||||||||||||||||||
| 323 | GetFailRetriesDetail => <<'DATA', | ||||||||||||||||||||||||||||||||||||||||||||||
| 324 | [$pargs->{code},Fail] Exceed retry limits | ||||||||||||||||||||||||||||||||||||||||||||||
| 325 | >>>>Request | ||||||||||||||||||||||||||||||||||||||||||||||
| 326 | $pargs->{req_content}<<<<Response | ||||||||||||||||||||||||||||||||||||||||||||||
| 327 | $pargs->{status_line} | ||||||||||||||||||||||||||||||||||||||||||||||
| 328 | $pargs->{res_content} | ||||||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||||||
| 330 | DATA | ||||||||||||||||||||||||||||||||||||||||||||||
| 331 | GetURLRetry => '[$pargs->{code}, Retry] ', | ||||||||||||||||||||||||||||||||||||||||||||||
| 332 | GetURLSuccess => '$pargs->{len_KB} ', | ||||||||||||||||||||||||||||||||||||||||||||||
| 333 | GetWait => 'Wait..', | ||||||||||||||||||||||||||||||||||||||||||||||
| 334 | SkipMaxLevel => '[Skip]level>$self->{book_max_levels}'.$skip_info, | ||||||||||||||||||||||||||||||||||||||||||||||
| 335 | SkipMedia => '[Skip]media files'.$skip_info, | ||||||||||||||||||||||||||||||||||||||||||||||
| 336 | SkipTitleEmpty => '[Skip]title is empty'.$skip_info, | ||||||||||||||||||||||||||||||||||||||||||||||
| 337 | SkipUrlEmpty => '[Skip]url is empty'."\n", | ||||||||||||||||||||||||||||||||||||||||||||||
| 338 | SkipVisited => '[Skip]visited'."\n", | ||||||||||||||||||||||||||||||||||||||||||||||
| 339 | SkipZip => '[Skip]zip files'.$skip_info, | ||||||||||||||||||||||||||||||||||||||||||||||
| 340 | }; | ||||||||||||||||||||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 27 | ▶ | sub msg_format { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
msg_format: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 27 | my ($self, $id, $pargs) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 344 | 27 | return eval('"'.$self->{messages}->{$id}.'"'); | |||||||||||||||||||||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | ▶ | sub fatal_error { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fatal_error: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | croak shift->msg_format(@_); | |||||||||||||||||||||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||||||
| 350 | #------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 351 | # Encode and decode functions | ||||||||||||||||||||||||||||||||||||||||||||||
| 352 | # $bot->en_code($string) => $octets | ||||||||||||||||||||||||||||||||||||||||||||||
| 353 | # $bot->de_code($octets) => $contents | ||||||||||||||||||||||||||||||||||||||||||||||
| 354 | #------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 84 | ▶ | sub en_code { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
en_code: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 356 | return ($_[0]->{language_encode} ne '') | ||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 84 | ▶ | ? $_[0]->{lang_encode}->encode($_[1]) : $_[1]; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 358 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 636 | ▶ | sub de_code { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
de_code: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 360 | return ($_[0]->{language_decode} ne '') | ||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 636 | ▶ | ? $_[0]->{lang_decode}->decode($_[1]) : $_[1]; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||||||
| 364 | #------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 365 | # File I/O functions | ||||||||||||||||||||||||||||||||||||||||||||||
| 366 | # $bot->file_init($filetype, $filename, @contents) => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 367 | # $bot->file_writebin($filetype, $filename, $buf) => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 368 | # $bot->file_add($filetype, $filename, @contents) => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 369 | #------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 18 | ▶ | sub file_init { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
file_init: called CC=7 SCAR=20.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 18 | my ($self, $filetype, $filename) = (shift, shift, shift); | |||||||||||||||||||||||||||||||||||||||||||||
| 372 | 18 | local(*WORK); | |||||||||||||||||||||||||||||||||||||||||||||
| 373 | 18 | ▶ | open(WORK, ">$filename") | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 374 | or $self->fatal_error("FailOpen", {filetype=>$filetype, filename=>$filename, errmsg=>$!}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 18 | ▶ | binmode(WORK) if (($filetype eq 'result') and $self->{result_no_crlf}) or $filetype eq 'debug'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
$filetype eq "result" and $self->{"result_no_crlf"} or $filetype eq "debug"
$filetype eq "result" and $self->{"result_no_crlf"}
MC/DC33%1/3
$filetype eq "result" and $self->{"result_no_crlf"} or $filetype eq "debug"
$filetype eq "result"
$self->{"result_no_crlf"}
$filetype eq "debug"
Truth table40%2/5
A and B or C
A= $filetype eq "result"B= $self->{"result_no_crlf"}C= $filetype eq "debug"
| |||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 18 | ▶ | (print WORK @_) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 377 | or $self->fatal_error("FailWrite", {filetype=>$filetype, filename=>$filename, errmsg=>$!}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 18 | ▶ | close(WORK) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 379 | or $self->fatal_error("FailClose", {filetype=>$filetype, filename=>$filename, errmsg=>$!}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 380 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 42 | ▶ | sub file_add { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
file_add: called CC=7 SCAR=20.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 42 | my ($self, $filetype, $filename) = (shift, shift, shift); | |||||||||||||||||||||||||||||||||||||||||||||
| 383 | 42 | local(*WORK); | |||||||||||||||||||||||||||||||||||||||||||||
| 384 | 42 | ▶ | open(WORK, ">>$filename") | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 385 | or $self->fatal_error("FailOpen", {filetype=>$filetype, filename=>$filename, errmsg=>$!}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 42 | ▶ | binmode(WORK) if (($filetype eq 'result') and $self->{result_no_crlf}) or $filetype eq 'debug'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
$filetype eq "result" and $self->{"result_no_crlf"} or $filetype eq "debug"
$filetype eq "result" and $self->{"result_no_crlf"}
MC/DC33%1/3
$filetype eq "result" and $self->{"result_no_crlf"} or $filetype eq "debug"
$filetype eq "result"
$self->{"result_no_crlf"}
$filetype eq "debug"
Truth table40%2/5
A and B or C
A= $filetype eq "result"B= $self->{"result_no_crlf"}C= $filetype eq "debug"
| |||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 42 | ▶ | (print WORK @_) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 388 | or $self->fatal_error("FailWrite", {filetype=>$filetype, filename=>$filename, errmsg=>$!}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 42 | ▶ | close(WORK) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 390 | or $self->fatal_error("FailClose", {filetype=>$filetype, filename=>$filename, errmsg=>$!}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 6 | ▶ | sub file_writebin { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
file_writebin: called CC=4 SCAR=14.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 6 | my ($self, $filetype, $filename) = (shift, shift, shift); | |||||||||||||||||||||||||||||||||||||||||||||
| 394 | 6 | local(*WORK); | |||||||||||||||||||||||||||||||||||||||||||||
| 395 | 6 | ▶ | sysopen(WORK, $filename, O_WRONLY|O_TRUNC|O_CREAT) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 396 | or $self->fatal_error("FailOpen", {filetype=>$filetype, filename=>$filename, errmsg=>$!}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 6 | ▶ | syswrite(WORK, $_[0], 200000000) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 398 | or $self->fatal_error("FailWrite", {filetype=>$filetype, filename=>$filename, errmsg=>$!}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 6 | ▶ | close(WORK) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 400 | or $self->fatal_error("FailClose", {filetype=>$filetype, filename=>$filename, errmsg=>$!}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||||||
| 403 | #------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 404 | # Logging functions | ||||||||||||||||||||||||||||||||||||||||||||||
| 405 | # $bot->log_msg($contents) => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 406 | # $bot->log_msgen($contents) => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 407 | # $bot->log_add($msgid, \%args) => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 408 | #------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 24 | ▶ | sub log_msg { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
log_msg: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 24 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 411 | 24 | $|=1; | |||||||||||||||||||||||||||||||||||||||||||||
| 412 | 24 | print @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 413 | 24 | $self->file_add( "log", $self->{file_log}, @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 414 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 3 | ▶ | sub log_msgen { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
log_msgen: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 417 | 3 | $self->log_msg( $self->en_code($_[0]) ); | |||||||||||||||||||||||||||||||||||||||||||||
| 418 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 12 | ▶ | sub log_add { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
log_add: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 12 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 421 | 12 | $self->log_msg( $self->msg_format(@_) ); | |||||||||||||||||||||||||||||||||||||||||||||
| 422 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||||||||||||||||
| 424 | #------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 425 | # Result output functions | ||||||||||||||||||||||||||||||||||||||||||||||
| 426 | # $bot->result_filename(\%args) => filename | ||||||||||||||||||||||||||||||||||||||||||||||
| 427 | # $bot->result_init(\%args) => filename | ||||||||||||||||||||||||||||||||||||||||||||||
| 428 | # $bot->result_add($filename, $content_en) => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 429 | # $bot->result_adden($filename, $content_de) => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 430 | # $bot->result_settime($filename, $curtime) => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 431 | # $bot->string2time($str) => $time | ||||||||||||||||||||||||||||||||||||||||||||||
| 432 | #------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 18 | ▶ | sub result_filename { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
result_filename: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 18 | my ($self, $pargs) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 435 | 18 | my $filename=$self->result_filestem($pargs).".".$pargs->{ext_save}; | |||||||||||||||||||||||||||||||||||||||||||||
| 436 | 18 | $filename=$self->de_code($filename); | |||||||||||||||||||||||||||||||||||||||||||||
| 437 | 18 | $filename=~s/[\\\/\:\*\?\"<>\|]//g; # remove banned characters | |||||||||||||||||||||||||||||||||||||||||||||
| 438 | 18 | $filename=$self->en_code($filename); | |||||||||||||||||||||||||||||||||||||||||||||
| 439 | 18 | return catfile($self->{work_dir}, $filename); | |||||||||||||||||||||||||||||||||||||||||||||
| 440 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 6 | ▶ | sub result_init { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
result_init: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 6 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 443 | 6 | my $filename = $self->result_filename(@_); | |||||||||||||||||||||||||||||||||||||||||||||
| 444 | 6 | $self->file_init( "result", $filename ); | |||||||||||||||||||||||||||||||||||||||||||||
| 445 | 6 | return $filename; | |||||||||||||||||||||||||||||||||||||||||||||
| 446 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 9 | ▶ | sub result_add { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
result_add: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 9 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 449 | 9 | my $filename = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 450 | 9 | $self->file_add( "result", $filename, $_[0] ); | |||||||||||||||||||||||||||||||||||||||||||||
| 451 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 0 | ▶ | sub result_adden { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
result_adden: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | my $filename = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | $self->file_add( "result", $filename, $self->en_code($_[0]) ); | |||||||||||||||||||||||||||||||||||||||||||||
| 456 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 3 | ▶ | sub result_settime { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
result_settime: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 3 | my ($self, $filename, $curtime) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 459 | 3 | utime $curtime, $curtime, $filename; | |||||||||||||||||||||||||||||||||||||||||||||
| 460 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 0 | ▶ | sub string2time { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
string2time: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 0 | str2time($_[1]); | |||||||||||||||||||||||||||||||||||||||||||||
| 463 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||||||||||||||||||||
| 465 | #------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 466 | # DB functions | ||||||||||||||||||||||||||||||||||||||||||||||
| 467 | # $bot->db_init => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 468 | # $bot->db_clear => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 469 | # $bot->db_load => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 470 | # $bot->db_add($type, $result, \%args) => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 471 | #------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 27 | ▶ | sub db_init { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
db_init: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 27 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 474 | 27 | $self->{DB_visited_book}={}; | |||||||||||||||||||||||||||||||||||||||||||||
| 475 | 27 | ▶ | return if -f $self->{file_DB}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 9 | my $perlcmd = $^X; | |||||||||||||||||||||||||||||||||||||||||||||
| 478 | 9 | $perlcmd=~s/\\/\//g; | |||||||||||||||||||||||||||||||||||||||||||||
| 479 | $self->file_init( "DB", $self->{file_DB}, $self->msg_format( "DBHead", { | ||||||||||||||||||||||||||||||||||||||||||||||
| 480 | perlcmd=>$perlcmd, | ||||||||||||||||||||||||||||||||||||||||||||||
| 481 | classname=>$self->{classname}, | ||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 9 | createtime=>HTTP::Date::time2iso(time), | |||||||||||||||||||||||||||||||||||||||||||||
| 483 | })); | ||||||||||||||||||||||||||||||||||||||||||||||
| 484 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 3 | ▶ | sub db_clear { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
db_clear: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 487 | 3 | my $filename = $self->{file_DB}; | |||||||||||||||||||||||||||||||||||||||||||||
| 488 | 3 | ▶ | unlink($filename) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 489 | or $self->fatal_error("FailClearDB", {filename=>$filename, errmsg=>$!}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 24 | ▶ | sub db_load { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
db_load: called CC=7 SCAR=19.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 24 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 493 | 24 | my $filename = $self->{file_DB}; | |||||||||||||||||||||||||||||||||||||||||||||
| 494 | 24 | local(*WORK); | |||||||||||||||||||||||||||||||||||||||||||||
| 495 | 24 | ▶ | open(WORK, $filename) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 496 | or $self->fatal_error("FailOpen", {filetype=>"DB", filename=>$filename, errmsg=>$!}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 24 | my ($type, $result, $url, $paras); | |||||||||||||||||||||||||||||||||||||||||||||
| 498 | 24 | ▶ | while(<WORK>) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 231 | ▶ | if( /(.)\$bot->go_([^\(]*)\((.*)\)/ ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 15 | $type=$2; | |||||||||||||||||||||||||||||||||||||||||||||
| 501 | 15 | ▶ | $result=($1 eq '#') ? 'OK' : 'Err'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 15 | ▶ | $url=($3=~/url=>\'([^\']*)\'/) ? $1 : ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 15 | $self->{"DB_visited_$type"}->{$url}=$result; | |||||||||||||||||||||||||||||||||||||||||||||
| 504 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 505 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 24 | ▶ | close(WORK) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 507 | or $self->fatal_error("FailClose", {filetype=>"DB", filename=>$filename, errmsg=>$!}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 508 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 3 | ▶ | sub db_add { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
db_add: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 3 | my ($self, $type, $result, $pargs) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 511 | 3 | ▶ | return if not defined($pargs->{url}); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 3 | my $url = $pargs->{url}; | |||||||||||||||||||||||||||||||||||||||||||||
| 513 | 3 | my $allargs = ""; | |||||||||||||||||||||||||||||||||||||||||||||
| 514 | 3 | my $str; | |||||||||||||||||||||||||||||||||||||||||||||
| 515 | 3 | foreach (sort keys %$pargs) { | |||||||||||||||||||||||||||||||||||||||||||||
| 516 | 6 | $str=$pargs->{$_}; | |||||||||||||||||||||||||||||||||||||||||||||
| 517 | 6 | $str=~s/\'/\\\'/g; | |||||||||||||||||||||||||||||||||||||||||||||
| 518 | 6 | $allargs .= "$_=>'$str', "; | |||||||||||||||||||||||||||||||||||||||||||||
| 519 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 3 | $self->{"DB_visited_$type"}->{$url}=$result; | |||||||||||||||||||||||||||||||||||||||||||||
| 521 | $self->file_add( "DB", $self->{file_DB}, | ||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 3 | $self->msg_format( "DB".ucfirst($type)."$result", {allargs=>$allargs}) ); | |||||||||||||||||||||||||||||||||||||||||||||
| 523 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||||||||||||||||||||
| 525 | #------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 526 | # Agent functions | ||||||||||||||||||||||||||||||||||||||||||||||
| 527 | # $bot->agent_init => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 528 | # $bot->agent_setproxy($ua, $proxy_name) => $proxy_settings | ||||||||||||||||||||||||||||||||||||||||||||||
| 529 | # $proxy_name eq "No" Don't use proxy | ||||||||||||||||||||||||||||||||||||||||||||||
| 530 | # $proxy_name eq "Default" suggest IE's default proxy | ||||||||||||||||||||||||||||||||||||||||||||||
| 531 | # $proxy_name eq "192.168.1.5" defined proxy | ||||||||||||||||||||||||||||||||||||||||||||||
| 532 | #------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 24 | ▶ | sub agent_init { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
agent_init: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 24 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 535 | 24 | my $cookies=new WWW::BookBot::FakeCookies; | |||||||||||||||||||||||||||||||||||||||||||||
| 536 | 24 | $self->{get_agent_cur} = 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 537 | 24 | ▶ | $self->{get_lasturl} = "" if not(defined($self->{get_lasturl})); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 24 | $self->{get_agent_array} = []; | |||||||||||||||||||||||||||||||||||||||||||||
| 539 | 24 | foreach ( split /;/, $self->{get_agent_proxy} ) { | |||||||||||||||||||||||||||||||||||||||||||||
| 540 | 27 | my $ua=new LWP::UserAgent; | |||||||||||||||||||||||||||||||||||||||||||||
| 541 | 27 | $ua->agent( $self->{get_agent_name} ); | |||||||||||||||||||||||||||||||||||||||||||||
| 542 | 27 | $self->agent_setproxy( $ua, $_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 543 | 27 | $ua->timeout( $self->{get_timeout} ); | |||||||||||||||||||||||||||||||||||||||||||||
| 544 | 27 | $ua->cookie_jar( $cookies ); | |||||||||||||||||||||||||||||||||||||||||||||
| 545 | 27 | push @{ $ua->requests_redirectable }, 'POST'; | |||||||||||||||||||||||||||||||||||||||||||||
| 546 | 27 | push @{$self->{get_agent_array}}, $ua; | |||||||||||||||||||||||||||||||||||||||||||||
| 547 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 548 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 27 | ▶ | sub agent_setproxy { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
agent_setproxy: called CC=15 SCAR=42.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 27 | my ($self, $ua, $proxy_name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 551 | 27 | $proxy_name=~s/ //g; # Remove spaces | |||||||||||||||||||||||||||||||||||||||||||||
| 552 | 27 | ▶ | return '' if $proxy_name eq 'No' or $proxy_name eq ''; #Don't use proxy | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$proxy_name eq "No" or $proxy_name eq ""
MC/DC50%1/2
$proxy_name eq "No" or $proxy_name eq ""
$proxy_name eq "No"
$proxy_name eq ""
Truth table66%2/3
A or B
A= $proxy_name eq "No"B= $proxy_name eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||||||||||||||||||||
| 554 | # Check assigned proxy | ||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 24 | ▶ | if( $proxy_name ne 'Default' ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 3 | $ua->proxy(['http','https','ftp'],"http://$proxy_name/"); | |||||||||||||||||||||||||||||||||||||||||||||
| 557 | 3 | return $proxy_name; | |||||||||||||||||||||||||||||||||||||||||||||
| 558 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||||||||||||||||||||
| 560 | # Check Win32::TieRegistry module | ||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 21 | my $ie_proxy_ok=0; | |||||||||||||||||||||||||||||||||||||||||||||
| 562 | 21 | my %RegHash; | |||||||||||||||||||||||||||||||||||||||||||||
| 563 | 21 | my $win32_registry='use Win32::TieRegistry(Delimiter=>"/", TiedHash => \%RegHash);'; | |||||||||||||||||||||||||||||||||||||||||||||
| 564 | 21 | ▶ | if( $^O eq 'MSWin32' ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 0 | eval $win32_registry; | |||||||||||||||||||||||||||||||||||||||||||||
| 566 | 0 | ▶ | $ie_proxy_ok=1 if not $@; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 567 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 21 | ▶ | return "" if not $ie_proxy_ok; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||||||||||||||||||||
| 570 | # Get IE registry | ||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 0 | my($iekey, $ie_proxy_enable, $ie_proxy_server); | |||||||||||||||||||||||||||||||||||||||||||||
| 572 | 0 | ▶ | $iekey=$RegHash{"CUser/Software/Microsoft/Windows/CurrentVersion/Internet Settings/"} | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 573 | or return ""; | ||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 0 | ▶ | $ie_proxy_enable=$iekey->{"/ProxyEnable"} or return ""; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 0 | ▶ | $ie_proxy_server=$iekey->{"/ProxyServer"} or return ""; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 0 | ▶ | return "" if !($ie_proxy_enable=~/1$/); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||||||||||||||||||||
| 578 | # Set LWP proxy | ||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 0 | ▶ | if($ie_proxy_server=~/;/) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 580 | #Multiple proxies, such as ftp=192.168.1.3:8080;...;https=192.168.1.3:8080 | ||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 0 | foreach (split(/;/, $ie_proxy_server)) { | |||||||||||||||||||||||||||||||||||||||||||||
| 582 | 0 | ▶ | next if $_ eq ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 0 | ▶ | $ua->proxy($1,"http://$2/") if /^(.*?)=(.*?)$/; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 584 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 585 | }else{ | ||||||||||||||||||||||||||||||||||||||||||||||
| 586 | #Single proxy, such as 192.168.1.3:8080 | ||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 0 | $ua->proxy(['http','https','ftp'],"http://$ie_proxy_server/"); | |||||||||||||||||||||||||||||||||||||||||||||
| 588 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 0 | return $ie_proxy_server; | |||||||||||||||||||||||||||||||||||||||||||||
| 590 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||||||||||||||||||||
| 592 | #------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 593 | # string utility functions | ||||||||||||||||||||||||||||||||||||||||||||||
| 594 | # $bot->url_rel2abs($relative, $baseurl) => $absolute_url | ||||||||||||||||||||||||||||||||||||||||||||||
| 595 | # $bot->len_KB(95632) => " 93K" | ||||||||||||||||||||||||||||||||||||||||||||||
| 596 | # $bot->string_limit($str, $limit_len) => $str_limit | ||||||||||||||||||||||||||||||||||||||||||||||
| 597 | # 'abc', 4 -> 'abc ' | ||||||||||||||||||||||||||||||||||||||||||||||
| 598 | # 'abcdef', 4 -> 'abcd' | ||||||||||||||||||||||||||||||||||||||||||||||
| 599 | #------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 9 | ▶ | sub url_rel2abs { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
url_rel2abs: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 9 | return URI->new_abs($_[1], URI->new($_[2]))->as_string; | |||||||||||||||||||||||||||||||||||||||||||||
| 602 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 9 | ▶ | sub len_KB { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
len_KB: called CC=3 SCAR=15.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 9 | my ($self, $len)=@_; | |||||||||||||||||||||||||||||||||||||||||||||
| 605 | 9 | ▶ | if($len<1024) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 606 | 9 | return sprintf("%5dB", $len); | |||||||||||||||||||||||||||||||||||||||||||||
| 607 | } elsif($len<9999*1024) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 0 | return sprintf("%5dK", $len/1024); | |||||||||||||||||||||||||||||||||||||||||||||
| 609 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 0 | return sprintf("%5dM", $len/(1024*1024)); | |||||||||||||||||||||||||||||||||||||||||||||
| 611 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 612 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 0 | ▶ | sub string_limit { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
string_limit: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 0 | my ($self, $str, $limit_len)=@_; | |||||||||||||||||||||||||||||||||||||||||||||
| 615 | 0 | $str=$self->de_code($str); | |||||||||||||||||||||||||||||||||||||||||||||
| 616 | 0 | my ($i, $j); | |||||||||||||||||||||||||||||||||||||||||||||
| 617 | 0 | ▶ | for($i=0, $j=0; $i<length($str); $i++) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 0 | ▶ | if( ord(substr($str, $i, 1))>=128 ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 0 | ▶ | last if $j+2>$limit_len; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 0 | $j+=2; | |||||||||||||||||||||||||||||||||||||||||||||
| 621 | }else{ | ||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 0 | ▶ | last if $j+1>$limit_len; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 623 | 0 | $j++; | |||||||||||||||||||||||||||||||||||||||||||||
| 624 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 625 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 0 | $str=substr($str, 0, $i).(" " x ($limit_len-$j)); | |||||||||||||||||||||||||||||||||||||||||||||
| 627 | 0 | return $self->en_code($str); | |||||||||||||||||||||||||||||||||||||||||||||
| 628 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||||||||||||||||||||
| 630 | #------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 631 | # fetch functions | ||||||||||||||||||||||||||||||||||||||||||||||
| 632 | # $bot->get_url($url) => $res | ||||||||||||||||||||||||||||||||||||||||||||||
| 633 | # $bot->get_url_request($url, $pargs) => $res | ||||||||||||||||||||||||||||||||||||||||||||||
| 634 | # $bot->get_url_request($url) | ||||||||||||||||||||||||||||||||||||||||||||||
| 635 | # $bot->get_url_request($url, {method='post', form={var=>value, var=>value}}) | ||||||||||||||||||||||||||||||||||||||||||||||
| 636 | # $bot->get_fail($msgid, $res) => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 637 | #------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 0 | ▶ | sub get_url { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_url: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 639 | 0 | my ($self, $url) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 640 | 0 | my $res; | |||||||||||||||||||||||||||||||||||||||||||||
| 641 | 0 | $self->get_url_verify($url); #verify or change $url before real work | |||||||||||||||||||||||||||||||||||||||||||||
| 642 | 0 | my %info=(url=>$url); #for display messages | |||||||||||||||||||||||||||||||||||||||||||||
| 643 | 0 | my $wait_msg=$self->msg_format('GetWait', {}); #perpare for wait message | |||||||||||||||||||||||||||||||||||||||||||||
| 644 | |||||||||||||||||||||||||||||||||||||||||||||||
| 645 | 0 | ▶ | for(my $i=$self->{get_max_retries}; $i>0; $i--) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 646 | #issues real request | ||||||||||||||||||||||||||||||||||||||||||||||
| 647 | 0 | $res=$self->get_url_request($url); | |||||||||||||||||||||||||||||||||||||||||||||
| 648 | |||||||||||||||||||||||||||||||||||||||||||||||
| 649 | #record infos for display messages | ||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 0 | $info{retry}=$i; | |||||||||||||||||||||||||||||||||||||||||||||
| 651 | 0 | $info{code}=$res->code; | |||||||||||||||||||||||||||||||||||||||||||||
| 652 | 0 | $info{len}=length($res->content); | |||||||||||||||||||||||||||||||||||||||||||||
| 653 | 0 | $info{len_KB}=$self->len_KB($info{len}); | |||||||||||||||||||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||||||||||||||||||||
| 655 | # display before sleep | ||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 0 | ▶ | $self->log_add("GetURLSuccess", \%info) if $res->is_success; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 0 | ▶ | $self->get_fail("GetFail404", $res) if $res->code==404; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 658 | |||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 0 | ▶ | if($self->{get_delay_second}>0) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 660 | # sleep if needed | ||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 0 | print $wait_msg; | |||||||||||||||||||||||||||||||||||||||||||||
| 662 | 0 | sleep $self->{get_delay_second}+rand($self->{get_delay_second_rand}); | |||||||||||||||||||||||||||||||||||||||||||||
| 663 | 0 | print "\b" x length($wait_msg); | |||||||||||||||||||||||||||||||||||||||||||||
| 664 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 665 | |||||||||||||||||||||||||||||||||||||||||||||||
| 666 | # return or display after sleep | ||||||||||||||||||||||||||||||||||||||||||||||
| 667 | 0 | ▶ | return $res if $res->is_success or $res->code==404; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$res->is_success or $res->code == 404
MC/DC0%0/2
$res->is_success or $res->code == 404
$res->is_success
$res->code == 404
Truth table0%0/3
A or B
A= $res->is_successB= $res->code == 404
| |||||||||||||||||||||||||||||||||||||||||||||||
| 668 | 0 | ▶ | $self->log_add("GetURLRetry", \%info) if $i>1; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 669 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 0 | $self->get_fail("GetFailRetries", $res); | |||||||||||||||||||||||||||||||||||||||||||||
| 671 | 0 | return $res; | |||||||||||||||||||||||||||||||||||||||||||||
| 672 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 673 | 0 | ▶ | sub get_url_request { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_url_request: not called CC=11 SCAR=48.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 674 | 0 | my ($self, $url, $pargs) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 675 | |||||||||||||||||||||||||||||||||||||||||||||||
| 676 | # prepare for parameters | ||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 0 | ▶ | $pargs={} if not(ref($pargs)); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 678 | 0 | ▶ | $self->{get_lasturl}=$url if $self->{get_lasturl} eq ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 0 | $self->{get_visited_url_num}++; | |||||||||||||||||||||||||||||||||||||||||||||
| 680 | 0 | ▶ | $url='file:'.$self->{get_file_directory_read}.'/'.$self->{get_visited_url_num}.'.htm' if $self->{get_from_file}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 0 | my $agent=$self->{get_agent_array}->[$self->{get_agent_cur}]; | |||||||||||||||||||||||||||||||||||||||||||||
| 682 | 0 | ▶ | my $method=defined($pargs->{method}) ? $pargs->{method} : 'get'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 683 | my %header=( | ||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 'Accept' => '*/*', | ||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 'Referer' => $self->{get_lasturl}, | ||||||||||||||||||||||||||||||||||||||||||||||
| 686 | 'Accept-Language' => $self->{get_language}, | ||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||||||
| 688 | |||||||||||||||||||||||||||||||||||||||||||||||
| 689 | # trunk display vars | ||||||||||||||||||||||||||||||||||||||||||||||
| 690 | 0 | my $get_trunk_size=$self->{get_trunk_size}; | |||||||||||||||||||||||||||||||||||||||||||||
| 691 | 0 | my $screen_limit_trunk=$self->{screen_limit_trunk}; | |||||||||||||||||||||||||||||||||||||||||||||
| 692 | 0 | my $get_trunk_fresh_size=$self->{get_trunk_fresh_size}; | |||||||||||||||||||||||||||||||||||||||||||||
| 693 | 0 | my ($first_run, $expected_length, $expected_trunks, $bytes_received, $trunk_received)=(1,0,0,0,0); | |||||||||||||||||||||||||||||||||||||||||||||
| 694 | 0 | my @trunk_statuschar=qw(- \ | /); | |||||||||||||||||||||||||||||||||||||||||||||
| 695 | 0 | my ($trunk_status, $trunk_now, $trunk_refresh_now, $trunk_ceil, $trunk_floor)=(0, 0,0,0,0); | |||||||||||||||||||||||||||||||||||||||||||||
| 696 | 0 | my ($str_display, $bak_number); | |||||||||||||||||||||||||||||||||||||||||||||
| 697 | |||||||||||||||||||||||||||||||||||||||||||||||
| 698 | # get it | ||||||||||||||||||||||||||||||||||||||||||||||
| 699 | my $res = $agent->request( | ||||||||||||||||||||||||||||||||||||||||||||||
| 700 | $method eq 'get' ? GET($url, %header) : POST($url, $pargs->{form}, %header) , | ||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 0 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=15 SCAR=54.8
| |||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 0 | ▶ | if($first_run) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 703 | # first get, then caculate expected length and print | ||||||||||||||||||||||||||||||||||||||||||||||
| 704 | 0 | $first_run=0; | |||||||||||||||||||||||||||||||||||||||||||||
| 705 | 0 | $expected_length=$_[1]->headers->content_length; | |||||||||||||||||||||||||||||||||||||||||||||
| 706 | 0 | ▶ | if($expected_length>0) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 707 | 0 | $expected_trunks=ceil($expected_length/$get_trunk_size); | |||||||||||||||||||||||||||||||||||||||||||||
| 708 | 0 | ▶ | $expected_trunks=$screen_limit_trunk if $expected_trunks>$screen_limit_trunk; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 0 | $str_display="." x $expected_trunks; | |||||||||||||||||||||||||||||||||||||||||||||
| 710 | 0 | $str_display.=" " x ($screen_limit_trunk-$expected_trunks); | |||||||||||||||||||||||||||||||||||||||||||||
| 711 | 0 | ▶ | $str_display.=$self->len_KB($expected_length) if $expected_length>0; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 0 | $str_display.="\b" x length($str_display); | |||||||||||||||||||||||||||||||||||||||||||||
| 713 | 0 | print $str_display; | |||||||||||||||||||||||||||||||||||||||||||||
| 714 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 715 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 0 | $bytes_received += length($_[0]); | |||||||||||||||||||||||||||||||||||||||||||||
| 717 | 0 | $trunk_ceil=ceil($bytes_received/$get_trunk_size); | |||||||||||||||||||||||||||||||||||||||||||||
| 718 | 0 | ▶ | $trunk_ceil=$screen_limit_trunk if $trunk_ceil>$screen_limit_trunk; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 719 | 0 | $trunk_floor=floor($bytes_received/$get_trunk_size); | |||||||||||||||||||||||||||||||||||||||||||||
| 720 | 0 | ▶ | $trunk_floor=$screen_limit_trunk-1 if $trunk_floor>$screen_limit_trunk-1; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 721 | 0 | $str_display=""; | |||||||||||||||||||||||||||||||||||||||||||||
| 722 | 0 | $bak_number=0; | |||||||||||||||||||||||||||||||||||||||||||||
| 723 | 0 | ▶ | if($trunk_floor>$trunk_received) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 724 | 0 | $str_display.= ">" x ($trunk_floor - $trunk_received); | |||||||||||||||||||||||||||||||||||||||||||||
| 725 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 726 | 0 | ▶ | if($trunk_floor<$trunk_ceil and $bytes_received>=$trunk_refresh_now+$get_trunk_fresh_size) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$trunk_floor < $trunk_ceil and $bytes_received >= $trunk_refresh_now + $get_trunk_fresh_size
MC/DC0%0/2
$trunk_floor < $trunk_ceil and $bytes_received >= $trunk_refresh_now + $get_trunk_fresh_size
$trunk_floor < $trunk_ceil
$bytes_received >= $trunk_refresh_now + $get_trunk_fresh_size
Truth table0%0/3
A and B
A= $trunk_floor < $trunk_ceilB= $bytes_received >= $trunk_refresh_now + $get_trunk_fresh_size
| |||||||||||||||||||||||||||||||||||||||||||||||
| 727 | 0 | ▶ | $trunk_status=0 if ++$trunk_status>=scalar(@trunk_statuschar); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 0 | $str_display.= $trunk_statuschar[$trunk_status]; | |||||||||||||||||||||||||||||||||||||||||||||
| 729 | 0 | $bak_number++; | |||||||||||||||||||||||||||||||||||||||||||||
| 730 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 731 | 0 | ▶ | if($bytes_received>=$trunk_refresh_now+$get_trunk_fresh_size) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 732 | 0 | ▶ | if($expected_length>0 and $trunk_ceil>=$screen_limit_trunk) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$expected_length > 0 and $trunk_ceil >= $screen_limit_trunk
MC/DC0%0/2
$expected_length > 0 and $trunk_ceil >= $screen_limit_trunk
$expected_length > 0
$trunk_ceil >= $screen_limit_trunk
Truth table0%0/3
A and B
A= $expected_length > 0B= $trunk_ceil >= $screen_limit_trunk
| |||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 0 | my $trunk_percent=int(100*$bytes_received/$expected_length); | |||||||||||||||||||||||||||||||||||||||||||||
| 734 | 0 | ▶ | $trunk_percent=100 if $trunk_percent>100; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 735 | 0 | $str_display.= " $trunk_percent%"; | |||||||||||||||||||||||||||||||||||||||||||||
| 736 | 0 | $bak_number+=length($trunk_percent)+4; | |||||||||||||||||||||||||||||||||||||||||||||
| 737 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 738 | 0 | $trunk_refresh_now=$bytes_received; | |||||||||||||||||||||||||||||||||||||||||||||
| 739 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 740 | 0 | print $str_display. "\b" x $bak_number; | |||||||||||||||||||||||||||||||||||||||||||||
| 741 | 0 | $trunk_received=$trunk_floor; | |||||||||||||||||||||||||||||||||||||||||||||
| 742 | 0 | $_[1]->add_content(\$_[0]); | |||||||||||||||||||||||||||||||||||||||||||||
| 743 | }, | ||||||||||||||||||||||||||||||||||||||||||||||
| 744 | 0 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 745 | |||||||||||||||||||||||||||||||||||||||||||||||
| 746 | # print rest trunks | ||||||||||||||||||||||||||||||||||||||||||||||
| 747 | 0 | print ">" x ($trunk_ceil - $trunk_received); | |||||||||||||||||||||||||||||||||||||||||||||
| 748 | 0 | ▶ | print " " x ($screen_limit_trunk - $trunk_ceil) if $res->is_success; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 749 | |||||||||||||||||||||||||||||||||||||||||||||||
| 750 | # status processing | ||||||||||||||||||||||||||||||||||||||||||||||
| 751 | 0 | ▶ | $self->{get_lasturl}=$url if $res->is_success; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 752 | 0 | ▶ | $self->{get_agent_cur}=0 if ++$self->{get_agent_cur} >= @{$self->{get_agent_array}}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 753 | 0 | ▶ | if( $res->is_success and $self->{get_save_file} ){ | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$res->is_success and $self->{"get_save_file"}
MC/DC0%0/2
$res->is_success and $self->{"get_save_file"}
$res->is_success
$self->{"get_save_file"}
Truth table0%0/3
A and B
A= $res->is_successB= $self->{"get_save_file"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 754 | #debug writing | ||||||||||||||||||||||||||||||||||||||||||||||
| 755 | $self->file_writebin('debug', | ||||||||||||||||||||||||||||||||||||||||||||||
| 756 | 0 | catfile($self->{get_file_directory_save}, $self->{get_visited_url_num}.'.htm'), | |||||||||||||||||||||||||||||||||||||||||||||
| 757 | $res->content); | ||||||||||||||||||||||||||||||||||||||||||||||
| 758 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 759 | 0 | return $res; | |||||||||||||||||||||||||||||||||||||||||||||
| 760 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 761 | 0 | ▶ | sub get_fail { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_fail: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 762 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 763 | 0 | my $msgid = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 764 | 0 | my $url_real=""; | |||||||||||||||||||||||||||||||||||||||||||||
| 765 | 0 | ▶ | $url_real=$_[0]->request->uri->as_string if defined($_[0]->request->uri); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 766 | $self->log_add($msgid.$self->{get_fail_showtype}, { | ||||||||||||||||||||||||||||||||||||||||||||||
| 767 | 0 | code => $_[0]->code, | |||||||||||||||||||||||||||||||||||||||||||||
| 768 | req_content => $_[0]->request->as_string, | ||||||||||||||||||||||||||||||||||||||||||||||
| 769 | status_line => $_[0]->status_line, | ||||||||||||||||||||||||||||||||||||||||||||||
| 770 | res_content => $_[0]->as_string, | ||||||||||||||||||||||||||||||||||||||||||||||
| 771 | url_real => $url_real, | ||||||||||||||||||||||||||||||||||||||||||||||
| 772 | }); | ||||||||||||||||||||||||||||||||||||||||||||||
| 773 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 774 | |||||||||||||||||||||||||||||||||||||||||||||||
| 775 | #------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 776 | # Parser utility functions | ||||||||||||||||||||||||||||||||||||||||||||||
| 777 | # $bot->normalize_space($content_dein_deout) => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 778 | # $bot->remove_html($content_dein_deout) => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 779 | # $bot->decode_entity($content_dein_deout) => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 780 | # $bot->normalize_paragraph_1($content_dein_deout) => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 781 | # $bot->parse_title($content_dein_deout) => $content_deout | ||||||||||||||||||||||||||||||||||||||||||||||
| 782 | # $bot->parse_titleen($content_dein_deout) => $content_enout | ||||||||||||||||||||||||||||||||||||||||||||||
| 783 | # $bot->normalize_paragraph($content_dein_deout) => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 784 | # $bot->remove_line_by_end($content_dein_deout) | ||||||||||||||||||||||||||||||||||||||||||||||
| 785 | # $bot->parse_paragraph_br($content_dein_deout) | ||||||||||||||||||||||||||||||||||||||||||||||
| 786 | # $bot->parse_paragraph_brbr($content_dein_deout) | ||||||||||||||||||||||||||||||||||||||||||||||
| 787 | # $bot->parse_paragraph_brandspace($content_dein_deout) | ||||||||||||||||||||||||||||||||||||||||||||||
| 788 | # $bot->parse_paragraph_brbr_or_brandspace($content_dein_deout) | ||||||||||||||||||||||||||||||||||||||||||||||
| 789 | # $bot->parse_paragraph_cr($content_dein_deout) | ||||||||||||||||||||||||||||||||||||||||||||||
| 790 | # $bot->parse_paragraph_crcr($content_dein_deout) | ||||||||||||||||||||||||||||||||||||||||||||||
| 791 | # $bot->parse_paragraph_crandspace($content_dein_deout) | ||||||||||||||||||||||||||||||||||||||||||||||
| 792 | # $bot->remove_leadingspace($content_dein_deout) | ||||||||||||||||||||||||||||||||||||||||||||||
| 793 | # $bot->remove_innerspace($content_dein_deout) | ||||||||||||||||||||||||||||||||||||||||||||||
| 794 | #------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 795 | 24 | ▶ | sub normalize_space { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
normalize_space: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 796 | 24 | $_[1]=~s/$_[0]->{patterns}->{space}/ /osg; | |||||||||||||||||||||||||||||||||||||||||||||
| 797 | 24 | $_[1]=~s/$_[0]->{patterns}->{space2}/ /osg; | |||||||||||||||||||||||||||||||||||||||||||||
| 798 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 799 | 24 | ▶ | sub remove_html { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
remove_html: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 800 | 24 | $_[1]=~s/$_[0]->{patterns}->{remove_html}//osg; | |||||||||||||||||||||||||||||||||||||||||||||
| 801 | 24 | $_[1]=~s/<[^<>]*>//osg; | |||||||||||||||||||||||||||||||||||||||||||||
| 802 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 803 | 16 | ▶ | sub decode_entity { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
decode_entity: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 804 | 16 | $_[1]=~s/(?:&\#(\d{1,5});?)/chr($1)/esg; | |||||||||||||||||||||||||||||||||||||||||||||
| 805 | 0 | $_[1]=~s/(?:&\#[xX]([0-9a-fA-F]{1,5});?)/chr(hex($1))/esg; | |||||||||||||||||||||||||||||||||||||||||||||
| 806 | 16 | ▶ | $_[1]=~s/(&([0-9a-zA-Z]{1,9});?)/$entity2char{$2} or $1/esg; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$WWW::BookBot::entity2char{$2} || $1
MC/DC0%0/2
$WWW::BookBot::entity2char{$2} || $1
$WWW::BookBot::entity2char{$2}
$1
Truth table33%1/3
A || B
A= $WWW::BookBot::entity2char{$2}B= $1
| |||||||||||||||||||||||||||||||||||||||||||||||
| 807 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 808 | 33 | ▶ | sub normalize_paragraph_1 { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
normalize_paragraph_1: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 809 | 33 | $_[1]=~s/^ +/ /mg; #normalize spaces before paragraph | |||||||||||||||||||||||||||||||||||||||||||||
| 810 | 33 | $_[1]=~s/ +$//mg; #remove spaces after paragraph | |||||||||||||||||||||||||||||||||||||||||||||
| 811 | 33 | $_[1]=~s/^ ?(?:$_[0]->{patterns}->{mark_dash} *){2,}/ ---/omg; | |||||||||||||||||||||||||||||||||||||||||||||
| 812 | #normalize repeated dash | ||||||||||||||||||||||||||||||||||||||||||||||
| 813 | 33 | $_[1]=~s/\n{2,}/\n/sg; #remove empty paragraph | |||||||||||||||||||||||||||||||||||||||||||||
| 814 | 33 | $_[1]=~s/(?: ---\n?){2,}/ ---\n/sg; #remove too much dash line | |||||||||||||||||||||||||||||||||||||||||||||
| 815 | 33 | $_[1]=~s/(?:^\n|\n$)//s; #remove leading and ending \n | |||||||||||||||||||||||||||||||||||||||||||||
| 816 | 33 | $_[1]=~s/$_[0]->{patterns}->{word_finish}//os; #remove finish words | |||||||||||||||||||||||||||||||||||||||||||||
| 817 | 33 | $_[1]=~s/\n$//s; #remove ending \n | |||||||||||||||||||||||||||||||||||||||||||||
| 818 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 819 | 12 | ▶ | sub parse_title { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_title: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 12 | $_[0]->normalize_space($_[1]); | |||||||||||||||||||||||||||||||||||||||||||||
| 821 | 12 | $_[0]->remove_html($_[1]); | |||||||||||||||||||||||||||||||||||||||||||||
| 822 | 12 | $_[0]->decode_entity($_[1]); | |||||||||||||||||||||||||||||||||||||||||||||
| 823 | 12 | $_[1]=~s/\n+/ /sg; # CRLF as space | |||||||||||||||||||||||||||||||||||||||||||||
| 824 | 12 | $_[0]->normalize_paragraph_1($_[1]); | |||||||||||||||||||||||||||||||||||||||||||||
| 825 | 12 | $_[1]=~s/ +/ /sg; #remove extra spaces | |||||||||||||||||||||||||||||||||||||||||||||
| 826 | |||||||||||||||||||||||||||||||||||||||||||||||
| 827 | #remove ending space or wordsplit mark | ||||||||||||||||||||||||||||||||||||||||||||||
| 828 | 12 | my $p1=$_[0]->{patterns}->{mark_wordsplit}; | |||||||||||||||||||||||||||||||||||||||||||||
| 829 | 12 | $p1=~s/(?:^\[|\]$)//sg; | |||||||||||||||||||||||||||||||||||||||||||||
| 830 | 12 | $p1="[".$p1." ]"; | |||||||||||||||||||||||||||||||||||||||||||||
| 831 | 12 | $_[1]=~s/$p1+$//os; | |||||||||||||||||||||||||||||||||||||||||||||
| 832 | |||||||||||||||||||||||||||||||||||||||||||||||
| 833 | #remove paraentheses | ||||||||||||||||||||||||||||||||||||||||||||||
| 834 | 12 | $_[1]=~s/(?:^ +| +$)//sg; | |||||||||||||||||||||||||||||||||||||||||||||
| 835 | 12 | ▶ | while($_[1]=~/^(?:$_[0]->{patterns}->{parentheses})$/os) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 836 | 3 | $_[1]=$^N; | |||||||||||||||||||||||||||||||||||||||||||||
| 837 | 3 | $_[1]=~s/(?:^ +| +$)//sg; | |||||||||||||||||||||||||||||||||||||||||||||
| 838 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 839 | |||||||||||||||||||||||||||||||||||||||||||||||
| 840 | 12 | $_[1]; | |||||||||||||||||||||||||||||||||||||||||||||
| 841 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 842 | 6 | ▶ | sub parse_titleen { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_titleen: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 843 | 6 | $_[0]->en_code($_[0]->parse_title($_[1])); | |||||||||||||||||||||||||||||||||||||||||||||
| 844 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 845 | 9 | ▶ | sub normalize_paragraph { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
normalize_paragraph: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 846 | 9 | $_[0]->normalize_space($_[1]); | |||||||||||||||||||||||||||||||||||||||||||||
| 847 | 9 | $_[0]->parse_paragraph_begin($_[1]); | |||||||||||||||||||||||||||||||||||||||||||||
| 848 | 9 | my $sub="parse_paragraph_".$_[0]->{text_paragraph_type}; | |||||||||||||||||||||||||||||||||||||||||||||
| 849 | 9 | $_[0]->$sub($_[1]); | |||||||||||||||||||||||||||||||||||||||||||||
| 850 | 9 | $_[0]->remove_html($_[1]); | |||||||||||||||||||||||||||||||||||||||||||||
| 851 | 9 | $_[0]->decode_entity($_[1]); | |||||||||||||||||||||||||||||||||||||||||||||
| 852 | 9 | $_[0]->normalize_paragraph_1($_[1]); | |||||||||||||||||||||||||||||||||||||||||||||
| 853 | 9 | $_[0]->remove_line_by_end($_[1]); | |||||||||||||||||||||||||||||||||||||||||||||
| 854 | 9 | $_[0]->normalize_paragraph_1($_[1]); | |||||||||||||||||||||||||||||||||||||||||||||
| 855 | 9 | $_[0]->parse_paragraph_end($_[1]); | |||||||||||||||||||||||||||||||||||||||||||||
| 856 | 9 | $_[1]=~s/ ?\$BOOKBOTRETURN\$//sg; #remove for reserved return | |||||||||||||||||||||||||||||||||||||||||||||
| 857 | 9 | $sub='$_[1]=~s/^ /'.$_[0]->{patterns}->{line_head}.'/mg;'; #normalize with 4 spaces | |||||||||||||||||||||||||||||||||||||||||||||
| 858 | 9 | eval $sub; | |||||||||||||||||||||||||||||||||||||||||||||
| 859 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 860 | 9 | ▶ | sub remove_line_by_end { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
remove_line_by_end: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 861 | 9 | $_[1]=~s/(?:---\n|\n).*(?:$_[0]->{patterns}->{remove_line_by_end})$_[0]->{patterns}->{parentheses_right}?$//omg; | |||||||||||||||||||||||||||||||||||||||||||||
| 862 | 9 | $_[1]=~s/\n $_[0]->{patterns}->{remove_line_by_end_special}$//osg; | |||||||||||||||||||||||||||||||||||||||||||||
| 863 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 864 | 9 | ▶ | sub parse_paragraph_br { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_paragraph_br: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 865 | 9 | $_[1]=~s/\n//sg; | |||||||||||||||||||||||||||||||||||||||||||||
| 866 | 9 | $_[1]=~s/<[bB][rR]> */\n /sg; | |||||||||||||||||||||||||||||||||||||||||||||
| 867 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 868 | 0 | ▶ | sub parse_paragraph_brbr { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_paragraph_brbr: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 869 | 0 | $_[1]=~s/\n//sg; | |||||||||||||||||||||||||||||||||||||||||||||
| 870 | 0 | $_[1]=~s/(?:<[bB][rR]> *){2,}/\n /sg; | |||||||||||||||||||||||||||||||||||||||||||||
| 871 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 872 | 0 | ▶ | sub parse_paragraph_brandspace { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_paragraph_brandspace: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 873 | 0 | $_[1]=~s/\n//sg; | |||||||||||||||||||||||||||||||||||||||||||||
| 874 | 0 | $_[1]=~s/<[bB][rR]>(?=[^ ])//sg; | |||||||||||||||||||||||||||||||||||||||||||||
| 875 | 0 | $_[1]=~s/<[bB][rR]> */\n /sg; | |||||||||||||||||||||||||||||||||||||||||||||
| 876 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 877 | 0 | ▶ | sub parse_paragraph_brbr_or_brandspace { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_paragraph_brbr_or_brandspace: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 878 | 0 | $_[1]=~s/\n//sg; | |||||||||||||||||||||||||||||||||||||||||||||
| 879 | 0 | $_[1]=~s/<[bB][rR]>(?=[^ <])//sg; | |||||||||||||||||||||||||||||||||||||||||||||
| 880 | 0 | $_[1]=~s/(?:<[bB][rR]> *){1,}/\n /sg; | |||||||||||||||||||||||||||||||||||||||||||||
| 881 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 882 | 0 | ▶ | sub parse_paragraph_br_or_p { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_paragraph_br_or_p: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 883 | 0 | $_[1]=~s/\n/ /sg; | |||||||||||||||||||||||||||||||||||||||||||||
| 884 | 0 | $_[1]=~s/<[bB\/][rRpP]>/\n/sg; | |||||||||||||||||||||||||||||||||||||||||||||
| 885 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 886 | 0 | ▶ | sub parse_paragraph_cr { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_paragraph_cr: not called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 887 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 888 | 0 | ▶ | sub parse_paragraph_crcr { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_paragraph_crcr: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 889 | 0 | $_[1]=~s/(?<=[^\n])\n(?=[^\n])//sg; #remove single \n | |||||||||||||||||||||||||||||||||||||||||||||
| 890 | 0 | $_[1]=~s/\n{2,}/\n/sg; #change multiple \n into one \n | |||||||||||||||||||||||||||||||||||||||||||||
| 891 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 892 | 0 | ▶ | sub parse_paragraph_crandspace { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_paragraph_crandspace: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 893 | 0 | $_[1]=~s/\n(?=[^ ])//sg; #remove \n without " " followed | |||||||||||||||||||||||||||||||||||||||||||||
| 894 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 895 | 0 | ▶ | sub remove_leadingspace { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
remove_leadingspace: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 896 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 897 | 0 | ▶ | return if not $self->{space_leading_remove}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 898 | 0 | ▶ | for(my $i=$self->{space_leading_max}; $i>0; $i--) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 899 | 0 | my $spaces=" " x $i; | |||||||||||||||||||||||||||||||||||||||||||||
| 900 | 0 | my $linefollow=$spaces."[^ ].*?\n"; | |||||||||||||||||||||||||||||||||||||||||||||
| 901 | 0 | ▶ | if( $_[0]=~/\n$spaces .*?\n$linefollow$linefollow$linefollow/o ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 902 | 0 | $_[0]=~s/\n$spaces/\n/og; | |||||||||||||||||||||||||||||||||||||||||||||
| 903 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||
| 904 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 905 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 906 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 907 | 0 | ▶ | sub remove_innerspace { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
remove_innerspace: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 908 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 909 | 0 | ▶ | return if not $self->{space_inner_remove}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 910 | |||||||||||||||||||||||||||||||||||||||||||||||
| 911 | 0 | my $pattern='\w ' x $self->{space_inner_min_words}; | |||||||||||||||||||||||||||||||||||||||||||||
| 912 | 0 | ▶ | return if not $_[0]=~/$pattern/o; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 913 | |||||||||||||||||||||||||||||||||||||||||||||||
| 914 | 0 | my ($str) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 915 | 0 | $pattern=$self->{patterns}->{mark_wordsplit}; | |||||||||||||||||||||||||||||||||||||||||||||
| 916 | 0 | $pattern=~s/\|//og; | |||||||||||||||||||||||||||||||||||||||||||||
| 917 | 0 | $_[0]=~s/(?<=[^$pattern\s])\s(?=\S)//omg; | |||||||||||||||||||||||||||||||||||||||||||||
| 918 | 0 | $_[0]=~s/(?<=\S)\s\s(?=\S)/ /omg; | |||||||||||||||||||||||||||||||||||||||||||||
| 919 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 920 | |||||||||||||||||||||||||||||||||||||||||||||||
| 921 | #------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 922 | # Parser main functions | ||||||||||||||||||||||||||||||||||||||||||||||
| 923 | # $bot->go_catalog(\%args) => $booknum | ||||||||||||||||||||||||||||||||||||||||||||||
| 924 | # url | ||||||||||||||||||||||||||||||||||||||||||||||
| 925 | # $bot->catalog_get_book(\%args, $content_dein) => @books | ||||||||||||||||||||||||||||||||||||||||||||||
| 926 | # $bot->catalog_get_next(\%args, $content_dein) => $booknum, 0-no next | ||||||||||||||||||||||||||||||||||||||||||||||
| 927 | # $bot->go_book(\%args) => $content_de | ||||||||||||||||||||||||||||||||||||||||||||||
| 928 | # level, bpos, book_num, url, title | ||||||||||||||||||||||||||||||||||||||||||||||
| 929 | # $bot->book_html(\%args, $content_enin_deout) => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 930 | # $bot->book_text(\%args, $content_enin_deout) => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 931 | # $bot->book_bin(\%args, $content_enin_deout) => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 932 | # $bot->book_writebin(\%args, $content_bin) => $filebasename_de | ||||||||||||||||||||||||||||||||||||||||||||||
| 933 | # $bot->book_chapters(\%args, $content_dein) => @chapters | ||||||||||||||||||||||||||||||||||||||||||||||
| 934 | # () means this is a chapter or wrong | ||||||||||||||||||||||||||||||||||||||||||||||
| 935 | # ({url=>..., title=>..., ...}, {}) means chapters | ||||||||||||||||||||||||||||||||||||||||||||||
| 936 | # $bot->TOC_parser(\%args, $content_dein_deout) => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 937 | # $bot->chapter_process(\%args, $content_dein_deout) => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 938 | # $bot->chapter_parser(\%args, $content_dein_deout) => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 939 | #------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 940 | 0 | ▶ | sub go_catalog { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
go_catalog: not called CC=9 SCAR=45.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 941 | 0 | my ($self, $pargs) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 942 | 0 | ▶ | $pargs={} if not(ref($pargs)); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 943 | 0 | my %args_orig=%$pargs; #keep original args | |||||||||||||||||||||||||||||||||||||||||||||
| 944 | 0 | $pargs->{url}=$self->msg_format('CatalogURL', $pargs); | |||||||||||||||||||||||||||||||||||||||||||||
| 945 | 0 | $self->log_add('CatalogInfo', $pargs); | |||||||||||||||||||||||||||||||||||||||||||||
| 946 | |||||||||||||||||||||||||||||||||||||||||||||||
| 947 | # Get it | ||||||||||||||||||||||||||||||||||||||||||||||
| 948 | 0 | ▶ | if( $pargs->{url} eq '' ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 949 | 0 | $self->log_add('CatalogURLEmpty', $pargs); | |||||||||||||||||||||||||||||||||||||||||||||
| 950 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 951 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 952 | 0 | my $res=$self->get_url($pargs->{url}); | |||||||||||||||||||||||||||||||||||||||||||||
| 953 | 0 | ▶ | if( not($res->is_success) ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 954 | 0 | $self->db_add("catalog", "Err", \%args_orig); | |||||||||||||||||||||||||||||||||||||||||||||
| 955 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 956 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 957 | 0 | $pargs->{url_real}=$res->request->uri->as_string; | |||||||||||||||||||||||||||||||||||||||||||||
| 958 | 0 | $pargs->{url_base}=$res->base->as_string; | |||||||||||||||||||||||||||||||||||||||||||||
| 959 | 0 | my $str=$self->de_code($res->content); | |||||||||||||||||||||||||||||||||||||||||||||
| 960 | 0 | undef $res; | |||||||||||||||||||||||||||||||||||||||||||||
| 961 | 0 | $str=~s/\r\n|\r/\n/sg; | |||||||||||||||||||||||||||||||||||||||||||||
| 962 | 0 | my $str_all=$str; | |||||||||||||||||||||||||||||||||||||||||||||
| 963 | |||||||||||||||||||||||||||||||||||||||||||||||
| 964 | # Parse books | ||||||||||||||||||||||||||||||||||||||||||||||
| 965 | 0 | ▶ | $str=~s/^.*?$self->{patterns}->{catalog_head}//os if $self->{patterns}->{catalog_head} ne ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 966 | 0 | ▶ | $str=~s/$self->{patterns}->{catalog_end}.*$//os if $self->{patterns}->{catalog_end} ne ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 967 | 0 | my @books=$self->catalog_get_book($pargs, $str); | |||||||||||||||||||||||||||||||||||||||||||||
| 968 | 0 | undef $str; | |||||||||||||||||||||||||||||||||||||||||||||
| 969 | 0 | $pargs->{book_num}=scalar(@books); | |||||||||||||||||||||||||||||||||||||||||||||
| 970 | 0 | ▶ | $self->log_add('CatalogResult'.($pargs->{book_num}>0 ? 'OK' : 'Err'), $pargs); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 971 | 0 | ▶ | $self->db_add("catalog", $pargs->{book_num}>0 ? 'OK' : 'Err', \%args_orig); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 972 | |||||||||||||||||||||||||||||||||||||||||||||||
| 973 | # Parse next area | ||||||||||||||||||||||||||||||||||||||||||||||
| 974 | 0 | my $go_next=$self->catalog_get_next($pargs, $str_all); | |||||||||||||||||||||||||||||||||||||||||||||
| 975 | 0 | undef $str_all; | |||||||||||||||||||||||||||||||||||||||||||||
| 976 | |||||||||||||||||||||||||||||||||||||||||||||||
| 977 | # Get books | ||||||||||||||||||||||||||||||||||||||||||||||
| 978 | 0 | ▶ | for(my $bpos=0; $bpos<$pargs->{book_num}; $bpos++) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 979 | 0 | $books[$bpos]->{book_num}=$pargs->{book_num}; | |||||||||||||||||||||||||||||||||||||||||||||
| 980 | 0 | $books[$bpos]->{bpos}=$bpos+1; | |||||||||||||||||||||||||||||||||||||||||||||
| 981 | 0 | $self->go_book($books[$bpos]); | |||||||||||||||||||||||||||||||||||||||||||||
| 982 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 983 | |||||||||||||||||||||||||||||||||||||||||||||||
| 984 | 0 | return $go_next; | |||||||||||||||||||||||||||||||||||||||||||||
| 985 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 986 | 6 | ▶ | sub catalog_get_book { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
catalog_get_book: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 987 | 6 | my ($self, $pargs) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||||||
| 988 | 6 | my @books = (); | |||||||||||||||||||||||||||||||||||||||||||||
| 989 | 6 | ▶ | while($_[0]=~/$self->{patterns}->{catalog_get_bookargs}/osg) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 990 | 3 | my $pargs1={}; | |||||||||||||||||||||||||||||||||||||||||||||
| 991 | 3 | ▶ | next if $self->catalog_get_bookargs($pargs1, $1, $2, $3, $4, $5, $6, $7, $8, $9) eq 'Skip'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 992 | 3 | $pargs1->{url}=$self->url_rel2abs($pargs1->{url}, $pargs->{url_base}); | |||||||||||||||||||||||||||||||||||||||||||||
| 993 | 3 | push @books, $pargs1; | |||||||||||||||||||||||||||||||||||||||||||||
| 994 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 995 | 6 | return @books; | |||||||||||||||||||||||||||||||||||||||||||||
| 996 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 997 | 0 | ▶ | sub catalog_get_next { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
catalog_get_next: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 998 | 0 | my ($self, $pargs) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||||||
| 999 | 0 | ▶ | return $pargs->{book_num} if $self->{patterns}->{catalog_get_next} eq ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | 0 | ▶ | return $_[0]=~/$self->{patterns}->{catalog_get_next}/os ? $pargs->{book_num} : 0; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | 0 | ▶ | sub go_book { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
go_book: not called CC=22 SCAR=62.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | 0 | my ($self, $pargs) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 1004 | 0 | ▶ | $pargs->{level}=0 if $pargs->{level} eq ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | 0 | ▶ | my %args_orig=%$pargs if $pargs->{level}==0; #keep original args | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | 0 | ▶ | $pargs->{bpos}=0 if $pargs->{bpos} eq ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | 0 | $pargs->{url}=~s/\#.*$//; #Remove references in url | |||||||||||||||||||||||||||||||||||||||||||||
| 1008 | 0 | $pargs->{levelspace} = " " x $pargs->{level}; #caculate spaces to purify log output | |||||||||||||||||||||||||||||||||||||||||||||
| 1009 | 0 | $pargs->{bpos_limit}=sprintf("%0".length($pargs->{book_num})."d", $pargs->{bpos}); | |||||||||||||||||||||||||||||||||||||||||||||
| 1010 | 0 | $pargs->{title_limit}=$self->string_limit($pargs->{title}, $self->{screen_limit_title}); | |||||||||||||||||||||||||||||||||||||||||||||
| 1011 | 0 | $self->log_add("BookStart", $pargs); | |||||||||||||||||||||||||||||||||||||||||||||
| 1012 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | # Skip some special urls | ||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | 0 | ▶ | if($pargs->{level}>$self->{book_max_levels}) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | 0 | {$self->log_add("SkipMaxLevel", $pargs); return "";} | |||||||||||||||||||||||||||||||||||||||||||||
| 1016 | 0 | ▶ | if($pargs->{title} eq '') | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | 0 | {$self->log_add("SkipTitleEmpty", $pargs); return "";} | |||||||||||||||||||||||||||||||||||||||||||||
| 1018 | 0 | ▶ | if($pargs->{url} eq '') | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | 0 | {$self->log_add("SkipUrlEmpty", $pargs); return "";} | |||||||||||||||||||||||||||||||||||||||||||||
| 1020 | 0 | ▶ | if($self->{get_skip_zip} and $pargs->{url}=~/(?:$self->{patterns}->{postfix_zip})$/i) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"get_skip_zip"} and $pargs->{"url"} =~ /(?:$self->{"patterns"}{"postfix_zip"})$/i
MC/DC0%0/2
$self->{"get_skip_zip"} and $pargs->{"url"} =~ /(?:$self->{"patterns"}{"postfix_zip"})$/i
$self->{"get_skip_zip"}
$pargs->{"url"} =~ /(?:$self->{"patterns"}{"postfix_zip"})$/i
Truth table0%0/3
A and B
A= $self->{"get_skip_zip"}B= $pargs->{"url"} =~ /(?:$self->{"patterns"}{"postfix_zip"})$/i
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | 0 | {$self->log_add("SkipZip", $pargs); return "";} | |||||||||||||||||||||||||||||||||||||||||||||
| 1022 | 0 | ▶ | if($self->{get_skip_media} and $pargs->{url}=~/(?:$self->{patterns}->{postfix_media})$/i) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"get_skip_media"} and $pargs->{"url"} =~ /(?:$self->{"patterns"}{"postfix_media"})$/i
MC/DC0%0/2
$self->{"get_skip_media"} and $pargs->{"url"} =~ /(?:$self->{"patterns"}{"postfix_media"})$/i
$self->{"get_skip_media"}
$pargs->{"url"} =~ /(?:$self->{"patterns"}{"postfix_media"})$/i
Truth table0%0/3
A and B
A= $self->{"get_skip_media"}B= $pargs->{"url"} =~ /(?:$self->{"patterns"}{"postfix_media"})$/i
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | 0 | {$self->log_add("SkipMedia", $pargs); return "";} | |||||||||||||||||||||||||||||||||||||||||||||
| 1024 | 0 | ▶ | if(defined($self->{DB_visited_book}->{$pargs->{url}})) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | 0 | {$self->log_add("SkipVisited", $pargs); return "";} | |||||||||||||||||||||||||||||||||||||||||||||
| 1026 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | # Get URL | ||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | 0 | my $res=$self->get_url($pargs->{url}); | |||||||||||||||||||||||||||||||||||||||||||||
| 1029 | 0 | ▶ | if(not($res->is_success)) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | 0 | ▶ | $self->db_add("book", "Err", \%args_orig) if $pargs->{level}==0; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | 0 | return ""; | |||||||||||||||||||||||||||||||||||||||||||||
| 1032 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | 0 | my $str=$res->content; | |||||||||||||||||||||||||||||||||||||||||||||
| 1034 | 0 | $pargs->{content_type}=$res->headers->content_type; | |||||||||||||||||||||||||||||||||||||||||||||
| 1035 | 0 | $pargs->{content_len}=length($str); | |||||||||||||||||||||||||||||||||||||||||||||
| 1036 | 0 | $pargs->{last_modified}=$res->headers->last_modified; | |||||||||||||||||||||||||||||||||||||||||||||
| 1037 | 0 | $pargs->{last_modified_str}=HTTP::Date::time2iso($res->headers->last_modified); | |||||||||||||||||||||||||||||||||||||||||||||
| 1038 | 0 | $pargs->{url_real}=$res->request->uri->as_string; | |||||||||||||||||||||||||||||||||||||||||||||
| 1039 | 0 | $pargs->{url_base}=$res->base->as_string; | |||||||||||||||||||||||||||||||||||||||||||||
| 1040 | 0 | my $url1=$pargs->{url_real}; | |||||||||||||||||||||||||||||||||||||||||||||
| 1041 | 0 | $url1=~s/\?.*$//; | |||||||||||||||||||||||||||||||||||||||||||||
| 1042 | 0 | ▶ | $pargs->{ext_real}=($url1=~/\.([^\.]+)$/) ? lc($1) : ""; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | 0 | $pargs->{ext_save}=$pargs->{ext_real}; | |||||||||||||||||||||||||||||||||||||||||||||
| 1044 | 0 | ▶ | if( $pargs->{ext_save}=~/^(?:$self->{patterns}->{postfix_free}|)$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | # file extension cannot be confirmed, since it's cgi | ||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | 0 | $pargs->{ext_save}=$self->{Content_Type}->{$pargs->{content_type}}; #try to new_bot via content-type | |||||||||||||||||||||||||||||||||||||||||||||
| 1047 | 0 | ▶ | $pargs->{ext_save}='txt' if $pargs->{ext_save} eq ''; #add default txt if fail | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | 0 | undef $res; | |||||||||||||||||||||||||||||||||||||||||||||
| 1050 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | # html/text/bin | ||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | 0 | ▶ | if( $pargs->{content_len}>0 ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | 0 | ▶ | if($pargs->{ext_real} eq 'txt') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | 0 | $self->book_text($pargs, $str); | |||||||||||||||||||||||||||||||||||||||||||||
| 1055 | } elsif($pargs->{content_type} eq 'text/html') { | ||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | 0 | $self->book_html($pargs, $str); | |||||||||||||||||||||||||||||||||||||||||||||
| 1057 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | 0 | $self->book_bin($pargs, $str); | |||||||||||||||||||||||||||||||||||||||||||||
| 1059 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | 0 | ▶ | $self->db_add("book", (length($str)==0) ? 'Err' : 'OK', \%args_orig) if $pargs->{level}==0; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | 0 | return $str; | |||||||||||||||||||||||||||||||||||||||||||||
| 1063 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | 0 | ▶ | sub book_html { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
book_html: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | 0 | my ($self, $pargs) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||||||
| 1066 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | # check 1 chapter or more, return if 1 chapter | ||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | 0 | $_[0]=$self->de_code($_[0]); | |||||||||||||||||||||||||||||||||||||||||||||
| 1069 | 0 | $_[0]=~s/\r\n|\r/\n/og; | |||||||||||||||||||||||||||||||||||||||||||||
| 1070 | 0 | my @chapters=$self->book_chapters($pargs, $_[0]); | |||||||||||||||||||||||||||||||||||||||||||||
| 1071 | 0 | $pargs->{chapter_num}=scalar(@chapters); | |||||||||||||||||||||||||||||||||||||||||||||
| 1072 | 0 | $pargs->{chapter_num_limit}=sprintf("%04d", $pargs->{chapter_num}); | |||||||||||||||||||||||||||||||||||||||||||||
| 1073 | 0 | ▶ | if( $pargs->{chapter_num}==0 ){ | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | 0 | $self->log_add("BookChapterOne", $pargs); | |||||||||||||||||||||||||||||||||||||||||||||
| 1075 | 0 | $self->chapter_process($pargs, $_[0]); | |||||||||||||||||||||||||||||||||||||||||||||
| 1076 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||
| 1077 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | 0 | $self->log_add("BookChapterMany", $pargs); | |||||||||||||||||||||||||||||||||||||||||||||
| 1079 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | # initialize result file to put TOC | ||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | 0 | $self->{book_get_num}++; | |||||||||||||||||||||||||||||||||||||||||||||
| 1082 | 0 | my $filename=$self->result_init($pargs); | |||||||||||||||||||||||||||||||||||||||||||||
| 1083 | 0 | $pargs->{filename}=$filename; | |||||||||||||||||||||||||||||||||||||||||||||
| 1084 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | # parse TOC and save it | ||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | 0 | $self->TOC_parser($pargs, $_[0]); | |||||||||||||||||||||||||||||||||||||||||||||
| 1087 | 0 | my $out_en=$self->en_code($_[0]); | |||||||||||||||||||||||||||||||||||||||||||||
| 1088 | 0 | $self->result_add($filename, $out_en); | |||||||||||||||||||||||||||||||||||||||||||||
| 1089 | 0 | $pargs->{TOC_len}=length($out_en); | |||||||||||||||||||||||||||||||||||||||||||||
| 1090 | 0 | $pargs->{TOC_len_KB}=$self->len_KB($pargs->{TOC_len}); | |||||||||||||||||||||||||||||||||||||||||||||
| 1091 | 0 | $self->log_add("BookTOCFinish", $pargs); | |||||||||||||||||||||||||||||||||||||||||||||
| 1092 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | # parse other chapters | ||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | 0 | ▶ | for(my $bpos=0; $bpos<$pargs->{chapter_num}; $bpos++) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | 0 | $chapters[$bpos]->{level}=$pargs->{level}+1; | |||||||||||||||||||||||||||||||||||||||||||||
| 1096 | 0 | $chapters[$bpos]->{book_num}=$pargs->{chapter_num}; | |||||||||||||||||||||||||||||||||||||||||||||
| 1097 | 0 | $chapters[$bpos]->{bpos}=$bpos+1; | |||||||||||||||||||||||||||||||||||||||||||||
| 1098 | 0 | $self->result_add( $filename, "\n\n" ); | |||||||||||||||||||||||||||||||||||||||||||||
| 1099 | 0 | $self->result_adden( $filename, $self->go_book($chapters[$bpos]) ); | |||||||||||||||||||||||||||||||||||||||||||||
| 1100 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1101 | 0 | $self->book_finish($pargs); | |||||||||||||||||||||||||||||||||||||||||||||
| 1102 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1103 | # finish work | ||||||||||||||||||||||||||||||||||||||||||||||
| 1104 | 0 | my $result_time=$self->result_time($pargs); | |||||||||||||||||||||||||||||||||||||||||||||
| 1105 | 0 | ▶ | $self->result_settime($filename, $result_time) if defined($result_time); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1106 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1107 | 6 | ▶ | sub book_text { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
book_text: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1108 | 6 | my ($self, $pargs) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||||||
| 1109 | 6 | $_[0]=$self->de_code($_[0]); | |||||||||||||||||||||||||||||||||||||||||||||
| 1110 | 6 | $_[0]=~s/\r\n|\r/\n/og; | |||||||||||||||||||||||||||||||||||||||||||||
| 1111 | 6 | $self->chapter_process($pargs, $_[0]); | |||||||||||||||||||||||||||||||||||||||||||||
| 1112 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1113 | 3 | ▶ | sub book_bin { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
book_bin: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1114 | 3 | my ($self, $pargs) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||||||
| 1115 | 3 | $pargs->{data_len}=length($_[0]); | |||||||||||||||||||||||||||||||||||||||||||||
| 1116 | 3 | $pargs->{data_len_KB}=$self->len_KB($pargs->{data_len}); | |||||||||||||||||||||||||||||||||||||||||||||
| 1117 | 3 | ▶ | return if $pargs->{data_len}==0; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1118 | 3 | $pargs->{write_file}=$self->book_writebin($pargs, $_[0]); | |||||||||||||||||||||||||||||||||||||||||||||
| 1119 | 3 | $self->log_add("BookBinaryOK", $pargs); | |||||||||||||||||||||||||||||||||||||||||||||
| 1120 | 3 | $_[0]="[$pargs->{write_file}]"; | |||||||||||||||||||||||||||||||||||||||||||||
| 1121 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1122 | 6 | ▶ | sub book_writebin { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
book_writebin: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1123 | 6 | my ($self, $pargs) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||||||
| 1124 | 6 | my $filename=$self->result_filename($pargs); | |||||||||||||||||||||||||||||||||||||||||||||
| 1125 | 6 | $self->file_writebin("result", $filename, $_[0]); | |||||||||||||||||||||||||||||||||||||||||||||
| 1126 | 6 | my $result_time=$self->result_time($pargs); | |||||||||||||||||||||||||||||||||||||||||||||
| 1127 | 6 | ▶ | $self->result_settime($filename, $result_time) if defined($result_time); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1128 | 6 | return $self->de_code(basename($filename)); | |||||||||||||||||||||||||||||||||||||||||||||
| 1129 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1130 | 6 | ▶ | sub book_chapters { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
book_chapters: called CC=8 SCAR=22.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1131 | 6 | my ($self, $pargs, $str) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 1132 | 6 | ▶ | return () if $self->{book_has_chapters}==0; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1133 | 6 | ▶ | return () if $self->{patterns}->{TOC_exists} ne '' and not($str=~/$self->{patterns}->{TOC_exists}/os); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{"patterns"}{"TOC_exists"} ne "" and not $str =~ /$self->{"patterns"}{"TOC_exists"}/so
MC/DC0%0/2
$self->{"patterns"}{"TOC_exists"} ne "" and not $str =~ /$self->{"patterns"}{"TOC_exists"}/so
$self->{"patterns"}{"TOC_exists"} ne ""
not $str =~ /$self->{"patterns"}{"TOC_exists"}/so
Truth table33%1/3
A and not(B)
A= $self->{"patterns"}{"TOC_exists"} ne ""B= not $str =~ /$self->{"patterns"}{"TOC_exists"}/so
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1134 | 6 | ▶ | $str=~s/^.*?$self->{patterns}->{chapters_head}//os if $self->{patterns}->{chapters_head} ne ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1135 | 6 | ▶ | $str=~s/$self->{patterns}->{chapters_end}.*$//os if $self->{patterns}->{chapters_end} ne ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1136 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1137 | 6 | my @chapters = (); | |||||||||||||||||||||||||||||||||||||||||||||
| 1138 | 6 | ▶ | while($str=~/$self->{patterns}->{chapters_get_chapterargs}/oisg) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1139 | 3 | my $pargs1={}; | |||||||||||||||||||||||||||||||||||||||||||||
| 1140 | 3 | ▶ | next if $self->chapters_get_chapterargs($pargs1, $1, $2, $3, $4, $5, $6, $7, $8, $9) eq 'Skip'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1141 | 3 | $pargs1->{url}=$self->url_rel2abs($pargs1->{url}, $pargs->{url_base}); | |||||||||||||||||||||||||||||||||||||||||||||
| 1142 | 3 | push @chapters, $pargs1; | |||||||||||||||||||||||||||||||||||||||||||||
| 1143 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1144 | 6 | return @chapters; | |||||||||||||||||||||||||||||||||||||||||||||
| 1145 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1146 | 0 | ▶ | sub TOC_parser { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
TOC_parser: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1147 | 0 | ▶ | $_[2]=~s/^.*?$_[0]->{patterns}->{TOC_head}//os if $_[0]->{patterns}->{TOC_head} ne ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1148 | 0 | ▶ | $_[2]=~s/$_[0]->{patterns}->{TOC_end}.*$//os if $_[0]->{patterns}->{TOC_end} ne ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1149 | 0 | $_[0]->normalize_paragraph($_[2]); | |||||||||||||||||||||||||||||||||||||||||||||
| 1150 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1151 | 6 | ▶ | sub chapter_process { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
chapter_process: called CC=7 SCAR=19.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1152 | 6 | my ($self, $pargs) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||||||
| 1153 | 6 | $self->chapter_parser($pargs, $_[0]); | |||||||||||||||||||||||||||||||||||||||||||||
| 1154 | 6 | my $out_en=$self->en_code($_[0]); | |||||||||||||||||||||||||||||||||||||||||||||
| 1155 | 6 | $pargs->{data_len}=length($out_en); | |||||||||||||||||||||||||||||||||||||||||||||
| 1156 | 6 | $pargs->{data_len_KB}=$self->len_KB($pargs->{data_len}); | |||||||||||||||||||||||||||||||||||||||||||||
| 1157 | 6 | ▶ | if( $pargs->{level}==0 and $pargs->{data_len}>0 ) { # save single chapter as a book | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$pargs->{"level"} == 0 and $pargs->{"data_len"} > 0
MC/DC50%1/2
$pargs->{"level"} == 0 and $pargs->{"data_len"} > 0
$pargs->{"level"} == 0
$pargs->{"data_len"} > 0
Truth table66%2/3
A and B
A= $pargs->{"level"} == 0B= $pargs->{"data_len"} > 0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1158 | 3 | $self->{book_get_num}++; | |||||||||||||||||||||||||||||||||||||||||||||
| 1159 | 3 | my $filename=$self->result_init($pargs); | |||||||||||||||||||||||||||||||||||||||||||||
| 1160 | 3 | $pargs->{filename}=$filename; | |||||||||||||||||||||||||||||||||||||||||||||
| 1161 | 3 | $self->result_add($filename, $out_en); | |||||||||||||||||||||||||||||||||||||||||||||
| 1162 | 3 | $self->book_finish($pargs); | |||||||||||||||||||||||||||||||||||||||||||||
| 1163 | 3 | my $result_time=$self->result_time($pargs); | |||||||||||||||||||||||||||||||||||||||||||||
| 1164 | 3 | ▶ | $self->result_settime($filename, $result_time) if defined($result_time); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1165 | 3 | $pargs->{write_file}=$self->de_code(basename($filename)); | |||||||||||||||||||||||||||||||||||||||||||||
| 1166 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 1167 | 3 | $pargs->{write_file}=""; | |||||||||||||||||||||||||||||||||||||||||||||
| 1168 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1169 | 6 | ▶ | $self->log_add("BookChapter".(($pargs->{data_len}>0)?"OK":"Err"), $pargs); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1170 | 6 | ▶ | $_[0]="[$pargs->{write_file}]" if $pargs->{level}==0 and $pargs->{data_len}>0; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$pargs->{"level"} == 0 and $pargs->{"data_len"} > 0
MC/DC50%1/2
$pargs->{"level"} == 0 and $pargs->{"data_len"} > 0
$pargs->{"level"} == 0
$pargs->{"data_len"} > 0
Truth table66%2/3
A and B
A= $pargs->{"level"} == 0B= $pargs->{"data_len"} > 0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1171 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1172 | 6 | ▶ | sub chapter_parser { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
chapter_parser: called CC=3 SCAR=11.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1173 | 6 | ▶ | $_[2]=~s/^.*?$_[0]->{patterns}->{chapter_head}//os if $_[0]->{patterns}->{chapter_head} ne ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1174 | 6 | ▶ | $_[2]=~s/$_[0]->{patterns}->{chapter_end}.*$//os if $_[0]->{patterns}->{chapter_end} ne ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1175 | 6 | $_[0]->normalize_paragraph($_[2]); | |||||||||||||||||||||||||||||||||||||||||||||
| 1176 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1177 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1178 | #------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 1179 | # pattern initialize functions | ||||||||||||||||||||||||||||||||||||||||||||||
| 1180 | #------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 1181 | 21 | ▶ | sub getpattern_lists { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getpattern_lists: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1182 | 21 | qw( | |||||||||||||||||||||||||||||||||||||||||||||
| 1183 | space space2 line_head parentheses mark_dash mark_wordsplit | ||||||||||||||||||||||||||||||||||||||||||||||
| 1184 | remove_html remove_line_by_end remove_line_by_end_special word_finish | ||||||||||||||||||||||||||||||||||||||||||||||
| 1185 | postfix_zip postfix_media postfix_img postfix_free | ||||||||||||||||||||||||||||||||||||||||||||||
| 1186 | catalog_head catalog_end catalog_get_bookargs catalog_get_next | ||||||||||||||||||||||||||||||||||||||||||||||
| 1187 | chapters_head chapters_end chapters_get_chapterargs | ||||||||||||||||||||||||||||||||||||||||||||||
| 1188 | TOC_exists TOC_head TOC_end | ||||||||||||||||||||||||||||||||||||||||||||||
| 1189 | chapter_head chapter_end | ||||||||||||||||||||||||||||||||||||||||||||||
| 1190 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 1191 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1192 | 21 | ▶ | sub getpattern_space_data { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getpattern_space_data: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1193 | 21 | <<"DATA"; | |||||||||||||||||||||||||||||||||||||||||||||
| 1194 | [\000-\011\013-\037] | ||||||||||||||||||||||||||||||||||||||||||||||
| 1195 | DATA | ||||||||||||||||||||||||||||||||||||||||||||||
| 1196 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1197 | 14 | ▶ | sub getpattern_space2_data { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getpattern_space2_data: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1198 | 14 | <<"DATA"; | |||||||||||||||||||||||||||||||||||||||||||||
| 1199 | ^\000\000 | ||||||||||||||||||||||||||||||||||||||||||||||
| 1200 | DATA | ||||||||||||||||||||||||||||||||||||||||||||||
| 1201 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1202 | 14 | ▶ | sub getpattern_line_head_data { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getpattern_line_head_data: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1203 | 14 | ' '; | |||||||||||||||||||||||||||||||||||||||||||||
| 1204 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1205 | 21 | ▶ | sub getpattern_parentheses { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getpattern_parentheses: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1206 | 21 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 1207 | 21 | my ($left, $right); | |||||||||||||||||||||||||||||||||||||||||||||
| 1208 | 21 | my $pattern=''; | |||||||||||||||||||||||||||||||||||||||||||||
| 1209 | 21 | my $pattern_left=''; | |||||||||||||||||||||||||||||||||||||||||||||
| 1210 | 21 | my $pattern_right=''; | |||||||||||||||||||||||||||||||||||||||||||||
| 1211 | 21 | foreach(split /\r\n|\r|\n/, $self->de_code($self->getpattern_parentheses_data)) { | |||||||||||||||||||||||||||||||||||||||||||||
| 1212 | 371 | ▶ | next if $_ eq ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1213 | 371 | ($left, $right)=split(/ /, $_); | |||||||||||||||||||||||||||||||||||||||||||||
| 1214 | 371 | $pattern.=$left."(.*)".$right."|"; | |||||||||||||||||||||||||||||||||||||||||||||
| 1215 | 371 | $pattern_left.=$left; | |||||||||||||||||||||||||||||||||||||||||||||
| 1216 | 371 | $pattern_right.=$right; | |||||||||||||||||||||||||||||||||||||||||||||
| 1217 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1218 | 21 | $pattern=~s/\|$//; | |||||||||||||||||||||||||||||||||||||||||||||
| 1219 | 21 | $self->{patterns}->{parentheses_left}='['.$pattern_left.']'; | |||||||||||||||||||||||||||||||||||||||||||||
| 1220 | 21 | $self->{patterns}->{parentheses_right}='['.$pattern_right.']'; | |||||||||||||||||||||||||||||||||||||||||||||
| 1221 | 21 | return $pattern; | |||||||||||||||||||||||||||||||||||||||||||||
| 1222 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1223 | 21 | ▶ | sub getpattern_parentheses_data { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getpattern_parentheses_data: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1224 | 21 | <<'DATA'; | |||||||||||||||||||||||||||||||||||||||||||||
| 1225 | \( \) | ||||||||||||||||||||||||||||||||||||||||||||||
| 1226 | \[ \] | ||||||||||||||||||||||||||||||||||||||||||||||
| 1227 | \{ \} | ||||||||||||||||||||||||||||||||||||||||||||||
| 1228 | \" \" | ||||||||||||||||||||||||||||||||||||||||||||||
| 1229 | \' \' | ||||||||||||||||||||||||||||||||||||||||||||||
| 1230 | \` \` | ||||||||||||||||||||||||||||||||||||||||||||||
| 1231 | DATA | ||||||||||||||||||||||||||||||||||||||||||||||
| 1232 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1233 | 14 | ▶ | sub getpattern_mark_dash_data { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getpattern_mark_dash_data: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1234 | 14 | <<'DATA'; | |||||||||||||||||||||||||||||||||||||||||||||
| 1235 | [#-&\*\+\-=@_~] | ||||||||||||||||||||||||||||||||||||||||||||||
| 1236 | DATA | ||||||||||||||||||||||||||||||||||||||||||||||
| 1237 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1238 | 14 | ▶ | sub getpattern_mark_wordsplit_data { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getpattern_mark_wordsplit_data: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1239 | 14 | <<'DATA'; | |||||||||||||||||||||||||||||||||||||||||||||
| 1240 | [\.\,\?\!\:\;] | ||||||||||||||||||||||||||||||||||||||||||||||
| 1241 | DATA | ||||||||||||||||||||||||||||||||||||||||||||||
| 1242 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1243 | 21 | ▶ | sub getpattern_remove_html_data { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getpattern_remove_html_data: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1244 | 21 | <<'DATA'; | |||||||||||||||||||||||||||||||||||||||||||||
| 1245 | <head.*?</head> | ||||||||||||||||||||||||||||||||||||||||||||||
| 1246 | <script.*?</script> | ||||||||||||||||||||||||||||||||||||||||||||||
| 1247 | <title.*?</title> | ||||||||||||||||||||||||||||||||||||||||||||||
| 1248 | <style.*?</style> | ||||||||||||||||||||||||||||||||||||||||||||||
| 1249 | <!--.*?--> | ||||||||||||||||||||||||||||||||||||||||||||||
| 1250 | DATA | ||||||||||||||||||||||||||||||||||||||||||||||
| 1251 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1252 | 14 | ▶ | sub getpattern_remove_line_by_end_data { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getpattern_remove_line_by_end_data: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1253 | 14 | <<'DATA'; | |||||||||||||||||||||||||||||||||||||||||||||
| 1254 | \000 | ||||||||||||||||||||||||||||||||||||||||||||||
| 1255 | DATA | ||||||||||||||||||||||||||||||||||||||||||||||
| 1256 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1257 | 21 | ▶ | sub getpattern_remove_line_by_end_special { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getpattern_remove_line_by_end_special: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1258 | 21 | my $self=shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 1259 | 21 | my $special=$self->parse_patterns($self->getpattern_remove_line_by_end_special_data); | |||||||||||||||||||||||||||||||||||||||||||||
| 1260 | 21 | my $left=$self->{patterns}->{parentheses_left}; | |||||||||||||||||||||||||||||||||||||||||||||
| 1261 | 21 | $left=~s/(?:^\[|\]$)//sg; | |||||||||||||||||||||||||||||||||||||||||||||
| 1262 | 21 | "[^ \n]{1,8}?[$special][ $left][^\n]*"; | |||||||||||||||||||||||||||||||||||||||||||||
| 1263 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1264 | 14 | ▶ | sub getpattern_remove_line_by_end_special_data { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getpattern_remove_line_by_end_special_data: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1265 | 14 | <<'DATA'; | |||||||||||||||||||||||||||||||||||||||||||||
| 1266 | \000 | ||||||||||||||||||||||||||||||||||||||||||||||
| 1267 | DATA | ||||||||||||||||||||||||||||||||||||||||||||||
| 1268 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1269 | 21 | ▶ | sub getpattern_word_finish { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getpattern_word_finish: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1270 | 21 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 1271 | 21 | my ($t, $result); | |||||||||||||||||||||||||||||||||||||||||||||
| 1272 | 21 | $result=" *"; | |||||||||||||||||||||||||||||||||||||||||||||
| 1273 | 21 | $t=$self->{patterns}->{parentheses_left}; | |||||||||||||||||||||||||||||||||||||||||||||
| 1274 | 21 | $t=~s/\]$//; | |||||||||||||||||||||||||||||||||||||||||||||
| 1275 | 21 | $result.=$t; | |||||||||||||||||||||||||||||||||||||||||||||
| 1276 | 21 | $t=$self->{patterns}->{mark_dash}; | |||||||||||||||||||||||||||||||||||||||||||||
| 1277 | 21 | $t=~s/^\[//; | |||||||||||||||||||||||||||||||||||||||||||||
| 1278 | 21 | $result.=$t."? *"; | |||||||||||||||||||||||||||||||||||||||||||||
| 1279 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1280 | 21 | $result.="(?:".$self->parse_patterns($self->getpattern_word_finish_data).") *"; | |||||||||||||||||||||||||||||||||||||||||||||
| 1281 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1282 | 21 | $t=$self->{patterns}->{parentheses_right}; | |||||||||||||||||||||||||||||||||||||||||||||
| 1283 | 21 | $t=~s/\]$//; | |||||||||||||||||||||||||||||||||||||||||||||
| 1284 | 21 | $result.=$t; | |||||||||||||||||||||||||||||||||||||||||||||
| 1285 | 21 | $t=$self->{patterns}->{mark_dash}; | |||||||||||||||||||||||||||||||||||||||||||||
| 1286 | 21 | $t=~s/^\[//; | |||||||||||||||||||||||||||||||||||||||||||||
| 1287 | 21 | $result.=$t."?\$"; | |||||||||||||||||||||||||||||||||||||||||||||
| 1288 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1289 | 14 | ▶ | sub getpattern_word_finish_data { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getpattern_word_finish_data: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1290 | 14 | <<'DATA'; | |||||||||||||||||||||||||||||||||||||||||||||
| 1291 | \000 | ||||||||||||||||||||||||||||||||||||||||||||||
| 1292 | DATA | ||||||||||||||||||||||||||||||||||||||||||||||
| 1293 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1294 | 21 | ▶ | sub getpattern_postfix_zip { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getpattern_postfix_zip: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1295 | 21 | return shift->parse_patterns(<<'DATA'); | |||||||||||||||||||||||||||||||||||||||||||||
| 1296 | ^case$ | ||||||||||||||||||||||||||||||||||||||||||||||
| 1297 | zip | ||||||||||||||||||||||||||||||||||||||||||||||
| 1298 | r(?:a[rx]|\d\d) | ||||||||||||||||||||||||||||||||||||||||||||||
| 1299 | z | ||||||||||||||||||||||||||||||||||||||||||||||
| 1300 | gz | ||||||||||||||||||||||||||||||||||||||||||||||
| 1301 | t[ga]z | ||||||||||||||||||||||||||||||||||||||||||||||
| 1302 | 7z | ||||||||||||||||||||||||||||||||||||||||||||||
| 1303 | a\d\d | ||||||||||||||||||||||||||||||||||||||||||||||
| 1304 | ace | ||||||||||||||||||||||||||||||||||||||||||||||
| 1305 | ain | ||||||||||||||||||||||||||||||||||||||||||||||
| 1306 | akt | ||||||||||||||||||||||||||||||||||||||||||||||
| 1307 | ap[qx] | ||||||||||||||||||||||||||||||||||||||||||||||
| 1308 | ar(?:[jc]|) | ||||||||||||||||||||||||||||||||||||||||||||||
| 1309 | asd | ||||||||||||||||||||||||||||||||||||||||||||||
| 1310 | bh | ||||||||||||||||||||||||||||||||||||||||||||||
| 1311 | bi[nx] | ||||||||||||||||||||||||||||||||||||||||||||||
| 1312 | bz2 | ||||||||||||||||||||||||||||||||||||||||||||||
| 1313 | cab | ||||||||||||||||||||||||||||||||||||||||||||||
| 1314 | cfd | ||||||||||||||||||||||||||||||||||||||||||||||
| 1315 | class | ||||||||||||||||||||||||||||||||||||||||||||||
| 1316 | com | ||||||||||||||||||||||||||||||||||||||||||||||
| 1317 | cru | ||||||||||||||||||||||||||||||||||||||||||||||
| 1318 | cpio | ||||||||||||||||||||||||||||||||||||||||||||||
| 1319 | cpt | ||||||||||||||||||||||||||||||||||||||||||||||
| 1320 | dcf | ||||||||||||||||||||||||||||||||||||||||||||||
| 1321 | ddi | ||||||||||||||||||||||||||||||||||||||||||||||
| 1322 | dpa | ||||||||||||||||||||||||||||||||||||||||||||||
| 1323 | dsk | ||||||||||||||||||||||||||||||||||||||||||||||
| 1324 | dup | ||||||||||||||||||||||||||||||||||||||||||||||
| 1325 | dwc | ||||||||||||||||||||||||||||||||||||||||||||||
| 1326 | eli | ||||||||||||||||||||||||||||||||||||||||||||||
| 1327 | enc | ||||||||||||||||||||||||||||||||||||||||||||||
| 1328 | esp | ||||||||||||||||||||||||||||||||||||||||||||||
| 1329 | exe | ||||||||||||||||||||||||||||||||||||||||||||||
| 1330 | f | ||||||||||||||||||||||||||||||||||||||||||||||
| 1331 | ha(?:p|) | ||||||||||||||||||||||||||||||||||||||||||||||
| 1332 | hex | ||||||||||||||||||||||||||||||||||||||||||||||
| 1333 | hp[ak] | ||||||||||||||||||||||||||||||||||||||||||||||
| 1334 | hqx | ||||||||||||||||||||||||||||||||||||||||||||||
| 1335 | hyp | ||||||||||||||||||||||||||||||||||||||||||||||
| 1336 | ice | ||||||||||||||||||||||||||||||||||||||||||||||
| 1337 | im[gp] | ||||||||||||||||||||||||||||||||||||||||||||||
| 1338 | is[co] | ||||||||||||||||||||||||||||||||||||||||||||||
| 1339 | jar | ||||||||||||||||||||||||||||||||||||||||||||||
| 1340 | jrc | ||||||||||||||||||||||||||||||||||||||||||||||
| 1341 | lbr | ||||||||||||||||||||||||||||||||||||||||||||||
| 1342 | lha | ||||||||||||||||||||||||||||||||||||||||||||||
| 1343 | lz[ahwx] | ||||||||||||||||||||||||||||||||||||||||||||||
| 1344 | mar | ||||||||||||||||||||||||||||||||||||||||||||||
| 1345 | mime | ||||||||||||||||||||||||||||||||||||||||||||||
| 1346 | pak | ||||||||||||||||||||||||||||||||||||||||||||||
| 1347 | pk3 | ||||||||||||||||||||||||||||||||||||||||||||||
| 1348 | pz[hk] | ||||||||||||||||||||||||||||||||||||||||||||||
| 1349 | q | ||||||||||||||||||||||||||||||||||||||||||||||
| 1350 | qfc | ||||||||||||||||||||||||||||||||||||||||||||||
| 1351 | saif | ||||||||||||||||||||||||||||||||||||||||||||||
| 1352 | sar | ||||||||||||||||||||||||||||||||||||||||||||||
| 1353 | sbx | ||||||||||||||||||||||||||||||||||||||||||||||
| 1354 | sdn | ||||||||||||||||||||||||||||||||||||||||||||||
| 1355 | sea | ||||||||||||||||||||||||||||||||||||||||||||||
| 1356 | shar | ||||||||||||||||||||||||||||||||||||||||||||||
| 1357 | sit | ||||||||||||||||||||||||||||||||||||||||||||||
| 1358 | sqz | ||||||||||||||||||||||||||||||||||||||||||||||
| 1359 | td0 | ||||||||||||||||||||||||||||||||||||||||||||||
| 1360 | uc2 | ||||||||||||||||||||||||||||||||||||||||||||||
| 1361 | ufa | ||||||||||||||||||||||||||||||||||||||||||||||
| 1362 | uu(?:u|) | ||||||||||||||||||||||||||||||||||||||||||||||
| 1363 | xxe | ||||||||||||||||||||||||||||||||||||||||||||||
| 1364 | zoo | ||||||||||||||||||||||||||||||||||||||||||||||
| 1365 | DATA | ||||||||||||||||||||||||||||||||||||||||||||||
| 1366 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1367 | 21 | ▶ | sub getpattern_postfix_media { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getpattern_postfix_media: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1368 | 21 | return shift->parse_patterns(<<'DATA'); | |||||||||||||||||||||||||||||||||||||||||||||
| 1369 | avi | ||||||||||||||||||||||||||||||||||||||||||||||
| 1370 | as[fx] | ||||||||||||||||||||||||||||||||||||||||||||||
| 1371 | r(?:m|am|a) | ||||||||||||||||||||||||||||||||||||||||||||||
| 1372 | mov(?:ie|) | ||||||||||||||||||||||||||||||||||||||||||||||
| 1373 | mp(?:\d|eg|ga|g) | ||||||||||||||||||||||||||||||||||||||||||||||
| 1374 | wma | ||||||||||||||||||||||||||||||||||||||||||||||
| 1375 | wav | ||||||||||||||||||||||||||||||||||||||||||||||
| 1376 | 3ds | ||||||||||||||||||||||||||||||||||||||||||||||
| 1377 | aif(?:[cf]|) | ||||||||||||||||||||||||||||||||||||||||||||||
| 1378 | au | ||||||||||||||||||||||||||||||||||||||||||||||
| 1379 | cd(?:a|) | ||||||||||||||||||||||||||||||||||||||||||||||
| 1380 | code | ||||||||||||||||||||||||||||||||||||||||||||||
| 1381 | d[cix]r | ||||||||||||||||||||||||||||||||||||||||||||||
| 1382 | fl[cit] | ||||||||||||||||||||||||||||||||||||||||||||||
| 1383 | fon | ||||||||||||||||||||||||||||||||||||||||||||||
| 1384 | kar | ||||||||||||||||||||||||||||||||||||||||||||||
| 1385 | m3u | ||||||||||||||||||||||||||||||||||||||||||||||
| 1386 | mid(?:i|) | ||||||||||||||||||||||||||||||||||||||||||||||
| 1387 | qt | ||||||||||||||||||||||||||||||||||||||||||||||
| 1388 | r[fp] | ||||||||||||||||||||||||||||||||||||||||||||||
| 1389 | scr | ||||||||||||||||||||||||||||||||||||||||||||||
| 1390 | snd | ||||||||||||||||||||||||||||||||||||||||||||||
| 1391 | spl | ||||||||||||||||||||||||||||||||||||||||||||||
| 1392 | swf | ||||||||||||||||||||||||||||||||||||||||||||||
| 1393 | tt[cf] | ||||||||||||||||||||||||||||||||||||||||||||||
| 1394 | DATA | ||||||||||||||||||||||||||||||||||||||||||||||
| 1395 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1396 | 21 | ▶ | sub getpattern_postfix_img { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getpattern_postfix_img: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1397 | 21 | return shift->parse_patterns(<<'DATA'); | |||||||||||||||||||||||||||||||||||||||||||||
| 1398 | gif | ||||||||||||||||||||||||||||||||||||||||||||||
| 1399 | jp(?:eg|e|g) | ||||||||||||||||||||||||||||||||||||||||||||||
| 1400 | png | ||||||||||||||||||||||||||||||||||||||||||||||
| 1401 | ani | ||||||||||||||||||||||||||||||||||||||||||||||
| 1402 | ai | ||||||||||||||||||||||||||||||||||||||||||||||
| 1403 | ais | ||||||||||||||||||||||||||||||||||||||||||||||
| 1404 | art | ||||||||||||||||||||||||||||||||||||||||||||||
| 1405 | bmp | ||||||||||||||||||||||||||||||||||||||||||||||
| 1406 | bw | ||||||||||||||||||||||||||||||||||||||||||||||
| 1407 | ddf | ||||||||||||||||||||||||||||||||||||||||||||||
| 1408 | dib | ||||||||||||||||||||||||||||||||||||||||||||||
| 1409 | col | ||||||||||||||||||||||||||||||||||||||||||||||
| 1410 | crw | ||||||||||||||||||||||||||||||||||||||||||||||
| 1411 | cur | ||||||||||||||||||||||||||||||||||||||||||||||
| 1412 | dcx | ||||||||||||||||||||||||||||||||||||||||||||||
| 1413 | djv(?:u|) | ||||||||||||||||||||||||||||||||||||||||||||||
| 1414 | dwg | ||||||||||||||||||||||||||||||||||||||||||||||
| 1415 | dxf | ||||||||||||||||||||||||||||||||||||||||||||||
| 1416 | emf | ||||||||||||||||||||||||||||||||||||||||||||||
| 1417 | fpx | ||||||||||||||||||||||||||||||||||||||||||||||
| 1418 | ic[lno] | ||||||||||||||||||||||||||||||||||||||||||||||
| 1419 | ief | ||||||||||||||||||||||||||||||||||||||||||||||
| 1420 | iff | ||||||||||||||||||||||||||||||||||||||||||||||
| 1421 | ilbm | ||||||||||||||||||||||||||||||||||||||||||||||
| 1422 | int(?:a|) | ||||||||||||||||||||||||||||||||||||||||||||||
| 1423 | iw4 | ||||||||||||||||||||||||||||||||||||||||||||||
| 1424 | jfif | ||||||||||||||||||||||||||||||||||||||||||||||
| 1425 | kdc | ||||||||||||||||||||||||||||||||||||||||||||||
| 1426 | lbm | ||||||||||||||||||||||||||||||||||||||||||||||
| 1427 | mag | ||||||||||||||||||||||||||||||||||||||||||||||
| 1428 | pc[dxt] | ||||||||||||||||||||||||||||||||||||||||||||||
| 1429 | pic(?:t|) | ||||||||||||||||||||||||||||||||||||||||||||||
| 1430 | pix | ||||||||||||||||||||||||||||||||||||||||||||||
| 1431 | p[nbgp]m | ||||||||||||||||||||||||||||||||||||||||||||||
| 1432 | pntg | ||||||||||||||||||||||||||||||||||||||||||||||
| 1433 | ps[dp] | ||||||||||||||||||||||||||||||||||||||||||||||
| 1434 | qtif | ||||||||||||||||||||||||||||||||||||||||||||||
| 1435 | ras | ||||||||||||||||||||||||||||||||||||||||||||||
| 1436 | rgb(?:a|) | ||||||||||||||||||||||||||||||||||||||||||||||
| 1437 | rle | ||||||||||||||||||||||||||||||||||||||||||||||
| 1438 | rsb | ||||||||||||||||||||||||||||||||||||||||||||||
| 1439 | sgi | ||||||||||||||||||||||||||||||||||||||||||||||
| 1440 | sid | ||||||||||||||||||||||||||||||||||||||||||||||
| 1441 | svg | ||||||||||||||||||||||||||||||||||||||||||||||
| 1442 | targa | ||||||||||||||||||||||||||||||||||||||||||||||
| 1443 | tga | ||||||||||||||||||||||||||||||||||||||||||||||
| 1444 | thm | ||||||||||||||||||||||||||||||||||||||||||||||
| 1445 | tif(?:f|) | ||||||||||||||||||||||||||||||||||||||||||||||
| 1446 | yuv | ||||||||||||||||||||||||||||||||||||||||||||||
| 1447 | wbmp | ||||||||||||||||||||||||||||||||||||||||||||||
| 1448 | wmf | ||||||||||||||||||||||||||||||||||||||||||||||
| 1449 | x[bp]m | ||||||||||||||||||||||||||||||||||||||||||||||
| 1450 | xif | ||||||||||||||||||||||||||||||||||||||||||||||
| 1451 | xwd | ||||||||||||||||||||||||||||||||||||||||||||||
| 1452 | DATA | ||||||||||||||||||||||||||||||||||||||||||||||
| 1453 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1454 | 21 | ▶ | sub getpattern_postfix_free { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getpattern_postfix_free: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1455 | 21 | return shift->parse_patterns(<<'DATA'); | |||||||||||||||||||||||||||||||||||||||||||||
| 1456 | htm(?:l|) | ||||||||||||||||||||||||||||||||||||||||||||||
| 1457 | cgi | ||||||||||||||||||||||||||||||||||||||||||||||
| 1458 | jsp | ||||||||||||||||||||||||||||||||||||||||||||||
| 1459 | asp(?:x|) | ||||||||||||||||||||||||||||||||||||||||||||||
| 1460 | php(?:\d|) | ||||||||||||||||||||||||||||||||||||||||||||||
| 1461 | cfm | ||||||||||||||||||||||||||||||||||||||||||||||
| 1462 | phtml | ||||||||||||||||||||||||||||||||||||||||||||||
| 1463 | pl | ||||||||||||||||||||||||||||||||||||||||||||||
| 1464 | nph | ||||||||||||||||||||||||||||||||||||||||||||||
| 1465 | fcgi | ||||||||||||||||||||||||||||||||||||||||||||||
| 1466 | ht[ac] | ||||||||||||||||||||||||||||||||||||||||||||||
| 1467 | DATA | ||||||||||||||||||||||||||||||||||||||||||||||
| 1468 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1469 | 21 | ▶ | sub contenttype_init { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
contenttype_init: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1470 | shift->{Content_Type} = { | ||||||||||||||||||||||||||||||||||||||||||||||
| 1471 | 21 | 'text/plain' => 'txt', | |||||||||||||||||||||||||||||||||||||||||||||
| 1472 | 'text/html' => 'txt', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1473 | 'image/jpeg' => 'jpg', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1474 | 'image/png' => 'png', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1475 | 'image/gif' => 'gif', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1476 | 'application/ami' => 'ami', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1477 | 'application/caa' => 'caa', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1478 | 'application/caj' => 'caj', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1479 | 'application/cas' => 'cas', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1480 | 'application/cdf' => 'cdf', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1481 | 'application/andrew-inset' => 'ez', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1482 | 'application/fractals' => 'fif', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1483 | 'application/futuresplash' => 'spl', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1484 | 'application/kdh' => 'kdh', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1485 | 'application/mac-binhex40' => 'hqx', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1486 | 'application/mac-compactpro' => 'cpt', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1487 | 'application/msaccess' => 'mdb', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1488 | 'application/msword' => 'doc', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1489 | 'application/nh' => 'nh', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1490 | 'application/octet-stream' => 'exe', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1491 | 'application/oda' => 'oda', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1492 | 'application/pdf' => 'pdf', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1493 | 'application/pkcs10' => 'p10', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1494 | 'application/pkcs7-mime' => 'p7m', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1495 | 'application/pkcs7-signature' => 'p7s', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1496 | 'application/pkix-cert' => 'cer', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1497 | 'application/pkix-crl' => 'crl', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1498 | 'application/postscript' => 'ps', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1499 | 'application/rat-file' => 'rat', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1500 | 'application/sdp' => 'sdp', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1501 | 'application/set-payment-initiation' => 'setpay', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1502 | 'application/set-registration-initiation' => 'setreg', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1503 | 'application/smil' => 'smil', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1504 | 'application/streamingmedia' => 'ssm', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1505 | 'application/vnd.adobe.xfdf' => 'xfdf', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1506 | 'application/vnd.fdf' => 'fdf', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1507 | 'application/vnd.mif' => 'mif', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1508 | 'application/vnd.ms-excel' => 'xls', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1509 | 'application/vnd.ms-mediapackage' => 'mpf', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1510 | 'application/vnd.ms-pki.certstore' => 'sst', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1511 | 'application/vnd.ms-pki.pko' => 'pko', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1512 | 'application/vnd.ms-pki.seccat' => 'cat', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1513 | 'application/vnd.ms-pki.stl' => 'stl', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1514 | 'application/vnd.ms-powerpoint' => 'ppt', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1515 | 'application/vnd.ms-project' => 'mpp', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1516 | 'application/vnd.ms-wpl' => 'wpl', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1517 | 'application/vnd.rn-realmedia' => 'rm', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1518 | 'application/vnd.rn-realmedia-vbr' => 'rmvb', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1519 | 'application/vnd.rn-realplayer' => 'rnx', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1520 | 'application/vnd.rn-realsystem-rjs' => 'rjs', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1521 | 'application/vnd.rn-realsystem-rmx' => 'rmx', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1522 | 'application/vnd.rn-rn_music_package' => 'rmp', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1523 | 'application/vnd.rn-rsml' => 'rsml', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1524 | 'application/vnd.visio' => 'vsd', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1525 | 'application/vnd.wap.wbxml' => 'wbxml', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1526 | 'application/vnd.wap.wmlc' => 'wmlc', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1527 | 'application/vnd.wap.wmlscriptc' => 'wmlsc', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1528 | 'application/xhtml+xml' => 'xhtml', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1529 | 'application/xml' => 'xml', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1530 | 'application/xml-dtd' => 'dtd', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1531 | 'application/x-ami' => 'ami', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1532 | 'application/x-bcpio' => 'bcpio', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1533 | 'application/x-ccf' => 'ccf', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1534 | 'application/x-cdf' => 'cdf', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1535 | 'application/x-cdlink' => 'vcd', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1536 | 'application/x-ceb' => 'ceb', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1537 | 'application/x-cef' => 'cef', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1538 | 'application/x-chess-pgn' => 'png', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1539 | 'application/x-compress' => 'z', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1540 | 'application/x-compressed' => 'tgz', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1541 | 'application/x-cpio' => 'cpio', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1542 | 'application/x-csh' => 'csh', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1543 | 'application/x-director' => 'dir', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1544 | 'application/x-dvi' => 'dvi', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1545 | 'application/x-futuresplash' => 'spl', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1546 | 'application/x-gtar' => 'gtar', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1547 | 'application/x-gzip' => 'gz', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1548 | 'application/x-hdf' => 'hdf', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1549 | 'application/x-internet-signup' => 'ins', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1550 | 'application/x-iphone' => 'iii', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1551 | 'application/x-javascript' => 'js', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1552 | 'application/x-java-jnlp-file' => 'jnlp', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1553 | 'application/x-koan' => 'skp', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1554 | 'application/x-latex' => 'latex', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1555 | 'application/x-netcdf' => 'cdf', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1556 | 'application/x-mix-transfer' => 'nix', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1557 | 'application/x-msdownload' => 'exe', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1558 | 'application/x-mplayer2' => 'asx', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1559 | 'application/x-msexcel' => 'xls', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1560 | 'application/x-mspowerpoint' => 'ppt', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1561 | 'application/x-ms-wmd' => 'wmd', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1562 | 'application/x-ms-wms' => 'wms', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1563 | 'application/x-ms-wmz' => 'wmz', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1564 | 'application/x-pkcs12' => 'p12', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1565 | 'application/x-pkcs7-certificates' => 'p7b', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1566 | 'application/x-pkcs7-certreqresp' => 'p7r', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1567 | 'application/x-quicktimeplayer' => 'qtl', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1568 | 'application/x-rtsp' => 'rtsp', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1569 | 'application/x-sdp' => 'sdp', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1570 | 'application/x-sh' => 'sh', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1571 | 'application/x-shar' => 'shar', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1572 | 'application/x-shockwave-flash' => 'swf', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1573 | 'application/x-stuffit' => 'sit', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1574 | 'application/x-sv4cpio' => 'sv4cpio', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1575 | 'application/x-sv4crc' => 'sv4crc', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1576 | 'application/x-tar' => 'tar', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1577 | 'application/x-tcl' => 'tcl', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1578 | 'application/x-tex' => 'tex', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1579 | 'application/x-texinfo' => 'texinfo', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1580 | 'application/x-troff' => 'tr', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1581 | 'application/x-troff-man' => 'man', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1582 | 'application/x-troff-me' => 'me', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1583 | 'application/x-troff-ms' => 'ms', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1584 | 'application/x-ustar' => 'ustar', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1585 | 'application/x-wais-source' => 'src', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1586 | 'application/x-x509-ca-cert' => 'cer', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1587 | 'application/x-zip-compressed' => 'zip', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1588 | 'application/zip' => 'zip', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1589 | 'audio/aiff' => 'aiff', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1590 | 'audio/basic' => 'au', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1591 | 'audio/mid' => 'mid', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1592 | 'audio/midi' => 'mid', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1593 | 'audio/mp3' => 'mp3', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1594 | 'audio/mp4' => 'mp4', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1595 | 'audio/mpeg' => 'mp3', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1596 | 'audio/mpegurl' => 'm3u', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1597 | 'audio/mpg' => 'mp3', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1598 | 'audio/vnd.qcelp' => 'qcp', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1599 | 'audio/vnd.rn-realaudio' => 'ra', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1600 | 'audio/wav' => 'wav', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1601 | 'audio/x-aiff' => 'aiff', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1602 | 'audio/x-gsm' => 'gsm', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1603 | 'audio/x-mid' => 'mid', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1604 | 'audio/x-midi' => 'mid', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1605 | 'audio/x-mp3' => 'mp3', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1606 | 'audio/x-mpeg' => 'mp3', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1607 | 'audio/x-mpegurl' => 'm3u', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1608 | 'audio/x-mpg' => 'mp3', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1609 | 'audio/x-ms-wax' => 'wax', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1610 | 'audio/x-ms-wma' => 'wma', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1611 | 'audio/x-pn-realaudio' => 'ram', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1612 | 'audio/x-realaudio' => 'ra', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1613 | 'audio/x-wav' => 'wav', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1614 | 'chemical/x-pdb' => 'pdb', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1615 | 'chemical/x-xyz' => 'xyz', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1616 | 'image/bmp' => 'bmp', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1617 | 'image/ief' => 'ief', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1618 | 'image/pict' => 'pict', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1619 | 'image/pjpeg' => 'jpg', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1620 | 'image/svg' => 'svg', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1621 | 'image/svg+xml' => 'svg', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1622 | 'image/svg-xml' => 'svg', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1623 | 'image/tiff' => 'tif', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1624 | 'image/vnd.djvu' => 'djvu', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1625 | 'image/vnd.dwg' => 'dwg', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1626 | 'image/vnd.dxf' => 'dxf', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1627 | 'image/vnd.rn-realflash' => 'rf', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1628 | 'image/vnd.rn-realpix' => 'rp', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1629 | 'image/vnd.wap.wbmp' => 'wbmp', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1630 | 'image/xbm' => 'xbm', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1631 | 'image/x-cmu-raster' => 'ras', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1632 | 'image/x-icon' => 'ico', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1633 | 'image/x-macpaint' => 'pntg', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1634 | 'image/x-pict' => 'pict', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1635 | 'image/x-png' => 'png', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1636 | 'image/x-portable-anymap' => 'pnm', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1637 | 'image/x-portable-bitmap' => 'pbm', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1638 | 'image/x-portable-graymap' => 'pgm', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1639 | 'image/x-portable-pixmap' => 'ppm', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1640 | 'image/x-quicktime' => 'qtif', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1641 | 'image/x-rgb' => 'rgb', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1642 | 'image/x-sgi' => 'sgi', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1643 | 'image/x-targa' => 'targa', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1644 | 'image/x-tiff' => 'tif', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1645 | 'image/x-xbitmap' => 'xbm', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1646 | 'image/x-xpixmap' => 'xpm', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1647 | 'image/x-xwindowdump' => 'xwd', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1648 | 'interface/x-winamp3-skin' => 'wal', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1649 | 'interface/x-winamp-skin' => 'wal', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1650 | 'midi/mid' => 'mid', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1651 | 'model/iges' => 'iges', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1652 | 'model/mesh' => 'mesh', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1653 | 'model/vnd.dwf' => 'dwf', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1654 | 'model/vrml' => 'vrml', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1655 | 'text/calendar' => 'ics', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1656 | 'text/css' => 'css', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1657 | 'text/h323' => '323', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1658 | 'text/iuls' => 'uls', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1659 | 'text/richtext' => 'rtx', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1660 | 'text/rtf' => 'rtf', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1661 | 'text/sgml' => 'sgml', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1662 | 'text/tab-separated-values' => 'tsv', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1663 | 'text/scriptlet' => 'wsc', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1664 | 'text/vnd.rn-realtext' => 'rt', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1665 | 'text/vnd.wap.wml' => 'wml', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1666 | 'text/vnd.wap.wmlscript' => 'wmls', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1667 | 'text/xml' => 'xml', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1668 | 'text/x-ms-iqy' => 'iqy', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1669 | 'text/x-ms-odc' => 'odc', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1670 | 'text/x-ms-rqy' => 'rqy', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1671 | 'text/x-setext' => 'etx', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1672 | 'text/x-vcard' => 'vcf', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1673 | 'video/avi' => 'avi', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1674 | 'video/flc' => 'flc', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1675 | 'video/mp4' => 'mp4', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1676 | 'video/mpeg' => 'mpg', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1677 | 'video/mpg' => 'mpg', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1678 | 'video/msvideo' => 'avi', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1679 | 'video/quicktime' => 'mov', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1680 | 'video/vnd.mpegurl' => 'mxu', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1681 | 'video/vnd.rn-realvideo' => 'rv', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1682 | 'video/x-ivf' => 'ivf', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1683 | 'video/x-mpeg' => 'mpg', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1684 | 'video/x-mpeg2a' => 'mpg', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1685 | 'video/x-ms-asf' => 'asf', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1686 | 'video/x-ms-asf-plugin' => 'asx', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1687 | 'video/x-msvideo' => 'avi', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1688 | 'video/x-ms-wm' => 'wm', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1689 | 'video/x-ms-wmp' => 'wmp', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1690 | 'video/x-ms-wmv' => 'wmv', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1691 | 'video/x-ms-wmx' => 'wmx', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1692 | 'video/x-ms-wvx' => 'wvx', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1693 | 'video/x-sgi-movie' => 'movie', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1694 | 'x-conference/x-cooltalk' => 'ice', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1695 | }; | ||||||||||||||||||||||||||||||||||||||||||||||
| 1696 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1697 | 3 | %entity2char = ( # copied from HTML::Entities | |||||||||||||||||||||||||||||||||||||||||||||
| 1698 | # Some normal chars that have special meaning in SGML context | ||||||||||||||||||||||||||||||||||||||||||||||
| 1699 | amp => '&', # ampersand | ||||||||||||||||||||||||||||||||||||||||||||||
| 1700 | 'gt' => '>', # greater than | ||||||||||||||||||||||||||||||||||||||||||||||
| 1701 | 'lt' => '<', # less than | ||||||||||||||||||||||||||||||||||||||||||||||
| 1702 | quot => '"', # double quote | ||||||||||||||||||||||||||||||||||||||||||||||
| 1703 | apos => "'", # single quote | ||||||||||||||||||||||||||||||||||||||||||||||
| 1704 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1705 | # PUBLIC ISO 8879-1986//ENTITIES Added Latin 1//EN//HTML | ||||||||||||||||||||||||||||||||||||||||||||||
| 1706 | AElig => 'Æ', # capital AE diphthong (ligature) | ||||||||||||||||||||||||||||||||||||||||||||||
| 1707 | Aacute => 'Á', # capital A, acute accent | ||||||||||||||||||||||||||||||||||||||||||||||
| 1708 | Acirc => 'Â', # capital A, circumflex accent | ||||||||||||||||||||||||||||||||||||||||||||||
| 1709 | Agrave => 'À', # capital A, grave accent | ||||||||||||||||||||||||||||||||||||||||||||||
| 1710 | Aring => 'Å', # capital A, ring | ||||||||||||||||||||||||||||||||||||||||||||||
| 1711 | Atilde => 'Ã', # capital A, tilde | ||||||||||||||||||||||||||||||||||||||||||||||
| 1712 | Auml => 'Ä', # capital A, dieresis or umlaut mark | ||||||||||||||||||||||||||||||||||||||||||||||
| 1713 | Ccedil => 'Ç', # capital C, cedilla | ||||||||||||||||||||||||||||||||||||||||||||||
| 1714 | ETH => 'Ð', # capital Eth, Icelandic | ||||||||||||||||||||||||||||||||||||||||||||||
| 1715 | Eacute => 'É', # capital E, acute accent | ||||||||||||||||||||||||||||||||||||||||||||||
| 1716 | Ecirc => 'Ê', # capital E, circumflex accent | ||||||||||||||||||||||||||||||||||||||||||||||
| 1717 | Egrave => 'È', # capital E, grave accent | ||||||||||||||||||||||||||||||||||||||||||||||
| 1718 | Euml => 'Ë', # capital E, dieresis or umlaut mark | ||||||||||||||||||||||||||||||||||||||||||||||
| 1719 | Iacute => 'Í', # capital I, acute accent | ||||||||||||||||||||||||||||||||||||||||||||||
| 1720 | Icirc => 'Î', # capital I, circumflex accent | ||||||||||||||||||||||||||||||||||||||||||||||
| 1721 | Igrave => 'Ì', # capital I, grave accent | ||||||||||||||||||||||||||||||||||||||||||||||
| 1722 | Iuml => 'Ï', # capital I, dieresis or umlaut mark | ||||||||||||||||||||||||||||||||||||||||||||||
| 1723 | Ntilde => 'Ñ', # capital N, tilde | ||||||||||||||||||||||||||||||||||||||||||||||
| 1724 | Oacute => 'Ó', # capital O, acute accent | ||||||||||||||||||||||||||||||||||||||||||||||
| 1725 | Ocirc => 'Ô', # capital O, circumflex accent | ||||||||||||||||||||||||||||||||||||||||||||||
| 1726 | Ograve => 'Ò', # capital O, grave accent | ||||||||||||||||||||||||||||||||||||||||||||||
| 1727 | Oslash => 'Ø', # capital O, slash | ||||||||||||||||||||||||||||||||||||||||||||||
| 1728 | Otilde => 'Õ', # capital O, tilde | ||||||||||||||||||||||||||||||||||||||||||||||
| 1729 | Ouml => 'Ö', # capital O, dieresis or umlaut mark | ||||||||||||||||||||||||||||||||||||||||||||||
| 1730 | THORN => 'Þ', # capital THORN, Icelandic | ||||||||||||||||||||||||||||||||||||||||||||||
| 1731 | Uacute => 'Ú', # capital U, acute accent | ||||||||||||||||||||||||||||||||||||||||||||||
| 1732 | Ucirc => 'Û', # capital U, circumflex accent | ||||||||||||||||||||||||||||||||||||||||||||||
| 1733 | Ugrave => 'Ù', # capital U, grave accent | ||||||||||||||||||||||||||||||||||||||||||||||
| 1734 | Uuml => 'Ü', # capital U, dieresis or umlaut mark | ||||||||||||||||||||||||||||||||||||||||||||||
| 1735 | Yacute => 'Ý', # capital Y, acute accent | ||||||||||||||||||||||||||||||||||||||||||||||
| 1736 | aacute => 'á', # small a, acute accent | ||||||||||||||||||||||||||||||||||||||||||||||
| 1737 | acirc => 'â', # small a, circumflex accent | ||||||||||||||||||||||||||||||||||||||||||||||
| 1738 | aelig => 'æ', # small ae diphthong (ligature) | ||||||||||||||||||||||||||||||||||||||||||||||
| 1739 | agrave => 'à', # small a, grave accent | ||||||||||||||||||||||||||||||||||||||||||||||
| 1740 | aring => 'å', # small a, ring | ||||||||||||||||||||||||||||||||||||||||||||||
| 1741 | atilde => 'ã', # small a, tilde | ||||||||||||||||||||||||||||||||||||||||||||||
| 1742 | auml => 'ä', # small a, dieresis or umlaut mark | ||||||||||||||||||||||||||||||||||||||||||||||
| 1743 | ccedil => 'ç', # small c, cedilla | ||||||||||||||||||||||||||||||||||||||||||||||
| 1744 | eacute => 'é', # small e, acute accent | ||||||||||||||||||||||||||||||||||||||||||||||
| 1745 | ecirc => 'ê', # small e, circumflex accent | ||||||||||||||||||||||||||||||||||||||||||||||
| 1746 | egrave => 'è', # small e, grave accent | ||||||||||||||||||||||||||||||||||||||||||||||
| 1747 | eth => 'ð', # small eth, Icelandic | ||||||||||||||||||||||||||||||||||||||||||||||
| 1748 | euml => 'ë', # small e, dieresis or umlaut mark | ||||||||||||||||||||||||||||||||||||||||||||||
| 1749 | iacute => 'í', # small i, acute accent | ||||||||||||||||||||||||||||||||||||||||||||||
| 1750 | icirc => 'î', # small i, circumflex accent | ||||||||||||||||||||||||||||||||||||||||||||||
| 1751 | igrave => 'ì', # small i, grave accent | ||||||||||||||||||||||||||||||||||||||||||||||
| 1752 | iuml => 'ï', # small i, dieresis or umlaut mark | ||||||||||||||||||||||||||||||||||||||||||||||
| 1753 | ntilde => 'ñ', # small n, tilde | ||||||||||||||||||||||||||||||||||||||||||||||
| 1754 | oacute => 'ó', # small o, acute accent | ||||||||||||||||||||||||||||||||||||||||||||||
| 1755 | ocirc => 'ô', # small o, circumflex accent | ||||||||||||||||||||||||||||||||||||||||||||||
| 1756 | ograve => 'ò', # small o, grave accent | ||||||||||||||||||||||||||||||||||||||||||||||
| 1757 | oslash => 'ø', # small o, slash | ||||||||||||||||||||||||||||||||||||||||||||||
| 1758 | otilde => 'õ', # small o, tilde | ||||||||||||||||||||||||||||||||||||||||||||||
| 1759 | ouml => 'ö', # small o, dieresis or umlaut mark | ||||||||||||||||||||||||||||||||||||||||||||||
| 1760 | szlig => 'ß', # small sharp s, German (sz ligature) | ||||||||||||||||||||||||||||||||||||||||||||||
| 1761 | thorn => 'þ', # small thorn, Icelandic | ||||||||||||||||||||||||||||||||||||||||||||||
| 1762 | uacute => 'ú', # small u, acute accent | ||||||||||||||||||||||||||||||||||||||||||||||
| 1763 | ucirc => 'û', # small u, circumflex accent | ||||||||||||||||||||||||||||||||||||||||||||||
| 1764 | ugrave => 'ù', # small u, grave accent | ||||||||||||||||||||||||||||||||||||||||||||||
| 1765 | uuml => 'ü', # small u, dieresis or umlaut mark | ||||||||||||||||||||||||||||||||||||||||||||||
| 1766 | yacute => 'ý', # small y, acute accent | ||||||||||||||||||||||||||||||||||||||||||||||
| 1767 | yuml => 'ÿ', # small y, dieresis or umlaut mark | ||||||||||||||||||||||||||||||||||||||||||||||
| 1768 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1769 | # Some extra Latin 1 chars that are listed in the HTML3.2 draft (21-May-96) | ||||||||||||||||||||||||||||||||||||||||||||||
| 1770 | copy => '©', # copyright sign | ||||||||||||||||||||||||||||||||||||||||||||||
| 1771 | reg => '®', # registered sign | ||||||||||||||||||||||||||||||||||||||||||||||
| 1772 | nbsp => " ", # non breaking space | ||||||||||||||||||||||||||||||||||||||||||||||
| 1773 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1774 | # Additional ISO-8859/1 entities listed in rfc1866 (section 14) | ||||||||||||||||||||||||||||||||||||||||||||||
| 1775 | iexcl => '¡', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1776 | cent => '¢', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1777 | pound => '£', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1778 | curren => '¤', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1779 | yen => '¥', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1780 | brvbar => '¦', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1781 | sect => '§', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1782 | uml => '¨', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1783 | ordf => 'ª', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1784 | laquo => '«', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1785 | 'not' => '¬', # not is a keyword in perl | ||||||||||||||||||||||||||||||||||||||||||||||
| 1786 | shy => '', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1787 | macr => '¯', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1788 | deg => '°', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1789 | plusmn => '±', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1790 | sup1 => '¹', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1791 | sup2 => '²', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1792 | sup3 => '³', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1793 | acute => '´', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1794 | micro => 'µ', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1795 | para => '¶', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1796 | middot => '·', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1797 | cedil => '¸', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1798 | ordm => 'º', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1799 | raquo => '»', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1800 | frac14 => '¼', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1801 | frac12 => '½', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1802 | frac34 => '¾', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1803 | iquest => '¿', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1804 | 'times' => '×', # times is a keyword in perl | ||||||||||||||||||||||||||||||||||||||||||||||
| 1805 | divide => '÷', | ||||||||||||||||||||||||||||||||||||||||||||||
| 1806 | OElig => chr(338), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1807 | oelig => chr(339), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1808 | Scaron => chr(352), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1809 | scaron => chr(353), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1810 | Yuml => chr(376), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1811 | fnof => chr(402), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1812 | circ => chr(710), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1813 | tilde => chr(732), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1814 | Alpha => chr(913), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1815 | Beta => chr(914), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1816 | Gamma => chr(915), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1817 | Delta => chr(916), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1818 | Epsilon => chr(917), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1819 | Zeta => chr(918), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1820 | Eta => chr(919), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1821 | Theta => chr(920), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1822 | Iota => chr(921), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1823 | Kappa => chr(922), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1824 | Lambda => chr(923), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1825 | Mu => chr(924), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1826 | Nu => chr(925), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1827 | Xi => chr(926), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1828 | Omicron => chr(927), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1829 | Pi => chr(928), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1830 | Rho => chr(929), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1831 | Sigma => chr(931), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1832 | Tau => chr(932), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1833 | Upsilon => chr(933), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1834 | Phi => chr(934), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1835 | Chi => chr(935), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1836 | Psi => chr(936), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1837 | Omega => chr(937), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1838 | alpha => chr(945), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1839 | beta => chr(946), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1840 | gamma => chr(947), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1841 | delta => chr(948), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1842 | epsilon => chr(949), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1843 | zeta => chr(950), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1844 | eta => chr(951), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1845 | theta => chr(952), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1846 | iota => chr(953), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1847 | kappa => chr(954), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1848 | lambda => chr(955), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1849 | mu => chr(956), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1850 | nu => chr(957), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1851 | xi => chr(958), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1852 | omicron => chr(959), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1853 | pi => chr(960), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1854 | rho => chr(961), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1855 | sigmaf => chr(962), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1856 | sigma => chr(963), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1857 | tau => chr(964), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1858 | upsilon => chr(965), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1859 | phi => chr(966), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1860 | chi => chr(967), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1861 | psi => chr(968), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1862 | omega => chr(969), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1863 | thetasym => chr(977), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1864 | upsih => chr(978), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1865 | piv => chr(982), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1866 | ensp => chr(8194), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1867 | emsp => chr(8195), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1868 | thinsp => chr(8201), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1869 | zwnj => chr(8204), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1870 | zwj => chr(8205), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1871 | lrm => chr(8206), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1872 | rlm => chr(8207), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1873 | ndash => chr(8211), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1874 | mdash => chr(8212), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1875 | lsquo => chr(8216), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1876 | rsquo => chr(8217), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1877 | sbquo => chr(8218), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1878 | ldquo => chr(8220), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1879 | rdquo => chr(8221), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1880 | bdquo => chr(8222), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1881 | dagger => chr(8224), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1882 | Dagger => chr(8225), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1883 | bull => chr(8226), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1884 | hellip => chr(8230), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1885 | permil => chr(8240), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1886 | prime => chr(8242), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1887 | Prime => chr(8243), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1888 | lsaquo => chr(8249), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1889 | rsaquo => chr(8250), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1890 | oline => chr(8254), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1891 | frasl => chr(8260), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1892 | euro => chr(8364), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1893 | image => chr(8465), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1894 | weierp => chr(8472), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1895 | real => chr(8476), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1896 | trade => chr(8482), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1897 | alefsym => chr(8501), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1898 | larr => chr(8592), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1899 | uarr => chr(8593), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1900 | rarr => chr(8594), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1901 | darr => chr(8595), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1902 | harr => chr(8596), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1903 | crarr => chr(8629), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1904 | lArr => chr(8656), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1905 | uArr => chr(8657), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1906 | rArr => chr(8658), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1907 | dArr => chr(8659), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1908 | hArr => chr(8660), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1909 | forall => chr(8704), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1910 | part => chr(8706), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1911 | exist => chr(8707), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1912 | empty => chr(8709), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1913 | nabla => chr(8711), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1914 | isin => chr(8712), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1915 | notin => chr(8713), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1916 | ni => chr(8715), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1917 | prod => chr(8719), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1918 | sum => chr(8721), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1919 | minus => chr(8722), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1920 | lowast => chr(8727), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1921 | radic => chr(8730), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1922 | prop => chr(8733), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1923 | infin => chr(8734), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1924 | ang => chr(8736), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1925 | 'and' => chr(8743), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1926 | 'or' => chr(8744), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1927 | cap => chr(8745), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1928 | cup => chr(8746), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1929 | 'int' => chr(8747), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1930 | there4 => chr(8756), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1931 | sim => chr(8764), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1932 | cong => chr(8773), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1933 | asymp => chr(8776), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1934 | 'ne' => chr(8800), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1935 | equiv => chr(8801), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1936 | 'le' => chr(8804), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1937 | 'ge' => chr(8805), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1938 | 'sub' => chr(8834), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1939 | sup => chr(8835), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1940 | nsub => chr(8836), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1941 | sube => chr(8838), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1942 | supe => chr(8839), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1943 | oplus => chr(8853), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1944 | otimes => chr(8855), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1945 | perp => chr(8869), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1946 | sdot => chr(8901), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1947 | lceil => chr(8968), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1948 | rceil => chr(8969), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1949 | lfloor => chr(8970), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1950 | rfloor => chr(8971), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1951 | lang => chr(9001), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1952 | rang => chr(9002), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1953 | loz => chr(9674), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1954 | spades => chr(9824), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1955 | clubs => chr(9827), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1956 | hearts => chr(9829), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1957 | diams => chr(9830), | ||||||||||||||||||||||||||||||||||||||||||||||
| 1958 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 1959 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1960 | #------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 1961 | # callback functions | ||||||||||||||||||||||||||||||||||||||||||||||
| 1962 | # $bot->get_alias() => $alias | ||||||||||||||||||||||||||||||||||||||||||||||
| 1963 | # $bot->argv_default() => @argv_args | ||||||||||||||||||||||||||||||||||||||||||||||
| 1964 | # qw(cat1=i cat2=i pageno=i desc=s) | ||||||||||||||||||||||||||||||||||||||||||||||
| 1965 | # $bot->argv_process(\%args) => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 1966 | # $bot->argv_process_all(\%args) => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 1967 | # $bot->get_url_verify($url_in_out) => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 1968 | # a callback to verify or change $url before real get | ||||||||||||||||||||||||||||||||||||||||||||||
| 1969 | # $bot->go_login() => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 1970 | # $bot->getpattern_catalog_head_data() => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 1971 | # $bot->getpattern_catalog_end_data() => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 1972 | # $bot->getpattern_catalog_get_bookargs_data() => $raw_pattern | ||||||||||||||||||||||||||||||||||||||||||||||
| 1973 | # $bot->catalog_get_bookargs(\%args) => 'OK' / 'Skip' | ||||||||||||||||||||||||||||||||||||||||||||||
| 1974 | # called after match | ||||||||||||||||||||||||||||||||||||||||||||||
| 1975 | # $bot->getpattern_chapters_head_data() => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 1976 | # $bot->getpattern_chapters_end_data() => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 1977 | # $bot->getpattern_chapters_get_chapterargs_data() => $raw_pattern | ||||||||||||||||||||||||||||||||||||||||||||||
| 1978 | # $bot->chapters_get_chapterargs(\%args) => 'OK' / 'Skip' | ||||||||||||||||||||||||||||||||||||||||||||||
| 1979 | # called after match | ||||||||||||||||||||||||||||||||||||||||||||||
| 1980 | # $bot->getpattern_TOC_exists_data() => $raw_pattern | ||||||||||||||||||||||||||||||||||||||||||||||
| 1981 | # '' means TOC is always exists | ||||||||||||||||||||||||||||||||||||||||||||||
| 1982 | # $bot->getpattern_TOC_head_data() => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 1983 | # $bot->getpattern_TOC_end_data() => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 1984 | # $bot->getpattern_chapter_head_data() => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 1985 | # $bot->getpattern_chapter_end_data() => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 1986 | # $bot->parse_paragraph_begin($content_dein_deout) => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 1987 | # $bot->parse_paragraph_end($content_dein_deout) => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 1988 | # $bot->book_finish(\%args) => N/A | ||||||||||||||||||||||||||||||||||||||||||||||
| 1989 | # $bot->result_filestem(\%args) => filestem | ||||||||||||||||||||||||||||||||||||||||||||||
| 1990 | # $bot->result_time(\%args) => time / undef | ||||||||||||||||||||||||||||||||||||||||||||||
| 1991 | # undef forbiden bot to set file time | ||||||||||||||||||||||||||||||||||||||||||||||
| 1992 | #------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 1993 | 21 | ▶ | sub get_alias { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_alias: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1994 | 21 | 'unknown'; | |||||||||||||||||||||||||||||||||||||||||||||
| 1995 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1996 | 0 | ▶ | sub argv_default { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
argv_default: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1997 | # default argv list in Getopt::Long format, to pass back to argv_process | ||||||||||||||||||||||||||||||||||||||||||||||
| 1998 | 0 | qw(); | |||||||||||||||||||||||||||||||||||||||||||||
| 1999 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 2000 | 0 | ▶ | sub argv_process { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
argv_process: not called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 2001 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 2002 | 0 | ▶ | sub argv_process_all { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
argv_process_all: not called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 2003 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 2004 | 0 | ▶ | sub get_url_verify { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_url_verify: not called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 2005 | # a call back to verify or change $_[1] before real get | ||||||||||||||||||||||||||||||||||||||||||||||
| 2006 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 2007 | 21 | ▶ | sub go_login { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
go_login: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 2008 | # login after initialize | ||||||||||||||||||||||||||||||||||||||||||||||
| 2009 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 2010 | 21 | ▶ | sub getpattern_catalog_head_data { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getpattern_catalog_head_data: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 2011 | 21 | <<'DATA'; | |||||||||||||||||||||||||||||||||||||||||||||
| 2012 | (?=<body) | ||||||||||||||||||||||||||||||||||||||||||||||
| 2013 | DATA | ||||||||||||||||||||||||||||||||||||||||||||||
| 2014 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 2015 | 21 | ▶ | sub getpattern_catalog_end_data { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getpattern_catalog_end_data: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 2016 | 21 | <<'DATA'; | |||||||||||||||||||||||||||||||||||||||||||||
| 2017 | </body> | ||||||||||||||||||||||||||||||||||||||||||||||
| 2018 | DATA | ||||||||||||||||||||||||||||||||||||||||||||||
| 2019 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 2020 | 21 | ▶ | sub getpattern_catalog_get_bookargs_data { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getpattern_catalog_get_bookargs_data: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 2021 | 21 | <<'DATA'; | |||||||||||||||||||||||||||||||||||||||||||||
| 2022 | <a[^<>]*href=['"]{0,1}(.*?)(?:['" ][^<>]*>|>)(.*?)</a> | ||||||||||||||||||||||||||||||||||||||||||||||
| 2023 | DATA | ||||||||||||||||||||||||||||||||||||||||||||||
| 2024 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 2025 | 3 | ▶ | sub catalog_get_bookargs { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
catalog_get_bookargs: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 2026 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 2027 | 3 | my @a=@_; | |||||||||||||||||||||||||||||||||||||||||||||
| 2028 | 3 | my $pargs=$a[0]; | |||||||||||||||||||||||||||||||||||||||||||||
| 2029 | 3 | $pargs->{url}=$a[1]; | |||||||||||||||||||||||||||||||||||||||||||||
| 2030 | 3 | $pargs->{title}=$self->parse_titleen($a[2]); | |||||||||||||||||||||||||||||||||||||||||||||
| 2031 | 3 | 'OK'; | |||||||||||||||||||||||||||||||||||||||||||||
| 2032 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 2033 | 21 | ▶ | sub getpattern_catalog_get_next_data { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getpattern_catalog_get_next_data: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 2034 | 21 | ''; #'' means don't know how to stop | |||||||||||||||||||||||||||||||||||||||||||||
| 2035 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 2036 | 21 | ▶ | sub getpattern_chapters_head_data { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getpattern_chapters_head_data: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 2037 | 21 | $_[0]->getpattern_TOC_head_data; | |||||||||||||||||||||||||||||||||||||||||||||
| 2038 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 2039 | 21 | ▶ | sub getpattern_chapters_end_data { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getpattern_chapters_end_data: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 2040 | 21 | $_[0]->getpattern_TOC_end_data; | |||||||||||||||||||||||||||||||||||||||||||||
| 2041 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 2042 | 21 | ▶ | sub getpattern_chapters_get_chapterargs_data { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getpattern_chapters_get_chapterargs_data: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 2043 | 21 | <<'DATA'; | |||||||||||||||||||||||||||||||||||||||||||||
| 2044 | <a[^<>]*href=['"]{0,1}(.*?)(?:['" ][^<>]*>|>)(.*?)</a> | ||||||||||||||||||||||||||||||||||||||||||||||
| 2045 | DATA | ||||||||||||||||||||||||||||||||||||||||||||||
| 2046 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 2047 | 3 | ▶ | sub chapters_get_chapterargs { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
chapters_get_chapterargs: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 2048 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 2049 | 3 | my @a=@_; | |||||||||||||||||||||||||||||||||||||||||||||
| 2050 | 3 | my $pargs=$a[0]; | |||||||||||||||||||||||||||||||||||||||||||||
| 2051 | 3 | $pargs->{url}=$a[1]; | |||||||||||||||||||||||||||||||||||||||||||||
| 2052 | 3 | $pargs->{title}=$self->parse_titleen($a[2]); | |||||||||||||||||||||||||||||||||||||||||||||
| 2053 | 3 | 'OK'; | |||||||||||||||||||||||||||||||||||||||||||||
| 2054 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 2055 | 21 | ▶ | sub getpattern_TOC_exists_data { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getpattern_TOC_exists_data: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 2056 | 21 | ''; | |||||||||||||||||||||||||||||||||||||||||||||
| 2057 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 2058 | 42 | ▶ | sub getpattern_TOC_head_data { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getpattern_TOC_head_data: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 2059 | 42 | <<'DATA'; | |||||||||||||||||||||||||||||||||||||||||||||
| 2060 | (?=<body) | ||||||||||||||||||||||||||||||||||||||||||||||
| 2061 | DATA | ||||||||||||||||||||||||||||||||||||||||||||||
| 2062 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 2063 | 42 | ▶ | sub getpattern_TOC_end_data { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getpattern_TOC_end_data: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 2064 | 42 | <<'DATA'; | |||||||||||||||||||||||||||||||||||||||||||||
| 2065 | </body> | ||||||||||||||||||||||||||||||||||||||||||||||
| 2066 | DATA | ||||||||||||||||||||||||||||||||||||||||||||||
| 2067 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 2068 | 21 | ▶ | sub getpattern_chapter_head_data { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getpattern_chapter_head_data: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 2069 | 21 | <<'DATA'; | |||||||||||||||||||||||||||||||||||||||||||||
| 2070 | (?=<body) | ||||||||||||||||||||||||||||||||||||||||||||||
| 2071 | DATA | ||||||||||||||||||||||||||||||||||||||||||||||
| 2072 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 2073 | 21 | ▶ | sub getpattern_chapter_end_data { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getpattern_chapter_end_data: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 2074 | 21 | <<'DATA'; | |||||||||||||||||||||||||||||||||||||||||||||
| 2075 | </body> | ||||||||||||||||||||||||||||||||||||||||||||||
| 2076 | DATA | ||||||||||||||||||||||||||||||||||||||||||||||
| 2077 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 2078 | 9 | ▶ | sub parse_paragraph_begin { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_paragraph_begin: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 2079 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 2080 | 9 | ▶ | sub parse_paragraph_end { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_paragraph_end: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 2081 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 2082 | 3 | ▶ | sub book_finish { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
book_finish: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 2083 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 2084 | 18 | ▶ | sub result_filestem { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
result_filestem: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 2085 | 18 | my ($self, $pargs) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 2086 | return $pargs->{prefix}. | ||||||||||||||||||||||||||||||||||||||||||||||
| 2087 | sprintf("%04d",$self->{book_get_num}). | ||||||||||||||||||||||||||||||||||||||||||||||
| 2088 | $pargs->{title}. | ||||||||||||||||||||||||||||||||||||||||||||||
| 2089 | 18 | $pargs->{postfix}; | |||||||||||||||||||||||||||||||||||||||||||||
| 2090 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 2091 | 9 | ▶ | sub result_time { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
result_time: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 2092 | 9 | my ($self, $pargs) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 2093 | 9 | return $pargs->{last_modified}; | |||||||||||||||||||||||||||||||||||||||||||||
| 2094 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 2095 | |||||||||||||||||||||||||||||||||||||||||||||||
| 2096 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 2097 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||