1#!perl -T 2 3use strict; 4use warnings; 5 6use Test::More; 7 8use Variable::Magic qw/cast MGf_LOCAL/; 9 10if (MGf_LOCAL) { 11 plan tests => 2 * 3 + 1 + 1; 12} else { 13 plan skip_all => 'No local magic for this perl'; 14} 15 16use lib 't/lib'; 17use Variable::Magic::TestWatcher; 18 19my $wiz = init_watcher 'local', 'local'; 20 21our $a = int rand 1000; 22 23my $res = watch { cast $a, $wiz } { }, 'cast'; 24ok $res, 'local: cast succeeded'; 25 26watch { local $a } { local => 1 }, 'localized'; 27