use strict; use warnings; use Test::More tests => 6; BEGIN { use_ok('Lambda') } { local $_; my $f = lambda { $_ }; is($f->('test'), 'test', 'test1'); is($f->('TEST'), 'TEST', 'test2'); is($_, undef, 'restore'); } { my $y = 'test'; ( lambda { $_ = uc($_) } )->($y); is($y, 'TEST', 'alias'); } { package Unfetchable; use Tie::Scalar qw( ); our @ISA = 'Tie::StdScalar'; sub FETCH { } } { local $_; tie $_, 'Unfetchable'; my $f = lambda { $_ }; is($f->('test'), 'test', 'tied'); }