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

ПРИВЕТСТВИЕ SALUTE

Доброго всем! Доброго здоровья! Доброго духа!

Hello all! Nice health! Good thinks!

NAME

Loop::Flow::Object - запуск цикла для объекта с контролем и переключением ветвления (fork), выполнение кода в указанных методах объекта.

Loop::Flow::Object - looping code of one object with forking on/off. Simple switch and count of forks.

Executing code, control count and exit from loop by the object methods.

VERSION

Version 0.03

SYNOPSIS

    package Some::My::Module;
    
    sub new {
        my $class = shift;
        ...
    
    }
    sub one {# main code in loop
        my $self = shift;
        my @data = @_;
        ...
    }
    
    sub data {# data for main code in loop
        my $self = shift;
        my $count = shift;
        ...
    }
    
    sub end {# end hook
        my $self = shift;
        ....
    }
    
    package main;
    
    use Loop::Flow::Object;
    use Some::My::Module;
    
    my $obj = Some::My::Module->new(...);
    
    my $loop = Loop::Flow::Object->new(max_count=>..., forks=>..., debug=>...);
    $loop->start($obj, main=>'one', data=>'data', end=>'end',);
    ...

EXPORT

None.

METHODS

new(max_count=>..., forks=>..., debug=>...)

Options:

  • max_count => <integer> (optional)

        infinitely looping if max_count => 0 || undef (default)
  • forks => <integer> (optional)

        Limit of forks
        
        No forking, sequentially if forks => 0 || undef (default)
  • debug => 0|1 (optional)

        0 - no print msg (default)

start($obj, main=>'<main_method>', data=>'<data_method>', end=>'<end_method>',)

Looping/forking for $obj which have methods:

  • main => string '<main_method>' - main code which execute in loop (as child process if forks) (mandatory)

  • data => string '<data_method>' - hook which get/return data for '<main_method>'

    Returning list of data will pass to the main method.

    Attention. If you define this method and it's return empty list - WILL STOPS THE LOOPING, but will wait for childs if any.

  • end => string '<end_method>' - hook which execute when end the '<main_method>' of one loop (child process exit if forks)

AUTHOR

Mikhail Che, <m.che a@t aukama.dyndns.org>

BUGS

Please report any bugs or feature requests to bug-loop-flow at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Loop-Flow. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Loop::Flow::Object

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2012 Mikhail Che.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 224:

You forgot a '=back' before '=head1'