| 1 | package Toader::Directory; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 4 | ▶ | use base 'Error::Helper'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 4 | ▶ | use Toader::pathHelper; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 4 | ▶ | use Email::MIME; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | =head1 NAME | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | Toader::Directory - This the index file for a Toader directory. | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | =head1 VERSION | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | Version 0.1.0 | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | =cut | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 4 | our $VERSION = '0.1.0'; | |||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | For information on the storage and rendering of entries, | ||||||||||||||||||||||||||||
| 24 | please see 'Documentation/Directory.pod'. | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | =head1 METHODS | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | =head2 new | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | This initializes the object. | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | One argument is required and it is a L<Toader> object. | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | my $foo = Toader::Directory->new($toader); | ||||||||||||||||||||||||||||
| 35 | if ($foo->error){ | ||||||||||||||||||||||||||||
| 36 | warn('Error:'.$foo->error.': '.$foo->errorString); | ||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | =cut | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 0 | ▶ | sub new{ | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 42 | 0 | my $toader=$_[1]; | |||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 0 | my $self={ | |||||||||||||||||||||||||||
| 45 | error=>undef, | ||||||||||||||||||||||||||||
| 46 | errorString=>'', | ||||||||||||||||||||||||||||
| 47 | perror=>undef, | ||||||||||||||||||||||||||||
| 48 | dir=>undef, | ||||||||||||||||||||||||||||
| 49 | errorExtra=>{ | ||||||||||||||||||||||||||||
| 50 | flags=>{ | ||||||||||||||||||||||||||||
| 51 | 1=>'openIndexFailed', | ||||||||||||||||||||||||||||
| 52 | 2=>'noAtoaderDir', | ||||||||||||||||||||||||||||
| 53 | 3=>'noTitleSpecified', | ||||||||||||||||||||||||||||
| 54 | 4=>'noDirSet', | ||||||||||||||||||||||||||||
| 55 | 5=>'noLongerAtoaderDir', | ||||||||||||||||||||||||||||
| 56 | 6=>'indexOpenForWritingFailed', | ||||||||||||||||||||||||||||
| 57 | 7=>'openDirFailed', | ||||||||||||||||||||||||||||
| 58 | 8=>'noSummarySpecified', | ||||||||||||||||||||||||||||
| 59 | 9=>'notAtoaderObj', | ||||||||||||||||||||||||||||
| 60 | 10=>'getVCSerrored', | ||||||||||||||||||||||||||||
| 61 | 11=>'VCSusableErrored', | ||||||||||||||||||||||||||||
| 62 | 12=>'underVCSerrored', | ||||||||||||||||||||||||||||
| 63 | 13=>'VCSaddErrored', | ||||||||||||||||||||||||||||
| 64 | 14=>'noToaderObj', | ||||||||||||||||||||||||||||
| 65 | }, | ||||||||||||||||||||||||||||
| 66 | }, | ||||||||||||||||||||||||||||
| 67 | VCSusable=>0, | ||||||||||||||||||||||||||||
| 68 | }; | ||||||||||||||||||||||||||||
| 69 | 0 | bless $self; | |||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | #if we have a Toader object, reel it in | ||||||||||||||||||||||||||||
| 72 | 0 | ▶ | if ( ! defined( $toader ) ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 73 | 0 | $self->{perror}=1; | |||||||||||||||||||||||||||
| 74 | 0 | $self->{error}=14; | |||||||||||||||||||||||||||
| 75 | 0 | $self->{errorString}='No Toader object specified'; | |||||||||||||||||||||||||||
| 76 | 0 | $self->warn; | |||||||||||||||||||||||||||
| 77 | 0 | return $self; | |||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||
| 80 | 0 | ▶ | if ( ref( $toader ) ne "Toader" ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 81 | 0 | $self->{perror}=1; | |||||||||||||||||||||||||||
| 82 | 0 | $self->{error}=9; | |||||||||||||||||||||||||||
| 83 | 0 | $self->{errorString}='The object specified is a "'.ref($toader).'"'; | |||||||||||||||||||||||||||
| 84 | 0 | $self->warn; | |||||||||||||||||||||||||||
| 85 | 0 | return $self; | |||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||
| 87 | 0 | $self->{toader}=$toader; | |||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | #gets the Toader::VCS object | ||||||||||||||||||||||||||||
| 90 | 0 | $self->{vcs}=$self->{toader}->getVCS; | |||||||||||||||||||||||||||
| 91 | 0 | ▶ | if ( $toader->error ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 92 | 0 | $self->{perror}=1; | |||||||||||||||||||||||||||
| 93 | 0 | $self->{error}=10; | |||||||||||||||||||||||||||
| 94 | $self->{errorString}='Toader->getVCS errored. error="'. | ||||||||||||||||||||||||||||
| 95 | 0 | $self->{toader}->error.'" errorString="'.$self->{toader}->errorString.'"'; | |||||||||||||||||||||||||||
| 96 | 0 | $self->warn; | |||||||||||||||||||||||||||
| 97 | 0 | return $self; | |||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | #checks if VCS is usable | ||||||||||||||||||||||||||||
| 101 | 0 | $self->{VCSusable}=$self->{vcs}->usable; | |||||||||||||||||||||||||||
| 102 | 0 | ▶ | if ( $self->{vcs}->error ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 103 | 0 | $self->{perror}=1; | |||||||||||||||||||||||||||
| 104 | 0 | $self->{error}=11; | |||||||||||||||||||||||||||
| 105 | $self->{errorString}='Toader::VCS->usable errored. error="'. | ||||||||||||||||||||||||||||
| 106 | 0 | $self->{toader}->error.'" errorString="'.$self->{toader}->errorString.'"'; | |||||||||||||||||||||||||||
| 107 | 0 | $self->warn; | |||||||||||||||||||||||||||
| 108 | 0 | return $self; | |||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | 0 | return $self; | |||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | =head2 as_string | ||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | This returns the directory as a string. | ||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | my $mimeString=$foo->as_string; | ||||||||||||||||||||||||||||
| 119 | if($foo->error) | ||||||||||||||||||||||||||||
| 120 | warn('Error:'.$foo->error.': '.$foo->errorString); | ||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | =cut | ||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | 0 | ▶ | sub as_string{ | ||||||||||||||||||||||||||
|
Subroutine
as_string: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 126 | 0 | my $self=$_[0]; | |||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | 0 | ▶ | if (!$self->errorblank){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 129 | 0 | return undef; | |||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | 0 | return $self->{mime}->as_string; | |||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | =head2 bodyGet | ||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | This gets body. | ||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | my $body=$foo->bodyGet; | ||||||||||||||||||||||||||||
| 140 | if($foo->error){ | ||||||||||||||||||||||||||||
| 141 | warn('Error:'.$foo->error.': '.$foo->errorString); | ||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | =cut | ||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | 0 | ▶ | sub bodyGet{ | ||||||||||||||||||||||||||
|
Subroutine
bodyGet: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 147 | 0 | my $self=$_[0]; | |||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | 0 | ▶ | if (!$self->errorblank){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 150 | 0 | return undef; | |||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||
| 153 | 0 | my @parts=$self->{mime}->subparts; | |||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | 0 | my $int=0; | |||||||||||||||||||||||||||
| 156 | 0 | ▶ | while ( defined( $parts[$int] ) ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 157 | 0 | ▶ | if ( ! defined( $parts[$int]->filename ) ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 158 | 0 | return $parts[$int]->body; | |||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | 0 | $int++; | |||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | 0 | return $self->{mime}->body; | |||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | =head2 bodySet | ||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | This sets the body. | ||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||
| 171 | One argument is required and it is the body. | ||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||
| 173 | $foo->bodySet($body); | ||||||||||||||||||||||||||||
| 174 | if($foo->error){ | ||||||||||||||||||||||||||||
| 175 | warn('Error:'.$foo->error.': '.$foo->errorString); | ||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | =cut | ||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||
| 180 | 0 | ▶ | sub bodySet{ | ||||||||||||||||||||||||||
|
Subroutine
bodySet: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||
| 181 | 0 | my $self=$_[0]; | |||||||||||||||||||||||||||
| 182 | 0 | my $body=$_[1]; | |||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | 0 | ▶ | if (!$self->errorblank){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 185 | 0 | return undef; | |||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | 0 | ▶ | if (!defined($body)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 189 | 0 | $self->{error}=8; | |||||||||||||||||||||||||||
| 190 | 0 | $self->{errorString}='No body defined'; | |||||||||||||||||||||||||||
| 191 | 0 | $self->warn; | |||||||||||||||||||||||||||
| 192 | 0 | return undef; | |||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||
| 196 | 0 | my @parts=$self->{mime}->subparts; | |||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||
| 198 | 0 | ▶ | if ( defined( $parts[1] ) ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 199 | 0 | my $int=0; | |||||||||||||||||||||||||||
| 200 | 0 | ▶ | while ( defined( $parts[$int] ) ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 201 | 0 | ▶ | if ( ! defined( $parts[$int]->filename ) ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 202 | 0 | $parts[$int]->body_set($body); | |||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||
| 205 | 0 | $int++; | |||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||
| 208 | 0 | $self->{mime}->parts_set( \@parts ); | |||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||
| 210 | 0 | return 1; | |||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||
| 213 | 0 | $self->{mime}->body_set($body); | |||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||
| 215 | 0 | return 1; | |||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||
| 218 | =head2 dirGet | ||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||
| 220 | This gets L<Toader> directory this entry is associated with. | ||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||
| 222 | This will only error if a permanent error is set. | ||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||
| 224 | my $dir=$foo->dirGet; | ||||||||||||||||||||||||||||
| 225 | if($foo->error){ | ||||||||||||||||||||||||||||
| 226 | warn('Error:'.$foo->error.': '.$foo->errorString); | ||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||
| 229 | =cut | ||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||
| 231 | 0 | ▶ | sub dirGet{ | ||||||||||||||||||||||||||
|
Subroutine
dirGet: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 232 | 0 | my $self=$_[0]; | |||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||
| 234 | 0 | ▶ | if (!$self->errorblank){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 235 | 0 | $self->warn; | |||||||||||||||||||||||||||
| 236 | 0 | return undef; | |||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||
| 239 | 0 | return $self->{dir}; | |||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||
| 242 | =head2 dirSet | ||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||
| 244 | This sets L<Toader> directory this entry is associated with. | ||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||
| 246 | One argument is taken and it is the L<Toader> directory to set it to. | ||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||
| 248 | $foo->dirSet($toaderDirectory); | ||||||||||||||||||||||||||||
| 249 | if($foo->error){ | ||||||||||||||||||||||||||||
| 250 | warn('Error:'.$foo->error.': '.$foo->errorString); | ||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||
| 253 | =cut | ||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||
| 255 | 0 | ▶ | sub dirSet{ | ||||||||||||||||||||||||||
|
Subroutine
dirSet: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||
| 256 | 0 | my $self=$_[0]; | |||||||||||||||||||||||||||
| 257 | 0 | my $dir=$_[1]; | |||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||
| 259 | 0 | ▶ | if (!$self->errorblank){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 260 | 0 | return undef; | |||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||
| 263 | #checks if the directory is Toader directory or not | ||||||||||||||||||||||||||||
| 264 | 0 | my $isatd=Toader::isaToaderDir->new; | |||||||||||||||||||||||||||
| 265 | 0 | my $returned=$isatd->isaToaderDir($dir); | |||||||||||||||||||||||||||
| 266 | 0 | ▶ | if (! $returned ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 267 | 0 | $self->{error}=2; | |||||||||||||||||||||||||||
| 268 | 0 | $self->{errorString}='"'.$dir.'" is not a Toader directory'; | |||||||||||||||||||||||||||
| 269 | 0 | $self->warn; | |||||||||||||||||||||||||||
| 270 | 0 | return undef; | |||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||
| 273 | #clean it up and save it for later | ||||||||||||||||||||||||||||
| 274 | 0 | $self->{pathHelper}=Toader::pathHelper->new( $dir ); | |||||||||||||||||||||||||||
| 275 | 0 | $self->{dir}=$self->{pathHelper}->cleanup( $dir ); | |||||||||||||||||||||||||||
| 276 | 0 | $self->{indexfile}=$dir.'/.toader/index'; | |||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||
| 278 | #cleans up the naming | ||||||||||||||||||||||||||||
| 279 | 0 | my $pathHelper=Toader::pathHelper->new($dir); | |||||||||||||||||||||||||||
| 280 | 0 | $dir=$pathHelper->cleanup($dir); | |||||||||||||||||||||||||||
| 281 | 0 | $self->{indexfile}=$pathHelper->cleanup( $dir ).'/.toader/index'; | |||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||
| 283 | #removes the old mime object | ||||||||||||||||||||||||||||
| 284 | 0 | ▶ | if (defined($self->{mime})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 285 | 0 | delete($self->{mime}); | |||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||
| 288 | 0 | ▶ | if ( ! -f $self->{indexfile}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 289 | 0 | $self->{mime}=Email::MIME->create( | |||||||||||||||||||||||||||
| 290 | header=>[ | ||||||||||||||||||||||||||||
| 291 | renderer=>'html', | ||||||||||||||||||||||||||||
| 292 | summary=>'', | ||||||||||||||||||||||||||||
| 293 | ], | ||||||||||||||||||||||||||||
| 294 | body=>'', | ||||||||||||||||||||||||||||
| 295 | ); | ||||||||||||||||||||||||||||
| 296 | }else { | ||||||||||||||||||||||||||||
| 297 | #read the index file | ||||||||||||||||||||||||||||
| 298 | 0 | my $fh; | |||||||||||||||||||||||||||
| 299 | 0 | ▶ | if ( ! open( $fh, '<', $self->{indexfile} ) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 300 | 0 | $self->{error}=1; | |||||||||||||||||||||||||||
| 301 | 0 | $self->{errorString}="unable to open '".$self->{indexfile}."'"; | |||||||||||||||||||||||||||
| 302 | 0 | $self->warn; | |||||||||||||||||||||||||||
| 303 | 0 | return $self; | |||||||||||||||||||||||||||
| 304 | } | ||||||||||||||||||||||||||||
| 305 | 0 | my $file=join('',<$fh>); | |||||||||||||||||||||||||||
| 306 | 0 | close $fh; | |||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||
| 308 | 0 | $self->{mime}=Email::MIME->new($file); | |||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||
| 310 | } | ||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||
| 312 | 0 | return 1; | |||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||
| 315 | =head2 listSubToaderDirs | ||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||
| 317 | This lists the sub L<Toader> directories in the current L<Toader> directory, ignoring items | ||||||||||||||||||||||||||||
| 318 | starting with a '.'. | ||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||
| 320 | The returned value is a array containing a list of relative directory names. | ||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||
| 322 | This method requires dirSet to have been used previously. | ||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||
| 324 | my @subToaderDirs=$foo->listSubToaderDirs; | ||||||||||||||||||||||||||||
| 325 | if($foo->error){ | ||||||||||||||||||||||||||||
| 326 | warn('error: '.$foo->error.":".$foo->errorString); | ||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||
| 329 | =cut | ||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||
| 331 | 0 | ▶ | sub listSubToaderDirs{ | ||||||||||||||||||||||||||
|
Subroutine
listSubToaderDirs: not called CC=9 SCAR=45.0
Pod
documented
| |||||||||||||||||||||||||||||
| 332 | 0 | my $self=$_[0]; | |||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||
| 334 | 0 | ▶ | if (!$self->errorblank){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 335 | 0 | return undef; | |||||||||||||||||||||||||||
| 336 | } | ||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||
| 338 | 0 | ▶ | if ( ! defined( $self->{dir} ) ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 339 | 0 | $self->{error}=4; | |||||||||||||||||||||||||||
| 340 | 0 | $self->{errorString}='No directory has been specified yet'; | |||||||||||||||||||||||||||
| 341 | 0 | $self->warn; | |||||||||||||||||||||||||||
| 342 | 0 | return undef; | |||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||
| 345 | 0 | my $dh; | |||||||||||||||||||||||||||
| 346 | 0 | ▶ | if ( ! opendir( $dh, $self->{dir} ) ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 347 | 0 | $self->{error}=7; | |||||||||||||||||||||||||||
| 348 | 0 | $self->{errorString}='Failed to open the directory, "'.$self->{dir}.'",'; | |||||||||||||||||||||||||||
| 349 | 0 | $self->warn; | |||||||||||||||||||||||||||
| 350 | 0 | return undef; | |||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||
| 352 | 0 | my @dirEntries=readdir( $dh ); | |||||||||||||||||||||||||||
| 353 | 0 | closedir( $dh ); | |||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||
| 355 | #find the various sub directories | ||||||||||||||||||||||||||||
| 356 | 0 | my $isatd=Toader::isaToaderDir->new; | |||||||||||||||||||||||||||
| 357 | 0 | my @subdirs; | |||||||||||||||||||||||||||
| 358 | 0 | my $int=0; | |||||||||||||||||||||||||||
| 359 | 0 | ▶ | while ( defined( $dirEntries[$int] ) ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 360 | 0 | my $add=1; | |||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||
| 362 | 0 | ▶ | if ( ! -d $self->{dir}.'/'.$dirEntries[$int] ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 363 | 0 | $add=0; | |||||||||||||||||||||||||||
| 364 | } | ||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||
| 366 | 0 | ▶ | if ( $dirEntries[$int] =~ /^\./ ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 367 | 0 | $add=0; | |||||||||||||||||||||||||||
| 368 | } | ||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||
| 370 | 0 | ▶ | if ( $add ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 371 | 0 | my $returned=$isatd->isaToaderDir( $self->{dir}.'/'.$dirEntries[$int] ); | |||||||||||||||||||||||||||
| 372 | 0 | ▶ | if ( $returned ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 373 | 0 | push( @subdirs, $dirEntries[$int] ); | |||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||
| 375 | } | ||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||
| 377 | 0 | $int++; | |||||||||||||||||||||||||||
| 378 | } | ||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||
| 380 | 0 | return @subdirs; | |||||||||||||||||||||||||||
| 381 | } | ||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||
| 383 | =head2 rendererGet | ||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||
| 385 | This returns the renderer type. | ||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||
| 387 | my $renderer=$foo->rendererGet; | ||||||||||||||||||||||||||||
| 388 | if($foo->error){ | ||||||||||||||||||||||||||||
| 389 | warn('error: '.$foo->error.":".$foo->errorString); | ||||||||||||||||||||||||||||
| 390 | } | ||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||
| 392 | =cut | ||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||
| 394 | 0 | ▶ | sub rendererGet{ | ||||||||||||||||||||||||||
|
Subroutine
rendererGet: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 395 | 0 | my $self=$_[0]; | |||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||
| 397 | 0 | ▶ | if (!$self->errorblank){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 398 | 0 | return undef; | |||||||||||||||||||||||||||
| 399 | } | ||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||
| 401 | 0 | return $self->{mime}->header('renderer'); | |||||||||||||||||||||||||||
| 402 | } | ||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||
| 404 | =head2 rendererSet | ||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||
| 406 | This sets the renderer type. | ||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||
| 408 | One argument is taken and it is the render type. | ||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||
| 410 | A value of undef sets it to the default, 'html'. | ||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||
| 412 | my $renderer=$foo->rendererGet; | ||||||||||||||||||||||||||||
| 413 | if($foo->error){ | ||||||||||||||||||||||||||||
| 414 | warn('error: '.$foo->error.":".$foo->errorString); | ||||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||
| 417 | =cut | ||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||
| 419 | 0 | ▶ | sub rendererSet{ | ||||||||||||||||||||||||||
|
Subroutine
rendererSet: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 420 | 0 | my $self=$_[0]; | |||||||||||||||||||||||||||
| 421 | 0 | my $renderer=$_[1]; | |||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||
| 423 | 0 | ▶ | if (!$self->errorblank){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 424 | 0 | return undef; | |||||||||||||||||||||||||||
| 425 | } | ||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||
| 427 | 0 | ▶ | if (!defined( $renderer )) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 428 | 0 | $renderer='html'; | |||||||||||||||||||||||||||
| 429 | } | ||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||
| 431 | 0 | $self->{mime}->header_set('renderer'=>$renderer); | |||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||
| 433 | 0 | return 1; | |||||||||||||||||||||||||||
| 434 | } | ||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||
| 436 | =head2 subpartsAdd | ||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||
| 438 | This adds a new file as a subpart. | ||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||
| 440 | One argument is required and it is the path to the file. | ||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||
| 442 | $foo->subpartsAdd( $file ); | ||||||||||||||||||||||||||||
| 443 | if ( $foo->error ){ | ||||||||||||||||||||||||||||
| 444 | warn('Error:'.$foo->error.': '.$foo->errorString); | ||||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||
| 447 | =cut | ||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||
| 449 | 0 | ▶ | sub subpartsAdd{ | ||||||||||||||||||||||||||
|
Subroutine
subpartsAdd: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||
| 450 | 0 | my $self=$_[0]; | |||||||||||||||||||||||||||
| 451 | 0 | my $file=$_[1]; | |||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||
| 453 | 0 | ▶ | if (!$self->errorblank){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 454 | 0 | return undef; | |||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||
| 457 | #makes sure a file is specified | ||||||||||||||||||||||||||||
| 458 | 0 | ▶ | if ( ! defined( $file ) ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 459 | 0 | $self->{error}=18; | |||||||||||||||||||||||||||
| 460 | 0 | $self->{errorstring}='No file specified'; | |||||||||||||||||||||||||||
| 461 | 0 | $self->warn; | |||||||||||||||||||||||||||
| 462 | 0 | return undef; | |||||||||||||||||||||||||||
| 463 | } | ||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||
| 465 | #makes sure the file exists and is a file | ||||||||||||||||||||||||||||
| 466 | 0 | ▶ | if ( ! -f $file ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 467 | 0 | $self->{error}=4; | |||||||||||||||||||||||||||
| 468 | 0 | $self->{errorString}='The file, "'.$file.'", does not exist or is not a file'; | |||||||||||||||||||||||||||
| 469 | 0 | $self->warn; | |||||||||||||||||||||||||||
| 470 | 0 | return undef; | |||||||||||||||||||||||||||
| 471 | } | ||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||
| 473 | #gets the MIME type | ||||||||||||||||||||||||||||
| 474 | 0 | my $mimetype=mimetype( $file ); | |||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||
| 476 | #makes sure it is a mimetype | ||||||||||||||||||||||||||||
| 477 | 0 | ▶ | if ( !defined( $mimetype ) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 478 | 0 | $self->{error}=5; | |||||||||||||||||||||||||||
| 479 | 0 | $self->{errorString}="'".$file."' could not be read or does not exist"; | |||||||||||||||||||||||||||
| 480 | 0 | $self->warn; | |||||||||||||||||||||||||||
| 481 | 0 | return $self; | |||||||||||||||||||||||||||
| 482 | } | ||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||
| 484 | #create a short name for it... removing the path | ||||||||||||||||||||||||||||
| 485 | 0 | my $filename=$file; | |||||||||||||||||||||||||||
| 486 | 0 | $filename=~s/.*\///g; | |||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||
| 488 | #open and read the file | ||||||||||||||||||||||||||||
| 489 | 0 | my $fh; | |||||||||||||||||||||||||||
| 490 | 0 | ▶ | if ( ! open( $fh, '<', $file ) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 491 | 0 | $self->{error}=6; | |||||||||||||||||||||||||||
| 492 | 0 | $self->{errorString}="Unable to open '".$file."'"; | |||||||||||||||||||||||||||
| 493 | 0 | $self->warn; | |||||||||||||||||||||||||||
| 494 | 0 | return undef; | |||||||||||||||||||||||||||
| 495 | } | ||||||||||||||||||||||||||||
| 496 | 0 | my $body=join('',<$fh>); | |||||||||||||||||||||||||||
| 497 | 0 | close $fh; | |||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||
| 500 | #creates the part | ||||||||||||||||||||||||||||
| 501 | 0 | my $part=Email::MIME->create(attributes=>{ | |||||||||||||||||||||||||||
| 502 | filename=>$filename, | ||||||||||||||||||||||||||||
| 503 | content_type=>$mimetype, | ||||||||||||||||||||||||||||
| 504 | encode=>"base64", | ||||||||||||||||||||||||||||
| 505 | }, | ||||||||||||||||||||||||||||
| 506 | body=>$body, | ||||||||||||||||||||||||||||
| 507 | ); | ||||||||||||||||||||||||||||
| 508 | 0 | my @parts; | |||||||||||||||||||||||||||
| 509 | 0 | push( @parts, $part ); | |||||||||||||||||||||||||||
| 510 | 0 | $self->{mime}->parts_add( \@parts ); | |||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||
| 512 | 0 | return 1; | |||||||||||||||||||||||||||
| 513 | } | ||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||
| 515 | =head2 subpartsExtract | ||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||
| 517 | This extracts the subparts of a entry. | ||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||
| 519 | One argument is extracted, it is the directory | ||||||||||||||||||||||||||||
| 520 | to extract the files to. | ||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||
| 522 | $foo->subpartsExtract( $dir ); | ||||||||||||||||||||||||||||
| 523 | if ( $foo->error ){ | ||||||||||||||||||||||||||||
| 524 | warn('Error:'.$foo->error.': '.$foo->errorString); | ||||||||||||||||||||||||||||
| 525 | } | ||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||
| 527 | =cut | ||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||
| 529 | 0 | ▶ | sub subpartsExtract{ | ||||||||||||||||||||||||||
|
Subroutine
subpartsExtract: not called CC=9 SCAR=45.0
Pod
documented
| |||||||||||||||||||||||||||||
| 530 | 0 | my $self=$_[0]; | |||||||||||||||||||||||||||
| 531 | 0 | my $dir=$_[1]; | |||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||
| 533 | 0 | ▶ | if (!$self->errorblank){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 534 | 0 | return undef; | |||||||||||||||||||||||||||
| 535 | } | ||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||
| 537 | 0 | ▶ | if ( ! defined( $dir ) ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 538 | 0 | $self->{error}=11; | |||||||||||||||||||||||||||
| 539 | 0 | $self->{errorString}='No directory specified'; | |||||||||||||||||||||||||||
| 540 | 0 | $self->warn; | |||||||||||||||||||||||||||
| 541 | 0 | return undef; | |||||||||||||||||||||||||||
| 542 | } | ||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||
| 544 | #make sure it exists and is a directory | ||||||||||||||||||||||||||||
| 545 | 0 | ▶ | if ( ! -d $dir ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 546 | 0 | $self->{error}=17; | |||||||||||||||||||||||||||
| 547 | 0 | $self->{errorString}='"'.$dir.'" is not a directory or does not exist'; | |||||||||||||||||||||||||||
| 548 | 0 | $self->warn; | |||||||||||||||||||||||||||
| 549 | 0 | return undef; | |||||||||||||||||||||||||||
| 550 | } | ||||||||||||||||||||||||||||
| 551 | |||||||||||||||||||||||||||||
| 552 | 0 | my @subparts=$self->subpartsGet; | |||||||||||||||||||||||||||
| 553 | 0 | ▶ | if ( $self->error ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 554 | 0 | $self->warnString('Failed to get the subparts'); | |||||||||||||||||||||||||||
| 555 | 0 | return undef; | |||||||||||||||||||||||||||
| 556 | } | ||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||
| 558 | # no subparts to write to the FS | ||||||||||||||||||||||||||||
| 559 | 0 | ▶ | if ( ! defined( $subparts[0] ) ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 560 | 0 | return 1; | |||||||||||||||||||||||||||
| 561 | } | ||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||
| 563 | 0 | my $int=0; | |||||||||||||||||||||||||||
| 564 | 0 | ▶ | while ( defined( $subparts[$int] ) ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 565 | 0 | my $file=$subparts[$int]->filename; | |||||||||||||||||||||||||||
| 566 | 0 | ▶ | if( defined( $file ) ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 567 | 0 | my $file=$dir.'/'.$file; | |||||||||||||||||||||||||||
| 568 | |||||||||||||||||||||||||||||
| 569 | 0 | my $fh; | |||||||||||||||||||||||||||
| 570 | 0 | ▶ | if ( ! open( $fh, '>', $file ) ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 571 | 0 | $self->{error}=18; | |||||||||||||||||||||||||||
| 572 | 0 | $self->{errorString}='"Failed to open "'.$file. | |||||||||||||||||||||||||||
| 573 | '" for writing the body of a subpart out to'; | ||||||||||||||||||||||||||||
| 574 | 0 | $self->warn; | |||||||||||||||||||||||||||
| 575 | 0 | return undef; | |||||||||||||||||||||||||||
| 576 | } | ||||||||||||||||||||||||||||
| 577 | 0 | print $fh $subparts[$int]->body; | |||||||||||||||||||||||||||
| 578 | 0 | close( $fh ); | |||||||||||||||||||||||||||
| 579 | } | ||||||||||||||||||||||||||||
| 580 | |||||||||||||||||||||||||||||
| 581 | 0 | $int++; | |||||||||||||||||||||||||||
| 582 | } | ||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||
| 584 | 0 | return 1; | |||||||||||||||||||||||||||
| 585 | } | ||||||||||||||||||||||||||||
| 586 | |||||||||||||||||||||||||||||
| 587 | =head2 subpartsGet | ||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||
| 589 | This returns the results from the subparts | ||||||||||||||||||||||||||||
| 590 | methods from the internal L<Email::MIME> object. | ||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||
| 592 | my @parts=$foo->subpartsGet; | ||||||||||||||||||||||||||||
| 593 | if ( $foo->error ){ | ||||||||||||||||||||||||||||
| 594 | warn('Error:'.$foo->error.': '.$foo->errorString); | ||||||||||||||||||||||||||||
| 595 | } | ||||||||||||||||||||||||||||
| 596 | |||||||||||||||||||||||||||||
| 597 | =cut | ||||||||||||||||||||||||||||
| 598 | |||||||||||||||||||||||||||||
| 599 | 0 | ▶ | sub subpartsGet{ | ||||||||||||||||||||||||||
|
Subroutine
subpartsGet: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 600 | 0 | my $self=$_[0]; | |||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||
| 602 | 0 | ▶ | if (!$self->errorblank){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 603 | 0 | return undef; | |||||||||||||||||||||||||||
| 604 | } | ||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||
| 606 | 0 | return $self->{mime}->subparts; | |||||||||||||||||||||||||||
| 607 | } | ||||||||||||||||||||||||||||
| 608 | |||||||||||||||||||||||||||||
| 609 | =head2 subpartsList | ||||||||||||||||||||||||||||
| 610 | |||||||||||||||||||||||||||||
| 611 | This returns a list filenames for the subparts. | ||||||||||||||||||||||||||||
| 612 | |||||||||||||||||||||||||||||
| 613 | my @files=$foo->subpartsList; | ||||||||||||||||||||||||||||
| 614 | if ( $foo->error ){ | ||||||||||||||||||||||||||||
| 615 | warn('Error:'.$foo->error.': '.$foo->errorString); | ||||||||||||||||||||||||||||
| 616 | } | ||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||
| 618 | =cut | ||||||||||||||||||||||||||||
| 619 | |||||||||||||||||||||||||||||
| 620 | 0 | ▶ | sub subpartsList{ | ||||||||||||||||||||||||||
|
Subroutine
subpartsList: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 621 | 0 | my $self=$_[0]; | |||||||||||||||||||||||||||
| 622 | |||||||||||||||||||||||||||||
| 623 | 0 | ▶ | if (!$self->errorblank){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 624 | 0 | return undef; | |||||||||||||||||||||||||||
| 625 | } | ||||||||||||||||||||||||||||
| 626 | |||||||||||||||||||||||||||||
| 627 | 0 | my @subparts=$self->subpartsGet; | |||||||||||||||||||||||||||
| 628 | 0 | ▶ | if ( $self->error ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 629 | 0 | $self->warnString('Failed to get the subparts'); | |||||||||||||||||||||||||||
| 630 | 0 | return undef; | |||||||||||||||||||||||||||
| 631 | } | ||||||||||||||||||||||||||||
| 632 | |||||||||||||||||||||||||||||
| 633 | 0 | my @files; | |||||||||||||||||||||||||||
| 634 | 0 | my $int=0; | |||||||||||||||||||||||||||
| 635 | 0 | ▶ | while( defined( $subparts[$int] ) ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 636 | 0 | ▶ | if ( defined( $subparts[$int]->filename ) ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 637 | 0 | push( @files, $subparts[$int]->filename ); | |||||||||||||||||||||||||||
| 638 | } | ||||||||||||||||||||||||||||
| 639 | |||||||||||||||||||||||||||||
| 640 | 0 | $int++; | |||||||||||||||||||||||||||
| 641 | } | ||||||||||||||||||||||||||||
| 642 | |||||||||||||||||||||||||||||
| 643 | 0 | return @files; | |||||||||||||||||||||||||||
| 644 | } | ||||||||||||||||||||||||||||
| 645 | |||||||||||||||||||||||||||||
| 646 | =head2 subpartsRemove | ||||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||
| 648 | This removes the specified subpart. | ||||||||||||||||||||||||||||
| 649 | |||||||||||||||||||||||||||||
| 650 | One argument is required and it is the name of the | ||||||||||||||||||||||||||||
| 651 | file to remove. | ||||||||||||||||||||||||||||
| 652 | |||||||||||||||||||||||||||||
| 653 | $foo->subpartsRemove( $filename ); | ||||||||||||||||||||||||||||
| 654 | if ( $foo->error ){ | ||||||||||||||||||||||||||||
| 655 | warn('Error:'.$foo->error.': '.$foo->errorString); | ||||||||||||||||||||||||||||
| 656 | } | ||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||
| 658 | =cut | ||||||||||||||||||||||||||||
| 659 | |||||||||||||||||||||||||||||
| 660 | 0 | ▶ | sub subpartsRemove{ | ||||||||||||||||||||||||||
|
Subroutine
subpartsRemove: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||
| 661 | 0 | my $self=$_[0]; | |||||||||||||||||||||||||||
| 662 | 0 | my $file=$_[1]; | |||||||||||||||||||||||||||
| 663 | |||||||||||||||||||||||||||||
| 664 | 0 | ▶ | if (!$self->errorblank){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 665 | 0 | return undef; | |||||||||||||||||||||||||||
| 666 | } | ||||||||||||||||||||||||||||
| 667 | |||||||||||||||||||||||||||||
| 668 | #makes sure a file is specified | ||||||||||||||||||||||||||||
| 669 | 0 | ▶ | if ( ! defined( $file ) ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 670 | 0 | $self->{error}=18; | |||||||||||||||||||||||||||
| 671 | 0 | $self->{errorstring}='No file specified'; | |||||||||||||||||||||||||||
| 672 | 0 | $self->warn; | |||||||||||||||||||||||||||
| 673 | 0 | return undef; | |||||||||||||||||||||||||||
| 674 | } | ||||||||||||||||||||||||||||
| 675 | |||||||||||||||||||||||||||||
| 676 | 0 | my @parts=$self->{mime}->parts; | |||||||||||||||||||||||||||
| 677 | 0 | my @newparts; | |||||||||||||||||||||||||||
| 678 | 0 | my $int=0; | |||||||||||||||||||||||||||
| 679 | 0 | ▶ | while ( defined( $parts[$int] ) ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 680 | 0 | my $partFilename=$parts[$int]->filename; | |||||||||||||||||||||||||||
| 681 | 0 | ▶ | if ( ( ! defined( $partFilename ) ) || | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $partFilename or $file ne $partFilename
MC/DC0%0/2
not defined $partFilename or $file ne $partFilename
not defined $partFilename
$file ne $partFilename
Truth table0%0/3
not(A) or B
A= not defined $partFilenameB= $file ne $partFilename
| |||||||||||||||||||||||||||||
| 682 | ( $file ne $partFilename ) ){ | ||||||||||||||||||||||||||||
| 683 | 0 | push( @newparts, $parts[$int] ); | |||||||||||||||||||||||||||
| 684 | } | ||||||||||||||||||||||||||||
| 685 | |||||||||||||||||||||||||||||
| 686 | 0 | $int++; | |||||||||||||||||||||||||||
| 687 | } | ||||||||||||||||||||||||||||
| 688 | |||||||||||||||||||||||||||||
| 689 | 0 | $self->{mime}->parts_set( \@newparts ); | |||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||
| 691 | 0 | return 1; | |||||||||||||||||||||||||||
| 692 | } | ||||||||||||||||||||||||||||
| 693 | |||||||||||||||||||||||||||||
| 694 | =head2 summaryGet | ||||||||||||||||||||||||||||
| 695 | |||||||||||||||||||||||||||||
| 696 | This returns the summary. | ||||||||||||||||||||||||||||
| 697 | |||||||||||||||||||||||||||||
| 698 | my $summary=$foo->summaryGet; | ||||||||||||||||||||||||||||
| 699 | if($foo->error){ | ||||||||||||||||||||||||||||
| 700 | warn('error: '.$foo->error.":".$foo->errorString); | ||||||||||||||||||||||||||||
| 701 | } | ||||||||||||||||||||||||||||
| 702 | |||||||||||||||||||||||||||||
| 703 | =cut | ||||||||||||||||||||||||||||
| 704 | |||||||||||||||||||||||||||||
| 705 | 0 | ▶ | sub summaryGet{ | ||||||||||||||||||||||||||
|
Subroutine
summaryGet: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 706 | 0 | my $self=$_[0]; | |||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||||
| 708 | 0 | ▶ | if (!$self->errorblank){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 709 | 0 | return undef; | |||||||||||||||||||||||||||
| 710 | } | ||||||||||||||||||||||||||||
| 711 | |||||||||||||||||||||||||||||
| 712 | 0 | my $summary=$self->{mime}->header('summary'); | |||||||||||||||||||||||||||
| 713 | |||||||||||||||||||||||||||||
| 714 | 0 | ▶ | if ( ! defined( $summary ) ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 715 | 0 | $summary=''; | |||||||||||||||||||||||||||
| 716 | } | ||||||||||||||||||||||||||||
| 717 | |||||||||||||||||||||||||||||
| 718 | 0 | return $summary; | |||||||||||||||||||||||||||
| 719 | } | ||||||||||||||||||||||||||||
| 720 | |||||||||||||||||||||||||||||
| 721 | =head2 summarySet | ||||||||||||||||||||||||||||
| 722 | |||||||||||||||||||||||||||||
| 723 | This sets the summary. | ||||||||||||||||||||||||||||
| 724 | |||||||||||||||||||||||||||||
| 725 | One argument is taken and it is the summary. | ||||||||||||||||||||||||||||
| 726 | |||||||||||||||||||||||||||||
| 727 | $foo->summarySet($summary); | ||||||||||||||||||||||||||||
| 728 | if($foo->error){ | ||||||||||||||||||||||||||||
| 729 | warn('error: '.$foo->error.":".$foo->errorString); | ||||||||||||||||||||||||||||
| 730 | } | ||||||||||||||||||||||||||||
| 731 | |||||||||||||||||||||||||||||
| 732 | =cut | ||||||||||||||||||||||||||||
| 733 | |||||||||||||||||||||||||||||
| 734 | 0 | ▶ | sub summarySet{ | ||||||||||||||||||||||||||
|
Subroutine
summarySet: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 735 | 0 | my $self=$_[0]; | |||||||||||||||||||||||||||
| 736 | 0 | my $summary=$_[1]; | |||||||||||||||||||||||||||
| 737 | |||||||||||||||||||||||||||||
| 738 | 0 | ▶ | if (!$self->errorblank){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 739 | 0 | return undef; | |||||||||||||||||||||||||||
| 740 | } | ||||||||||||||||||||||||||||
| 741 | |||||||||||||||||||||||||||||
| 742 | 0 | ▶ | if (!defined( $summary )) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 743 | 0 | $self->{error}=8; | |||||||||||||||||||||||||||
| 744 | 0 | $self->{errorString}='No summary specified'; | |||||||||||||||||||||||||||
| 745 | 0 | $self->warn; | |||||||||||||||||||||||||||
| 746 | 0 | return $self; | |||||||||||||||||||||||||||
| 747 | } | ||||||||||||||||||||||||||||
| 748 | |||||||||||||||||||||||||||||
| 749 | 0 | $self->{mime}->header_set('summary'=>$summary); | |||||||||||||||||||||||||||
| 750 | |||||||||||||||||||||||||||||
| 751 | 0 | return 1; | |||||||||||||||||||||||||||
| 752 | } | ||||||||||||||||||||||||||||
| 753 | |||||||||||||||||||||||||||||
| 754 | =head2 write | ||||||||||||||||||||||||||||
| 755 | |||||||||||||||||||||||||||||
| 756 | This saves the page file. It requires dirSet to | ||||||||||||||||||||||||||||
| 757 | have been called previously. | ||||||||||||||||||||||||||||
| 758 | |||||||||||||||||||||||||||||
| 759 | $foo->write; | ||||||||||||||||||||||||||||
| 760 | if($foo->error){ | ||||||||||||||||||||||||||||
| 761 | warn('error: '.$foo->error.":".$foo->errorString); | ||||||||||||||||||||||||||||
| 762 | } | ||||||||||||||||||||||||||||
| 763 | |||||||||||||||||||||||||||||
| 764 | =cut | ||||||||||||||||||||||||||||
| 765 | |||||||||||||||||||||||||||||
| 766 | 0 | ▶ | sub write{ | ||||||||||||||||||||||||||
|
Subroutine
write: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||
| 767 | 0 | my $self=$_[0]; | |||||||||||||||||||||||||||
| 768 | |||||||||||||||||||||||||||||
| 769 | 0 | ▶ | if (!$self->errorblank){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 770 | 0 | return undef; | |||||||||||||||||||||||||||
| 771 | } | ||||||||||||||||||||||||||||
| 772 | |||||||||||||||||||||||||||||
| 773 | #makes so a directory has been specified | ||||||||||||||||||||||||||||
| 774 | 0 | ▶ | if (!defined( $self->{dir} )) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 775 | 0 | $self->{error}=4; | |||||||||||||||||||||||||||
| 776 | 0 | $self->{errorString}='No directory has been specified yet'; | |||||||||||||||||||||||||||
| 777 | 0 | $self->warn; | |||||||||||||||||||||||||||
| 778 | 0 | return undef; | |||||||||||||||||||||||||||
| 779 | } | ||||||||||||||||||||||||||||
| 780 | |||||||||||||||||||||||||||||
| 781 | #makes sure it is still a toader directory... | ||||||||||||||||||||||||||||
| 782 | 0 | ▶ | if (! -d $self->{dir}.'/.toader/' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 783 | 0 | $self->{error}=5; | |||||||||||||||||||||||||||
| 784 | 0 | $self->{errorString}='No directory has been specified yet'; | |||||||||||||||||||||||||||
| 785 | 0 | return undef; | |||||||||||||||||||||||||||
| 786 | } | ||||||||||||||||||||||||||||
| 787 | |||||||||||||||||||||||||||||
| 788 | #figure out the file will be | ||||||||||||||||||||||||||||
| 789 | 0 | my $file=$self->{dir}.'/.toader/index'; | |||||||||||||||||||||||||||
| 790 | |||||||||||||||||||||||||||||
| 791 | #converts the page to a string | ||||||||||||||||||||||||||||
| 792 | 0 | my $pageString=$self->as_string; | |||||||||||||||||||||||||||
| 793 | |||||||||||||||||||||||||||||
| 794 | #writes the file | ||||||||||||||||||||||||||||
| 795 | 0 | my $fh; | |||||||||||||||||||||||||||
| 796 | 0 | ▶ | if ( ! open($fh, '>', $file) ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 797 | 0 | $self->{error}=6; | |||||||||||||||||||||||||||
| 798 | 0 | $self->{errorString}='Unable to open "'.$file.'" for writing'; | |||||||||||||||||||||||||||
| 799 | 0 | $self->warn; | |||||||||||||||||||||||||||
| 800 | 0 | return undef; | |||||||||||||||||||||||||||
| 801 | } | ||||||||||||||||||||||||||||
| 802 | 0 | print $fh $pageString; | |||||||||||||||||||||||||||
| 803 | 0 | close($fh); | |||||||||||||||||||||||||||
| 804 | |||||||||||||||||||||||||||||
| 805 | #if it is under VCS, we have nothing to do | ||||||||||||||||||||||||||||
| 806 | 0 | my $underVCS=$self->{vcs}->underVCS($file); | |||||||||||||||||||||||||||
| 807 | 0 | ▶ | if ( $self->{vcs}->error ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 808 | 0 | $self->{error}=12; | |||||||||||||||||||||||||||
| 809 | $self->{errorString}='Toader::VCS->underVCS errored. error="'. | ||||||||||||||||||||||||||||
| 810 | 0 | $self->{vcs}->error.'" errorString="'.$self->{vcs}->errorString.'"'; | |||||||||||||||||||||||||||
| 811 | 0 | $self->warn; | |||||||||||||||||||||||||||
| 812 | 0 | return undef; | |||||||||||||||||||||||||||
| 813 | } | ||||||||||||||||||||||||||||
| 814 | 0 | ▶ | if ( $underVCS ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 815 | 0 | return 1; | |||||||||||||||||||||||||||
| 816 | } | ||||||||||||||||||||||||||||
| 817 | |||||||||||||||||||||||||||||
| 818 | #add it as if we reach here it is not under VCS and VCS is being used | ||||||||||||||||||||||||||||
| 819 | 0 | $self->{vcs}->add( $file ); | |||||||||||||||||||||||||||
| 820 | 0 | ▶ | if ( $self->{vcs}->error ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 821 | 0 | $self->{error}=13; | |||||||||||||||||||||||||||
| 822 | $self->{errorString}='Toader::VCS->add errored. error="'. | ||||||||||||||||||||||||||||
| 823 | 0 | $self->{vcs}->error.'" errorString="'.$self->{vcs}->errorString.'"'; | |||||||||||||||||||||||||||
| 824 | 0 | $self->warn; | |||||||||||||||||||||||||||
| 825 | 0 | return undef; | |||||||||||||||||||||||||||
| 826 | } | ||||||||||||||||||||||||||||
| 827 | |||||||||||||||||||||||||||||
| 828 | 0 | return 1; | |||||||||||||||||||||||||||
| 829 | } | ||||||||||||||||||||||||||||
| 830 | |||||||||||||||||||||||||||||
| 831 | =head1 REQUIRED RENDERING METHODS | ||||||||||||||||||||||||||||
| 832 | |||||||||||||||||||||||||||||
| 833 | =head2 filesDir | ||||||||||||||||||||||||||||
| 834 | |||||||||||||||||||||||||||||
| 835 | This returns the file directory for the object. | ||||||||||||||||||||||||||||
| 836 | |||||||||||||||||||||||||||||
| 837 | This is not a full path, but a partial path that should | ||||||||||||||||||||||||||||
| 838 | be appended the directory current directory being outputted to. | ||||||||||||||||||||||||||||
| 839 | |||||||||||||||||||||||||||||
| 840 | =cut | ||||||||||||||||||||||||||||
| 841 | |||||||||||||||||||||||||||||
| 842 | 0 | ▶ | sub filesDir{ | ||||||||||||||||||||||||||
|
Subroutine
filesDir: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 843 | 0 | my $self=$_[0]; | |||||||||||||||||||||||||||
| 844 | |||||||||||||||||||||||||||||
| 845 | 0 | ▶ | if (!$self->errorblank){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 846 | 0 | return undef; | |||||||||||||||||||||||||||
| 847 | } | ||||||||||||||||||||||||||||
| 848 | |||||||||||||||||||||||||||||
| 849 | 0 | return $self->renderDir.'/.files' | |||||||||||||||||||||||||||
| 850 | } | ||||||||||||||||||||||||||||
| 851 | |||||||||||||||||||||||||||||
| 852 | =head2 locationID | ||||||||||||||||||||||||||||
| 853 | |||||||||||||||||||||||||||||
| 854 | This returns the location ID. | ||||||||||||||||||||||||||||
| 855 | |||||||||||||||||||||||||||||
| 856 | This one requires the object to be initialized. | ||||||||||||||||||||||||||||
| 857 | |||||||||||||||||||||||||||||
| 858 | =cut | ||||||||||||||||||||||||||||
| 859 | |||||||||||||||||||||||||||||
| 860 | 0 | ▶ | sub locationID{ | ||||||||||||||||||||||||||
|
Subroutine
locationID: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 861 | 0 | my $self=$_[0]; | |||||||||||||||||||||||||||
| 862 | |||||||||||||||||||||||||||||
| 863 | 0 | ▶ | if (!$self->errorblank){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 864 | 0 | return undef; | |||||||||||||||||||||||||||
| 865 | } | ||||||||||||||||||||||||||||
| 866 | |||||||||||||||||||||||||||||
| 867 | 0 | return 'Index'; | |||||||||||||||||||||||||||
| 868 | } | ||||||||||||||||||||||||||||
| 869 | |||||||||||||||||||||||||||||
| 870 | =head2 renderDir | ||||||||||||||||||||||||||||
| 871 | |||||||||||||||||||||||||||||
| 872 | This is the directory that it will be rendered to. | ||||||||||||||||||||||||||||
| 873 | |||||||||||||||||||||||||||||
| 874 | The base directory that will be used for rendering. | ||||||||||||||||||||||||||||
| 875 | |||||||||||||||||||||||||||||
| 876 | =cut | ||||||||||||||||||||||||||||
| 877 | |||||||||||||||||||||||||||||
| 878 | 0 | ▶ | sub renderDir{ | ||||||||||||||||||||||||||
|
Subroutine
renderDir: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 879 | 0 | return '' | |||||||||||||||||||||||||||
| 880 | } | ||||||||||||||||||||||||||||
| 881 | |||||||||||||||||||||||||||||
| 882 | =head2 renderUsing | ||||||||||||||||||||||||||||
| 883 | |||||||||||||||||||||||||||||
| 884 | This returns the module to use for rendering. | ||||||||||||||||||||||||||||
| 885 | |||||||||||||||||||||||||||||
| 886 | my $module=$foo->renderUsing; | ||||||||||||||||||||||||||||
| 887 | |||||||||||||||||||||||||||||
| 888 | =cut | ||||||||||||||||||||||||||||
| 889 | |||||||||||||||||||||||||||||
| 890 | 0 | ▶ | sub renderUsing{ | ||||||||||||||||||||||||||
|
Subroutine
renderUsing: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 891 | 0 | return 'Toader::Render::Directory'; | |||||||||||||||||||||||||||
| 892 | } | ||||||||||||||||||||||||||||
| 893 | |||||||||||||||||||||||||||||
| 894 | =head2 toaderRenderable | ||||||||||||||||||||||||||||
| 895 | |||||||||||||||||||||||||||||
| 896 | This method returns true and marks it as being Toader | ||||||||||||||||||||||||||||
| 897 | renderable. | ||||||||||||||||||||||||||||
| 898 | |||||||||||||||||||||||||||||
| 899 | =cut | ||||||||||||||||||||||||||||
| 900 | |||||||||||||||||||||||||||||
| 901 | 0 | ▶ | sub toaderRenderable{ | ||||||||||||||||||||||||||
|
Subroutine
toaderRenderable: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 902 | 0 | return 1; | |||||||||||||||||||||||||||
| 903 | } | ||||||||||||||||||||||||||||
| 904 | |||||||||||||||||||||||||||||
| 905 | =head2 toDir | ||||||||||||||||||||||||||||
| 906 | |||||||||||||||||||||||||||||
| 907 | This returns the path to the object. | ||||||||||||||||||||||||||||
| 908 | |||||||||||||||||||||||||||||
| 909 | This is not a full path, but a partial path that should | ||||||||||||||||||||||||||||
| 910 | be appended the directory current directory being outputted to. | ||||||||||||||||||||||||||||
| 911 | |||||||||||||||||||||||||||||
| 912 | =cut | ||||||||||||||||||||||||||||
| 913 | |||||||||||||||||||||||||||||
| 914 | 0 | ▶ | sub toDir{ | ||||||||||||||||||||||||||
|
Subroutine
toDir: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 915 | 0 | my $self=$_[0]; | |||||||||||||||||||||||||||
| 916 | |||||||||||||||||||||||||||||
| 917 | 0 | ▶ | if (!$self->errorblank){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 918 | 0 | return undef; | |||||||||||||||||||||||||||
| 919 | } | ||||||||||||||||||||||||||||
| 920 | |||||||||||||||||||||||||||||
| 921 | 0 | return $self->renderDir; | |||||||||||||||||||||||||||
| 922 | } | ||||||||||||||||||||||||||||
| 923 | |||||||||||||||||||||||||||||
| 924 | =head1 ERROR CODES | ||||||||||||||||||||||||||||
| 925 | |||||||||||||||||||||||||||||
| 926 | =head2 1, openIndexFailed | ||||||||||||||||||||||||||||
| 927 | |||||||||||||||||||||||||||||
| 928 | Unable to open the index file for the specified directory. | ||||||||||||||||||||||||||||
| 929 | |||||||||||||||||||||||||||||
| 930 | =head2 2, notAtoaderDir | ||||||||||||||||||||||||||||
| 931 | |||||||||||||||||||||||||||||
| 932 | The specified directory is not a L<Toader> directory. | ||||||||||||||||||||||||||||
| 933 | |||||||||||||||||||||||||||||
| 934 | =head2 3, noTitleSpecified | ||||||||||||||||||||||||||||
| 935 | |||||||||||||||||||||||||||||
| 936 | No title specified. | ||||||||||||||||||||||||||||
| 937 | |||||||||||||||||||||||||||||
| 938 | =head2 4, noDirSet | ||||||||||||||||||||||||||||
| 939 | |||||||||||||||||||||||||||||
| 940 | No directory has been specified yet. | ||||||||||||||||||||||||||||
| 941 | |||||||||||||||||||||||||||||
| 942 | =head2 5, noLongerAtoaderDir | ||||||||||||||||||||||||||||
| 943 | |||||||||||||||||||||||||||||
| 944 | The directory is no longer a L<Toader> directory. | ||||||||||||||||||||||||||||
| 945 | |||||||||||||||||||||||||||||
| 946 | =head2 6, indexOpenForWritingFailed | ||||||||||||||||||||||||||||
| 947 | |||||||||||||||||||||||||||||
| 948 | Failed to open the file for writing. | ||||||||||||||||||||||||||||
| 949 | |||||||||||||||||||||||||||||
| 950 | =head2 7, openDirFailed | ||||||||||||||||||||||||||||
| 951 | |||||||||||||||||||||||||||||
| 952 | Failed to open the directory. | ||||||||||||||||||||||||||||
| 953 | |||||||||||||||||||||||||||||
| 954 | =head2 8, noSummarySpecified | ||||||||||||||||||||||||||||
| 955 | |||||||||||||||||||||||||||||
| 956 | No summary specified. | ||||||||||||||||||||||||||||
| 957 | |||||||||||||||||||||||||||||
| 958 | =head2 9, notAtoaderObj | ||||||||||||||||||||||||||||
| 959 | |||||||||||||||||||||||||||||
| 960 | The specified objected is not a L<Toader> object. | ||||||||||||||||||||||||||||
| 961 | |||||||||||||||||||||||||||||
| 962 | =head2 10, getVCSerrored | ||||||||||||||||||||||||||||
| 963 | |||||||||||||||||||||||||||||
| 964 | L<Toader>->getVCS errored. | ||||||||||||||||||||||||||||
| 965 | |||||||||||||||||||||||||||||
| 966 | =head2 11, VCSusableErrored | ||||||||||||||||||||||||||||
| 967 | |||||||||||||||||||||||||||||
| 968 | L<Toader::VCS>->usable errored. | ||||||||||||||||||||||||||||
| 969 | |||||||||||||||||||||||||||||
| 970 | =head2 12, underVCSerrored | ||||||||||||||||||||||||||||
| 971 | |||||||||||||||||||||||||||||
| 972 | L<Toader::VCS>->underVCS errored. | ||||||||||||||||||||||||||||
| 973 | |||||||||||||||||||||||||||||
| 974 | =head2 13, VCSaddErrored | ||||||||||||||||||||||||||||
| 975 | |||||||||||||||||||||||||||||
| 976 | L<Toader::VCS>->add errored. | ||||||||||||||||||||||||||||
| 977 | |||||||||||||||||||||||||||||
| 978 | =head2 14, noToaderObj | ||||||||||||||||||||||||||||
| 979 | |||||||||||||||||||||||||||||
| 980 | No L<Toader> object specified. | ||||||||||||||||||||||||||||
| 981 | |||||||||||||||||||||||||||||
| 982 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 983 | |||||||||||||||||||||||||||||
| 984 | Zane C. Bowers-Hadley, C<< <vvelox at vvelox.net> >> | ||||||||||||||||||||||||||||
| 985 | |||||||||||||||||||||||||||||
| 986 | =head1 BUGS | ||||||||||||||||||||||||||||
| 987 | |||||||||||||||||||||||||||||
| 988 | Please report any bugs or feature requests to C<bug-toader at rt.cpan.org>, or through | ||||||||||||||||||||||||||||
| 989 | the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Toader>. I will be notified, and then you'll | ||||||||||||||||||||||||||||
| 990 | automatically be notified of progress on your bug as I make changes. | ||||||||||||||||||||||||||||
| 991 | |||||||||||||||||||||||||||||
| 992 | =head1 SUPPORT | ||||||||||||||||||||||||||||
| 993 | |||||||||||||||||||||||||||||
| 994 | You can find documentation for this module with the perldoc command. | ||||||||||||||||||||||||||||
| 995 | |||||||||||||||||||||||||||||
| 996 | perldoc Toader::Directory | ||||||||||||||||||||||||||||
| 997 | |||||||||||||||||||||||||||||
| 998 | |||||||||||||||||||||||||||||
| 999 | You can also look for information at: | ||||||||||||||||||||||||||||
| 1000 | |||||||||||||||||||||||||||||
| 1001 | =over 4 | ||||||||||||||||||||||||||||
| 1002 | |||||||||||||||||||||||||||||
| 1003 | =item * RT: CPAN's request tracker | ||||||||||||||||||||||||||||
| 1004 | |||||||||||||||||||||||||||||
| 1005 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Toader> | ||||||||||||||||||||||||||||
| 1006 | |||||||||||||||||||||||||||||
| 1007 | =item * AnnoCPAN: Annotated CPAN documentation | ||||||||||||||||||||||||||||
| 1008 | |||||||||||||||||||||||||||||
| 1009 | L<http://annocpan.org/dist/Toader> | ||||||||||||||||||||||||||||
| 1010 | |||||||||||||||||||||||||||||
| 1011 | =item * CPAN Ratings | ||||||||||||||||||||||||||||
| 1012 | |||||||||||||||||||||||||||||
| 1013 | L<http://cpanratings.perl.org/d/Toader> | ||||||||||||||||||||||||||||
| 1014 | |||||||||||||||||||||||||||||
| 1015 | =item * Search CPAN | ||||||||||||||||||||||||||||
| 1016 | |||||||||||||||||||||||||||||
| 1017 | L<http://search.cpan.org/dist/Toader/> | ||||||||||||||||||||||||||||
| 1018 | |||||||||||||||||||||||||||||
| 1019 | =back | ||||||||||||||||||||||||||||
| 1020 | |||||||||||||||||||||||||||||
| 1021 | |||||||||||||||||||||||||||||
| 1022 | =head1 ACKNOWLEDGEMENTS | ||||||||||||||||||||||||||||
| 1023 | |||||||||||||||||||||||||||||
| 1024 | |||||||||||||||||||||||||||||
| 1025 | =head1 LICENSE AND COPYRIGHT | ||||||||||||||||||||||||||||
| 1026 | |||||||||||||||||||||||||||||
| 1027 | Copyright 2013 Zane C. Bowers-Hadley | ||||||||||||||||||||||||||||
| 1028 | |||||||||||||||||||||||||||||
| 1029 | This program is free software; you can redistribute it and/or modify it | ||||||||||||||||||||||||||||
| 1030 | under the terms of either: the GNU General Public License as published | ||||||||||||||||||||||||||||
| 1031 | by the Free Software Foundation; or the Artistic License. | ||||||||||||||||||||||||||||
| 1032 | |||||||||||||||||||||||||||||
| 1033 | See http://dev.perl.org/licenses/ for more information. | ||||||||||||||||||||||||||||
| 1034 | |||||||||||||||||||||||||||||
| 1035 | |||||||||||||||||||||||||||||
| 1036 | =cut | ||||||||||||||||||||||||||||
| 1037 | |||||||||||||||||||||||||||||
| 1038 | 4 | 1; # End of Toader | |||||||||||||||||||||||||||