NAME

TaskPipe::Task - the class which all TaskPipe tasks should inherit from

DESCRIPTION

Inherit from this class when creating new tasks. Your child task should contain an action subroutine, which returns either:

  1. An arrayref of results

  2. A TaskPipe::Iterator of results. (See the TaskPipe::Iterator manpage for more information

You should write your task in the following format:

    package TaskPipe::Task_MyTaskName

    use Moose;
    extends 'TaskPipe::Task';

    
    sub action {
        my ($self) = @_;

        # access plan parameters in here
        # via $self->param

        my $some_val = $self->param->{some_param};

        # ... do something with $some_val ...

        # ...

        return \@results;
    }

    __PACKAGE__->meta->make_immutable;
    1;

Then you reference it in your plan via something like:

    # (in tree format):

    task:
        _name: MyTaskName
        some_param: 46

    pipe_to:

        # ...

Note that if you are creating a task to scrape a website, it is recommended to inherit from TaskPipe::Task_Scrape instead of inheriting from TaskPipe::Task directly. See TaskPipe::Task_Scrape for more information

SEE ALSO

See the other tasks that are provided to make sure you are not creating a task that exists already:

TaskPipe::Task_Scrape TaskPipe::Task_Record TaskPipe::Task_SourceFromDB TaskPipe::Task_SourceFromFile

AUTHOR

Tom Gracey <tomgracey@gmail.com>

COPYRIGHT AND LICENSE

Copyright (c) Tom Gracey 2018

TaskPipe is free software, licensed under

    The GNU Public License Version 3