The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

POE::Component::SmokeBox::Backend - smoker backend to POE::Component::SmokeBox

SYNOPSIS

  use strict;
  use warnings;
  use Data::Dumper;
  use POE qw(Component::SmokeBox::Backend);

  my $perl = '/home/cpan/rel/perl-5.8.8/bin/perl';

  POE::Session->create(
    package_states => [
        'main' => [qw(_start _results)],
    ],
  );

  $poe_kernel->run();
  exit 0;

  sub _start {
    my ($kernel,$heap) = @_[KERNEL,HEAP];
    $heap->{backend} = POE::Component::SmokeBox::Backend->smoke(
        event => '_results',
        perl => $perl,
        type => 'CPANPLUS::YACSmoke',
        command => 'smoke',
        module => 'K/KA/KANE/CPANPLUS-0.84.tar.gz',
    );
    return;
  }

  sub _results {
    my ($kernel,$heap,$result) = @_[KERNEL,HEAP,ARG0];
    print Dumper( $result );
    return;
  }

DESCRIPTION

POE::Component::SmokeBox::Backend is the smoker backend to POE::Component::SmokeBox::JobQueue and ultimately POE::Component::SmokeBox.

It takes a processes a single CPAN distribution against a given perl executable using a configurable backend type ( currently, CPAN::YACSmoke, CPANPLUS::YACSmoke or CPAN::Reporter ), monitors the process for idle ( ie. no output ) or excess runtime, and returns the results to the requesting POE::Session.

CONSTRUCTOR

spawn

Creates a new POE::Component::SmokeBox::Backend component. Takes a number of parameters:

  'event', the event to return the results to, mandatory;
  'session', specify an alternative POE session to send the results to;
  'command', the backend command to run: check, index, smoke, default is check;
  'perl', the path to the perl executable to use, default is $^X;
  'type', the type of backend to use, default is CPANPLUS::YACSmoke;
  'idle', change the idle timeout, specified in seconds, default is 600;
  'timeout', change runtime timeout, specified in seconds, default is 3600;
  'module', the module to process, mandatory if 'smoke' command is specified;
  'env', a hashref of %ENV values to set when processing;
  'no_log', enable to not store the job output log, default is false;

You may also pass in arbitary parameters which will passed back to you in the event specified. These arbitary parameters must be prefixed with an underscore.

Returns a POE::Component::SmokeBox::Backend object.

check

As above, but automagically runs a check.

index

As above, but automagically runs an index.

smoke

As above, but automagically runs an smoke.

METHODS

session_id

Returns the component's POE::Session ID.

shutdown

Terminates the component. The current job is killed as a result.

current_log

Returns an arrayref containing lines of output from the current job.

INPUT EVENTS

shutdown

Terminates the component. The current job is killed as a result.

OUTPUT EVENTS

ARG0 of the event specified in one of the constructors will be a hashref with the following keys:

  'log', an arrayref of STDOUT and STDERR produced by the job;
  'PID', the process ID of the POE::Wheel::Run;
  'status', the $? of the process;
  'start_time', the time in epoch seconds when the job started running;
  'end_time', the time in epoch seconds when the job finished;
  'idle_kill', only present if the job was killed because of excessive idle;
  'excess_kill', only present if the job was killed due to excessive runtime;
  'term_kill', only present if the job was killed due to a poco shutdown event;
  'cb_kill', only present if the job was killed due to the callback returning false;

Plus any of the parameters given to one of the constructors, including arbitary ones.

ENVIRONMENT

Setting the environment variable PERL5_SMOKEBOX_DEBUG will cause the component to spew out lots of information on STDERR.

AUTHOR

Chris BinGOs Williams <chris@bingosnet.co.uk>

LICENSE

Copyright (C) Chris Williams

This module may be used, modified, and distributed under the same terms as Perl itself. Please see the license that came with your Perl distribution for details.

SEE ALSO

POE::Component::SmokeBox

POE::Component::SmokeBox::Backend::Base