NAME

MyCPAN::App::BackPAN::Indexer - The BackPAN indexer application

SYNOPSIS

use MyCPAN::Indexer;

DESCRIPTION

remember_perl

We need to remember the perl that started our program. We want to use the same binary to fire off other processes. WE have to do this very early because we are going to discard most of the environment. After we do that, we can't search the PATH to find the perl binary.

# All of this takes place before we have an object. :(

my $sub = sub {
	my $perl = $self->get_config->perl;

	   if( not defined $perl ) {
		$logger->warn( "I couldn't find a perl! This may cause problems later." );
		}
	elsif( -x $perl ) {
		$logger->debug( "$perl is executable" );
		}
	else {
		$logger->warn( "$perl is not executable. This may cause problems later." );
		}
	};

$self->push_onto_note( 'pre_logging_items', $sub );
default_keys

Return a list of the default keys.

default( KEY )

Return the default value for KEY.

config_class

Return the name of the configuration class to use. The default is ConfigReader::Simple. Any configuration class should respond to the same interface.

init_config

Load the configuration class, create the new object, and set the defaults.

adjust_config

After we setup everything, adjust the config for things that we discovered. Set some defaults.

new
get_coordinator
set_coordinator

Convenience methods to deal with the coordinator

process_options

Handle the configuration directives from the command line and set default values:

-f  config_file     Default is $script.conf
-l  log4perl_file   Default is $script.log4perl
-c                  Print the config and exit
setup_coordinator

Set up the coordinator object and set its initial values.

handle_config

Load and set the configuration file.

You can set the configuration filename with the -f option on the command line.

You can print the configuration and exit with the -c option.

activate_steps

Returns a list of the steps to run in activate.

activate

Start the process.

run_components

Do the work.

activate_end

Do stuff before we quit.

setup_environment

Delete what we don't want and set what we need.

We don't want most of the environment, just the minimal to make things not break. We especially want to cleanse PATH. We keep these:

DISPLAY
USER
HOME
PWD
TERM

Some of the things we need are:

AUTOMATED_TESTING
PERL_MM_USE_DEFAULT
PERL_EXTUTILS_AUTOINSTALL
setup_logging

Initialize Log4perl.

In the configuration, you can set

log4perl_file
log_file_watch_time

You can also use the environment to set the values:

MYCPAN_LOG4PERL_FILE
MYCPAN_LOGLEVEL (defaults to ERROR)

The environment takes precedence.

post_setup_logging_tasks

Logging has to happen after we read the config, but there are some things I'd like to check and log, so I must wait to log. Anyone who wants to log something before logging has been set up should push a sub reference onto the pre_logging_items note.

disable_the_missiles

Catch INT signals and set up error handlers to direct things toward Log4perl. Some of this stuff is a bit dangerous, maybe.

install_int_handler

Catch INT signals so we can log it, clean up, and exit nicely.

install_warn_handler

Make warn go to Log4perl.

components

An array of arrays that list the components to load and the method each component needs to implement. You can override the implementing class through the configuration.

cleanup

Clean up on the way out. We're already done with the run.

setup_dirs

Setup the temporary directories, report directories, and so on, etc.

get_uuid

Generate a unique identifier for this indexer run.

TO DO

Count the lines in the files
Code stats? Lines of code, lines of pod, lines of comments

SOURCE AVAILABILITY

This code is in Github:

git://github.com/briandfoy/mycpan-indexer.git

AUTHOR

brian d foy, <bdfoy@cpan.org>

COPYRIGHT AND LICENSE

Copyright (c) 2008-2013, brian d foy, All Rights Reserved.

You may redistribute this under the same terms as Perl itself.