| 1 | package MyCPAN::App::DPAN; | ||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use base qw(MyCPAN::App::BackPAN::Indexer); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use vars qw($VERSION $logger); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Cwd qw(cwd); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use File::Spec::Functions; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use Log::Log4perl; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 1 | $VERSION = '1.281'; | |||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | =encoding utf8 | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | =head1 NAME | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | MyCPAN::App::DPAN - Create a CPAN-like structure out of some dists | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | use MyCPAN::App::DPAN; | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | my $application = MyCPAN::App::DPAN->activate( @ARGV ); | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | # do some other stuff, anything that you like | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | $application->activate_end; | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | This module ties together all the bits to let the C<dpan> do its work. It | ||||||||||||||||||||||||||||
| 33 | overrides the defaults in C<MyCPAN::App::BackPAN::Indexer> to provide the | ||||||||||||||||||||||||||||
| 34 | right components. | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | The work happens in two steps. When you call C<activate>, the program goes | ||||||||||||||||||||||||||||
| 37 | through all of the steps to examin each of the module distributions. It creates | ||||||||||||||||||||||||||||
| 38 | a report for each distribution, then stops. This pause right after the | ||||||||||||||||||||||||||||
| 39 | examination gives you the chance to do something right before the program | ||||||||||||||||||||||||||||
| 40 | creates the PAUSE index files. The examination might take several minutes | ||||||||||||||||||||||||||||
| 41 | (or even hours depending on how much you want to index), so you have a chance | ||||||||||||||||||||||||||||
| 42 | to check the state of the world before the next step. | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | When you call C<activate_end>, the program takes the results from the | ||||||||||||||||||||||||||||
| 45 | previous step and creates the PAUSE index files in the F<modules> directory. | ||||||||||||||||||||||||||||
| 46 | This step should be very quick since all of the information is ready-to-go. | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | =cut | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | =head1 METHODS | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | =over 4 | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | =cut | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 1 | ▶ | BEGIN { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=11.2
| |||||||||||||||||||||||||||||
| 57 | 1 | ▶ | use vars qw( $Starting_dir ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 58 | 1 | $Starting_dir = cwd(); | |||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 0 | ▶ | $SIG{INT} = sub { print "Caught SIGINT\n"; chdir $Starting_dir; exit() }; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=3.5
| |||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 1 | my $cwd = cwd(); | |||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 1 | my $report_dir = catfile( $cwd, 'indexer_reports' ); | |||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | my %Defaults = ( | ||||||||||||||||||||||||||||
| 67 | author_map => undef, | ||||||||||||||||||||||||||||
| 68 | dpan_dir => $cwd, | ||||||||||||||||||||||||||||
| 69 | collator_class => 'MyCPAN::App::DPAN::Reporter::Minimal', | ||||||||||||||||||||||||||||
| 70 | dispatcher_class => 'MyCPAN::Indexer::Dispatcher::Serial', | ||||||||||||||||||||||||||||
| 71 | extra_reports_dir => undef, | ||||||||||||||||||||||||||||
| 72 | 1 | ▶ | fresh_start => defined $ENV{DPAN_FRESH_START} ? $ENV{DPAN_FRESH_START} : 0, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 73 | i_ignore_errors_at_my_peril => 0, | ||||||||||||||||||||||||||||
| 74 | ignore_missing_dists => 0, | ||||||||||||||||||||||||||||
| 75 | ignore_packages => 'main MY MM DB bytes DynaLoader', | ||||||||||||||||||||||||||||
| 76 | indexer_class => 'MyCPAN::App::DPAN::Indexer', | ||||||||||||||||||||||||||||
| 77 | organize_dists => 1, | ||||||||||||||||||||||||||||
| 78 | parallel_jobs => 1, | ||||||||||||||||||||||||||||
| 79 | pause_id => 'DPAN', | ||||||||||||||||||||||||||||
| 80 | pause_full_name => "DPAN user <CENSORED>", | ||||||||||||||||||||||||||||
| 81 | queue_class => 'MyCPAN::App::DPAN::SkipQueue', | ||||||||||||||||||||||||||||
| 82 | relative_paths_in_report => 1, | ||||||||||||||||||||||||||||
| 83 | reporter_class => 'MyCPAN::App::DPAN::Reporter::Minimal', | ||||||||||||||||||||||||||||
| 84 | skip_perl => 0, | ||||||||||||||||||||||||||||
| 85 | use_real_whois => 0, | ||||||||||||||||||||||||||||
| 86 | ); | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | =item default_keys | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | Returns the list of default configuration directive. | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | =cut | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | sub default_keys | ||||||||||||||||||||||||||||
| 95 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
default_keys: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 96 | 0 | my %Seen; | |||||||||||||||||||||||||||
| 97 | 0 | grep { ! $Seen{$_}++ } keys %Defaults, $_[0]->SUPER::default_keys; | |||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | =item default( DIRECTIVE ) | ||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | Returns the configuration value for DIRECTIVE. | ||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | =cut | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | sub default | ||||||||||||||||||||||||||||
| 107 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
default: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 108 | exists $Defaults{ $_[1] } | ||||||||||||||||||||||||||||
| 109 | ? | ||||||||||||||||||||||||||||
| 110 | 0 | ▶ | $Defaults{ $_[1] } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 111 | : | ||||||||||||||||||||||||||||
| 112 | $_[0]->SUPER::default( $_[1] ); | ||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | =item adjust_config | ||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | Adjusts the configuration to set various internal values. You don't need | ||||||||||||||||||||||||||||
| 118 | to call this yourself. | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | =cut | ||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | sub adjust_config | ||||||||||||||||||||||||||||
| 123 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
adjust_config: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 124 | 0 | my( $application ) = @_; | |||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | 0 | my $coordinator = $application->get_coordinator; | |||||||||||||||||||||||||||
| 127 | 0 | my $config = $coordinator->get_config; | |||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||
| 129 | # the Indexer stuff expects the directory in backpan_dir | ||||||||||||||||||||||||||||
| 130 | 0 | ▶ | if( $config->exists( 'dpan_dir') ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 131 | { | ||||||||||||||||||||||||||||
| 132 | 0 | $config->set( | |||||||||||||||||||||||||||
| 133 | 'backpan_dir', | ||||||||||||||||||||||||||||
| 134 | $config->get( 'dpan_dir' ) | ||||||||||||||||||||||||||||
| 135 | ); | ||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | 0 | $application->SUPER::adjust_config; | |||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | 1 | $logger = Log::Log4perl->get_logger( 'backpan_indexer' ); | |||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | =item activate_steps | ||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | Returns the list of methods to invoke from C<activate>. By overriding this | ||||||||||||||||||||||||||||
| 147 | method you can change the DPAN process. | ||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | =cut | ||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | sub activate_steps | ||||||||||||||||||||||||||||
| 152 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
activate_steps: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 153 | 0 | qw( | |||||||||||||||||||||||||||
| 154 | process_options | ||||||||||||||||||||||||||||
| 155 | setup_coordinator | ||||||||||||||||||||||||||||
| 156 | setup_environment | ||||||||||||||||||||||||||||
| 157 | handle_config | ||||||||||||||||||||||||||||
| 158 | setup_logging | ||||||||||||||||||||||||||||
| 159 | fresh_start | ||||||||||||||||||||||||||||
| 160 | setup_dirs | ||||||||||||||||||||||||||||
| 161 | run_components | ||||||||||||||||||||||||||||
| 162 | ); | ||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||
| 165 | =item activate_end | ||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | Runs right before C<dpan> is about to exit. It calls the postflight | ||||||||||||||||||||||||||||
| 168 | handler if one if configured. It prints a short summary message to | ||||||||||||||||||||||||||||
| 169 | standard output. | ||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||
| 171 | =cut | ||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||
| 173 | sub activate_end | ||||||||||||||||||||||||||||
| 174 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
activate_end: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 175 | 0 | my( $application ) = @_; | |||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||
| 177 | 0 | my $coordinator = $application->get_coordinator; | |||||||||||||||||||||||||||
| 178 | 0 | $application->cleanup; | |||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||
| 180 | 0 | $application->_handle_postflight; | |||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | 0 | ▶ | print <<"HERE" unless( $coordinator->get_note( 'epic_fail' ) || $coordinator->get_note( 'postflight_failure' ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$coordinator->get_note("epic_fail") or $coordinator->get_note("postflight_failure")
MC/DC0%0/2
$coordinator->get_note("epic_fail") or $coordinator->get_note("postflight_failure")
$coordinator->get_note("epic_fail")
$coordinator->get_note("postflight_failure")
Truth table0%0/3
A or B
A= $coordinator->get_note("epic_fail")B= $coordinator->get_note("postflight_failure")
| |||||||||||||||||||||||||||||
| 183 | ================================================= | ||||||||||||||||||||||||||||
| 184 | Ensure you reload your indices in your CPAN tool! | ||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | For CPAN.pm, use: | ||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | cpan> reload index | ||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||
| 190 | For CPANPLUS, use | ||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | CPAN Terminal> x | ||||||||||||||||||||||||||||
| 193 | ================================================= | ||||||||||||||||||||||||||||
| 194 | HERE | ||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||
| 196 | 0 | ▶ | print <<"HERE" if $coordinator->get_note( 'epic_fail' ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 197 | ================================================= | ||||||||||||||||||||||||||||
| 198 | Something really bad happened and I couldn't | ||||||||||||||||||||||||||||
| 199 | finish creating the index files. The DPAN is | ||||||||||||||||||||||||||||
| 200 | incomplete. | ||||||||||||||||||||||||||||
| 201 | ================================================= | ||||||||||||||||||||||||||||
| 202 | HERE | ||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||
| 204 | 0 | ▶ | print <<"HERE" if $coordinator->get_note( 'postflight_failure' ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 205 | ================================================= | ||||||||||||||||||||||||||||
| 206 | I wasn't able to complete the postflight step. | ||||||||||||||||||||||||||||
| 207 | DPAN might be okay, but your post processing | ||||||||||||||||||||||||||||
| 208 | may have failed. | ||||||||||||||||||||||||||||
| 209 | ================================================= | ||||||||||||||||||||||||||||
| 210 | HERE | ||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||
| 212 | 0 | $application->_exit; | |||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||
| 215 | sub _handle_postflight | ||||||||||||||||||||||||||||
| 216 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
_handle_postflight: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||
| 217 | 0 | my( $application ) = @_; | |||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||
| 219 | 0 | $logger->info( "Handling cleanup" ); | |||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||
| 221 | 0 | my $config = $application->get_coordinator->get_config; | |||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||
| 223 | # if it's not in the config then we're done already. | ||||||||||||||||||||||||||||
| 224 | 0 | ▶ | return 1 unless $config->exists( 'postflight_class' ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||
| 226 | 0 | my $class = $config->get( 'postflight_class' ); | |||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | 0 | ▶ | if( $application->_check_postflight_class( $class ) ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 229 | { | ||||||||||||||||||||||||||||
| 230 | 0 | ▶ | eval { $class->run( $application ) } or do { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 231 | 0 | my $at = $@; | |||||||||||||||||||||||||||
| 232 | 0 | $logger->error( "postflight class [$class] complained: $at" ); | |||||||||||||||||||||||||||
| 233 | 0 | $application->get_coordinator->set_note( 'postflight_failure', $at ); | |||||||||||||||||||||||||||
| 234 | 0 | return; | |||||||||||||||||||||||||||
| 235 | }; | ||||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||
| 238 | 0 | return 1; | |||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | sub _check_postflight_class | ||||||||||||||||||||||||||||
| 242 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
_check_postflight_class: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 243 | 0 | my( $application, $class ) = @_; | |||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||
| 245 | 0 | ▶ | if( eval( "require $class; 1" ) ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 246 | { | ||||||||||||||||||||||||||||
| 247 | 0 | ▶ | unless( eval { $class->can('run') } ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 248 | { | ||||||||||||||||||||||||||||
| 249 | 0 | my $error = "Class [$class] does not claim to have a run() method"; | |||||||||||||||||||||||||||
| 250 | 0 | $logger->error( $error ); | |||||||||||||||||||||||||||
| 251 | 0 | $application->get_coordinator->set_note( 'postflight_class_failure', $error ); | |||||||||||||||||||||||||||
| 252 | 0 | return; | |||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||
| 255 | else | ||||||||||||||||||||||||||||
| 256 | { | ||||||||||||||||||||||||||||
| 257 | 0 | my $at = $@; | |||||||||||||||||||||||||||
| 258 | 0 | $logger->error( "Could not load postflight class [$class]: $at" ); | |||||||||||||||||||||||||||
| 259 | 0 | $application->get_coordinator->set_note( 'postflight_class_failure', $at ); | |||||||||||||||||||||||||||
| 260 | 0 | return; | |||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||
| 263 | 0 | return 1; | |||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||
| 266 | =item components | ||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||
| 268 | Returns the list of components to load and the implementing classes. | ||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||
| 270 | =cut | ||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||
| 272 | sub components | ||||||||||||||||||||||||||||
| 273 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
components: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 274 | ( | ||||||||||||||||||||||||||||
| 275 | 0 | [ qw( queue MyCPAN::Indexer::Queue get_queue ) ], | |||||||||||||||||||||||||||
| 276 | [ qw( dispatcher MyCPAN::Indexer::Dispatcher::Serial get_dispatcher ) ], | ||||||||||||||||||||||||||||
| 277 | [ qw( reporter MyCPAN::App::DPAN::Reporter::Minimal get_reporter ) ], | ||||||||||||||||||||||||||||
| 278 | [ qw( worker MyCPAN::Indexer::Worker get_task ) ], | ||||||||||||||||||||||||||||
| 279 | [ qw( collator MyCPAN::App::DPAN::Reporter::Minimal get_collator ) ], | ||||||||||||||||||||||||||||
| 280 | # this has to be last because it kicks off everything | ||||||||||||||||||||||||||||
| 281 | [ qw( interface MyCPAN::Indexer::Interface::Text do_interface ) ], | ||||||||||||||||||||||||||||
| 282 | ) | ||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||
| 285 | =item fresh_start | ||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||
| 287 | If C<fresh_start> is set, this method deletes the reports in the | ||||||||||||||||||||||||||||
| 288 | report directory, leaving the directories in place. | ||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||
| 290 | =cut | ||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||
| 292 | sub fresh_start | ||||||||||||||||||||||||||||
| 293 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
fresh_start: not called CC=3 SCAR=20.3
Pod
documented
| |||||||||||||||||||||||||||||
| 294 | 0 | my( $application ) = @_; | |||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||
| 296 | 0 | my $config = $application->get_coordinator->get_config; | |||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||
| 298 | 0 | ▶ | return unless $config->get( 'fresh_start' ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||
| 300 | 0 | require File::Path; | |||||||||||||||||||||||||||
| 301 | 0 | foreach my $dir ( map { my $m = "${_}_report_subdir"; $config->$m() } qw(error success) ) | |||||||||||||||||||||||||||
| 302 | { | ||||||||||||||||||||||||||||
| 303 | 0 | $logger->info( "Cleaning report directory [$dir]" ); | |||||||||||||||||||||||||||
| 304 | 0 | ▶ | unlink glob( catfile( $dir, '*' ) ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.2
| |||||||||||||||||||||||||||||
| 305 | } | ||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||
| 307 | 0 | return 1; | |||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||
| 310 | 1 | 1; | |||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||
| 312 | =back | ||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||
| 314 | =head1 SOURCE AVAILABILITY | ||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||
| 316 | This code is in Github: | ||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||
| 318 | git://github.com/briandfoy/mycpan-app-dpan.git | ||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||
| 320 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||
| 322 | brian d foy, C<< <bdfoy@cpan.org> >> | ||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||
| 324 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||
| 326 | Copyright © 2008-2018, brian d foy <bdfoy@cpan.org>. All rights reserved. | ||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||
| 328 | You may redistribute this under the terms of the Artistic License 2.0. | ||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||
| 330 | =cut | ||||||||||||||||||||||||||||