NAME

Stepford::Role::Step - The basic role all step classes must implement

VERSION

version 0.002009

DESCRIPTION

All of your step classes must consume this role. It provides the basic interface that the Stepford::Planner class expects.

ATTRIBUTES

This role provides one attribute:

logger

This attribute is required for all roles. It will be provided to your step classes by the Stepford::Planner object.

The Step object will wrap the logger with an object that prepends prepends [$log_moniker] to each log message. The moniker is determined by calling $class->_log_moniker() on the class during object construction.

METHODS

This role provides the following methods:

$step->productions()

This method returns a list of Moose::Meta::Attribute objects that were given the StepProduction trait. This can be an empty list.

$step->has_production($name)

Returns true if the step has a production of the given name.

$step->productions_as_hash()

Returns all production values as a hash.

$step->production_value($name)

This method returns the value of the given production for the object it is called on.

$step->dependencies()

This method returns a list of Moose::Meta::Attribute objects that were given the StepDependency trait. This can be an empty list.

REQUIRED METHODS

All classes which consume the Stepford::Role::Step role must implement the following methods:

$step->run()

This method receives no arguments. It is expected to do whatever it is that the step does.

It may also do other things such as record the last run time.

$step->last_run_time()

This method must return a timestamp marking the last time the step was run. You are encouraged to use Time::HiRes as appropriate to provide hi-res timestamps.

You can return undef from this method to request an unconditional rebuild of this step, regardless of the last_run_time() of previous steps.

OPTIONAL METHODS

All classes which consume the Stepford::Role::Step role may implement the following methods:

$class->_log_moniker()

This is expected to return a string identifying the class for the purposes of logging. The default moniker is the full class name, but you may prefer to override this in your step classes with something shorter or more descriptive.

AUTHOR

Dave Rolsky <drolsky@maxmind.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by MaxMind, Inc..

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.