| 1 | package Data::ToruCa; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 4 | ▶ | use MIME::Base64; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 4 | ▶ | use vars qw(@ISA @EXPORT_OK); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 4 | require Exporter; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 4 | @ISA = qw(Exporter); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 4 | @EXPORT_OK = qw(cat2pict); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 4 | our $VERSION = '0.06'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 4 | our $VERBOSE = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 3 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=5 SCAR=16.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 3 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 3 | my $opt = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 3 | my $self = bless {}, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 3 | ▶ | if (ref($opt) eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 1 | foreach (keys %$opt) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 7 | $self->{$_} = $opt->{$_}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | ▶ | } elsif (ref($opt) eq '' && $opt) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
ref $opt eq "" and $opt
MC/DC0%0/2
ref $opt eq "" and $opt
ref $opt eq ""
$opt
Truth table33%1/3
A and B
A= ref $opt eq ""B= $opt
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 2 | $self->parse($opt); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 3 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | ▶ | sub _warn { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_warn: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | ▶ | warn shift | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | if ($VERBOSE); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | ▶ | sub ext {'trc'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ext: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | sub content_type {'application/x-toruca'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
content_type: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 69 | ▶ | sub _accessor { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_accessor: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 69 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 69 | my $field = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 69 | my $size = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 69 | my $data = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 69 | ▶ | return $self->{$field} unless $data; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 18 | ▶ | _warn "length of $field is too large($size bytes)." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | if length($data) > $size; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 18 | $self->{$field} = $data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 6 | ▶ | sub version {shift->_accessor('version', 4, @_)} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
version: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 9 | ▶ | sub type {shift->_accessor('type', 8, @_)} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
type: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 8 | ▶ | sub url {shift->_accessor('url', 127, @_)} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
url: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 6 | ▶ | sub data1 {shift->_accessor('data1', 40, @_)} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
data1: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 6 | ▶ | sub data2 {shift->_accessor('data2', 100, @_)} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
data2: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 6 | ▶ | sub data3 {shift->_accessor('data3', 20, @_)} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
data3: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 14 | ▶ | sub cat {shift->_accessor('cat', 4, @_)} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cat: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 5 | ▶ | sub mime {my $self = shift;return $self->{mime} = @_ ? shift : $self->{mime}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mime: called CC=2 SCAR=6.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 2 | ▶ | sub pict {my $self = shift;$self->cat2pict($self->cat);} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pict: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 2 | ▶ | sub parse { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse: called CC=8 SCAR=20.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 2 | my $trc = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 2 | ▶ | unless ($trc =~ /^ToruCa\r\n/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | _warn 'toruca format error.'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 2 | my $mime; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 2 | my $c = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 2 | foreach (split(/\r\n/, $trc)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 28 | ▶ | if ($c < 2) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 19 | ▶ | if (/^([^:]+): (.+)$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 14 | my ($field, $data) = (lc($1), $2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 14 | ▶ | $data = decode_base64($data) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | if ($field =~ /^data/); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 14 | $self->_accessor($field, 200, $data); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | } elsif ($_ eq '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 3 | $c++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 9 | $mime .= "$_\r\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 2 | ▶ | if ($mime) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 1 | $mime =~ s/^\r\n//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 1 | $mime =~ s/\r\n$//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 1 | $self->mime($mime); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 2 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 2 | ▶ | sub _build { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build: called CC=7 SCAR=21.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 2 | ▶ | _warn 'length of (url & data1 & data2 & data3) is too large(173 bytes).' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | if length($self->url.$self->data1.$self->data2.$self->data3) > 173; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 2 | ▶ | _warn 'url schme error (http only).' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | unless $self->url =~ m|^http://|i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 2 | ▶ | $self->version('1.0') unless $self->version; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 2 | ▶ | $self->type('SNIP') unless $self->type; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 2 | ▶ | $self->cat('0000') unless $self->cat =~ m|^[0-9a-fA-F]{4,4}$|; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 2 | ▶ | $self->cat('0000') unless $self->cat; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 2 | $self->cat(uc($self->cat)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 2 | ▶ | sub build { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 2 | $self->_build; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 2 | return "ToruCa\r\n" . | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 'Version: ' . $self->version. "\r\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 'Type: ' . $self->type . "\r\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | "\r\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 'URL: '. $self->url . "\r\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 'Data1: ' . $self->_base64($self->data1) . "\r\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 'Data2: ' . $self->_base64($self->data2) . "\r\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 'Data3: ' . $self->_base64($self->data3) . "\r\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 'Cat: ' . $self->cat. "\r\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | "\r\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 1 | ▶ | sub detail_build { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
detail_build: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 1 | my $type = $self->type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 1 | $self->type('CARD'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 1 | my $toruca = $self->build; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 1 | $self->type($type); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 1 | return $toruca . $self->mime; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | ▶ | sub html_build { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
html_build: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | my $html = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | my $boundary; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | while (1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | $i++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | ▶ | return if $i > 100; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | $boundary = sprintf("%010d", rand(1000000000)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | ▶ | last unless $html =~ /$boundary/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | my $mime = $self->mime; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | $self->mime("MIME-Version: 1.0\r\n" . | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | "Content-Type: multipart/mixed;boundary=\"$boundary\"\r\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | "\r\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | "--$boundary\r\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | "Content-Type: text/html; charset=Shift_JIS\r\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | "Content-Transfer-Encoding: 8bit\r\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | "\r\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | "$html\r\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | "--$boundary--\r\n"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | my $toruca = $self->detail_build; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | $self->mime($mime); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | return $toruca; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | ▶ | sub rw_build { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rw_build: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | $self->_build; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | my $subprm = "\x01\x31\x30" . | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | pack("v", length($self->url)) . $self->url . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | pack("v", length($self->data1)) . $self->data1 . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | pack("v", length($self->data2)) . $self->data2 . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | pack("v", length($self->data3)) . $self->data3; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | $self->cat =~ /^(..)(..)$/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | my ($catb, $catl) = ($1, $2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | eval "\$subprm .= \"\\x$catb\\x$catl\";"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | my $data = "\x01\x20" . pack("v", length($subprm)) . $subprm; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | my $sum = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | foreach (split(//, $data)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | $sum += unpack("C", $_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | $data .= pack("n", 65536 - ($sum % 65536)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | return $data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 6 | ▶ | sub _base64 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_base64: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 6 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 6 | my $data = encode_base64(shift); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 6 | $data =~ s/\s//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 6 | return $data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 31 | ▶ | sub cat2pict { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cat2pict: called CC=19 SCAR=29.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 31 | ▶ | my $cat = ref($_[0]) eq __PACKAGE__ ? $_[1] : $_[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 31 | ▶ | return '' unless $cat =~ /^[0-9A-F]{1,4}$/io; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 31 | $cat =~ s/^0+//o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 31 | my $base = hex($cat); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 31 | my $pad = 63646; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 31 | ▶ | if ($base > 94 && $base < 105) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 9 branches
Condition100%3/3
$base > 94 and $base < 105
MC/DC100%2/2
$base > 94 and $base < 105
$base > 94
$base < 105
Truth table100%3/3
A and B
A= $base > 94B= $base < 105
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 3 | $pad = 63808 - 95; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | ▶ | } elsif ($base > 104 && $base < 118) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$base > 104 and $base < 118
MC/DC100%2/2
$base > 104 and $base < 118
$base > 104
$base < 118
Truth table100%3/3
A and B
A= $base > 104B= $base < 118
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 3 | $pad = 63858 - 105; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | ▶ | } elsif ($base > 117 && $base < 135) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$base > 117 and $base < 135
MC/DC100%2/2
$base > 117 and $base < 135
$base > 117
$base < 135
Truth table100%3/3
A and B
A= $base > 117B= $base < 135
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 3 | $pad = 63872 - 118; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | } elsif ($base eq 135) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 1 | $pad = 63920 - 135; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | ▶ | } elsif ($base > 135 && $base < 167) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$base > 135 and $base < 167
MC/DC100%2/2
$base > 135 and $base < 167
$base > 135
$base < 167
Truth table100%3/3
A and B
A= $base > 135B= $base < 167
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 4 | $pad = 63889 - 136; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | ▶ | } elsif ($base > 166 && $base < 170) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$base > 166 and $base < 170
MC/DC100%2/2
$base > 166 and $base < 170
$base > 166
$base < 170
Truth table100%3/3
A and B
A= $base > 166B= $base < 170
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 2 | $pad = 63824 - 167; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | ▶ | } elsif ($base > 169 && $base < 173) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$base > 169 and $base < 173
MC/DC100%2/2
$base > 169 and $base < 173
$base > 169
$base < 173
Truth table100%3/3
A and B
A= $base > 169B= $base < 173
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 2 | $pad = 63829 - 170; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | ▶ | } elsif ($base > 172 && $base < 177) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$base > 172 and $base < 177
MC/DC100%2/2
$base > 172 and $base < 177
$base > 172
$base < 177
Truth table100%3/3
A and B
A= $base > 172B= $base < 177
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 2 | $pad = 63835 - 173; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | } elsif ($base > 176) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 2 | $pad = 63921 - 177; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 31 | return pack('n', $pad + $base); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 4 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||