NAME

Evo::Train - A train, running engine

VERSION

version 0.005

SYNOPSIS

use Evo::Manager;
my $mngr  = Evo::Manager->new;
my $train = $mngr->build_train;

our $foo = 'Non blocking';

# will print Non blocking
$train->asap(
  sub {
    local $foo = 'Blocking';
    $train->asap(sub { say $foo });
  }
);

DESCRIPTION

This is a subclass of Railway::Train

METHODS

is_current

my $bool = $self->is_current;

Returns true if we are in this train, false otherwise

asap

our $N = 0;

# will print '0' three times
$train->asap(
  sub {
    say $N;

    local $N = 1;
    $train->asap(
      sub {
        say $N;

        local $N = 2;
        $train->asap(sub { say $N});
      }
    );

  }
);

Execute a code in the next tick, if we are in the running train, or run train immidiately and execute this code blocking

This means that a station will be added to the Evo::Way instance and executed immidiately if we are in the 0 cicle loop, or just after others, if we are in the 1 cicle.

So it's impossible to be caged in the recursion with more than 2 invocations depth

AUTHOR

alexbyk.com

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 by alexbyk.

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