NAME

Evo - Perl Evo design pattern

VERSION

version 0.0153

SYNOPSIS

use Evo::Base -strict;
use Evo ':all';


# next tick
our $state = 'non blocking';

# always nb
asap {
  say $state;
  local $state = 'blocking?';
  asap { say $state };
};


# dsl
# prints 1;2;foo
my @args = (1, 2);
my $print = sub(@args) { local $, = ';'; say @args, dsl_stash 'foo' };

dsl_call({foo => 'foo'}, @args, $print);

require Evo::Manager;
my $mngr = Evo::Manager->new;

# currying
my $debug = sub($evo, $next) {
  sub(@args) {
    say 'Got args: ', join ';', @args;
    $next->(@args);
    }
};

my $safe = sub($evo, $next) {
  sub(@args) {
    local $@;
    eval { $next->(@args) };
    warn "catched: $@" if $@;
    }
};

my $die = sub {die};
my $curry = $mngr->curry_wrappers($debug, $safe);
$curry->(sub { say "going to die"; die })->(1, 2);

my $way = $mngr->build_way;
my $train = $mngr->build_train(way => $way);
$way->curry($curry)->add(sub { say 'step1'; })->add(sub { die "step 2" })
  ->add(sub { say "step 3"; });

$train->start;

DESCRIPTION

Tiny framework for organization non-trivial code into a simple logic.
It includes benefits from functional and OO styles.

Write fast, reusable and testable code.
Familiar with OO? - Use it. Familiar with higher-order functions? - Use it.
Familiar with non-blocking style? - Use it. Want DSL? - Use it.

Do it the right way.

DESCRIPTION

Attention. Don't use it right now. Wait for the stable release

METHODS

mdn_broadcast, mdn_subscribe, mdn_unsubscribe, mdn_unsubscribe_from_all

Calls corresponding Evo::MDN methods passing a singleton as the first argument

asap, dsl_depth, dsl_stash dsl_check_stash dsl_call dsl_depth

Calls corresponding Evo::Manager methods passing a singleton as the first argument

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.