File: close-over-nonref.t

package info (click to toggle)
libeval-closure-perl 0.14-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, sid, stretch
  • size: 196 kB
  • ctags: 12
  • sloc: perl: 559; makefile: 2
file content (20 lines) | stat: -rw-r--r-- 340 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
use Test::Requires { "Devel::LexAlias" => "0.05" };

use Eval::Closure;

my $number  = 40;
my $closure = eval_closure(
    source       => 'sub { $xxx += 2 }',
    environment  => { '$xxx' => \$number },
    alias        => 1,
);

$closure->();

is($number, 42);

done_testing;