Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

27 lines (21 sloc) 0.391 kb
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
BEGIN {
if (!eval { require 5.018; 1 }) {
plan skip_all => "this test requires 5.18";
}
}
use 5.018;
use Eval::Closure;
my $sub = eval_closure(
source => 'sub { foo() }',
environment => {
'&foo' => sub { state $i++ },
}
);
is($sub->(), 0);
is($sub->(), 1);
is($sub->(), 2);
done_testing;
Jump to Line
Something went wrong with that request. Please try again.