6 use Variable::Temp 'temp';
12 plan skip_all => 'perl 5.14 required to use lvalue temp()';
14 plan tests => (9 + 2 * 19) * 2 + 6 * 3;
20 return join ', ', map "$_:$h->{$_}", sort keys %$h;
62 temp @y = [ 8, 9, 10 ];
69 temp @y = [ 12, 13, 14 ];
81 temp @y = [ qw<a b c> ];
87 local @y[2, 3] = qw<e f>;
99 is describe(\%z), 'a:1';
101 temp %z = { b => 2 };
102 is describe(\%z), 'b:2';
104 is describe(\%z), 'c:3';
106 is describe(\%z), 'c:3, d:4';
108 is describe(\%z), 'a:1';
110 temp %z = { a => 5 };
111 is describe(\%z), 'a:5';
113 is describe(\%z), 'a:6';
115 is describe(\%z), 'a:1';
117 temp %z = { a => 7, d => 8 };
118 is describe(\%z), 'a:7, d:8';
119 temp %z = { d => 9, e => 10 };
120 is describe(\%z), 'd:9, e:10';
122 is describe(\%z), 'a:1';
125 is describe(\%z), '';
127 is describe(\%z), 'a:1';
129 temp %z = { a => 11, f => 12 };
130 is describe(\%z), 'a:11, f:12';
133 is describe(\%z), 'a:13, f:12';
135 local @z{qw<f g>} = (14, 15);
136 is describe(\%z), 'a:13, f:14, g:15';
138 is describe(\%z), 'a:13, f:12';
140 is describe(\%z), 'a:11, f:12';
142 is describe(\%z), 'a:1';
201 temp @Y = [ 8, 9, 10 ];
208 temp @Y = [ 12, 13, 14 ];
220 temp @Y = [ qw<a b c> ];
226 local @Y[2, 3] = qw<e f>;
240 local @Y = qw<C D E>;
246 temp @Y = [ qw<G H I> ];
255 is describe(\%Z), 'a:1';
257 temp %Z = { b => 2 };
258 is describe(\%Z), 'b:2';
260 is describe(\%Z), 'c:3';
262 is describe(\%Z), 'c:3, d:4';
264 is describe(\%Z), 'a:1';
266 temp %Z = { a => 5 };
267 is describe(\%Z), 'a:5';
269 is describe(\%Z), 'a:6';
271 is describe(\%Z), 'a:1';
273 temp %Z = { a => 7, d => 8 };
274 is describe(\%Z), 'a:7, d:8';
275 temp %Z = { d => 9, e => 10 };
276 is describe(\%Z), 'd:9, e:10';
278 is describe(\%Z), 'a:1';
281 is describe(\%Z), '';
283 is describe(\%Z), 'a:1';
285 temp %Z = { a => 11, f => 12 };
286 is describe(\%Z), 'a:11, f:12';
289 is describe(\%Z), 'a:13, f:12';
291 local @Z{qw<f g>} = (14, 15);
292 is describe(\%Z), 'a:13, f:14, g:15';
294 is describe(\%Z), 'a:13, f:12';
296 is describe(\%Z), 'a:11, f:12';
298 is describe(\%Z), 'a:1';
300 local %Z = (A => 1, B => 2);
301 is describe(\%Z), 'A:1, B:2';
303 is describe(\%Z), 'a:1';
305 local %Z = (A => 3, C => 4);
306 temp %Z = { A => 5, D => 6 };
307 is describe(\%Z), 'A:5, D:6';
309 is describe(\%Z), 'a:1';
311 temp %Z = { A => 7, E => 8 };
312 local %Z = (A => 9, F => 10);
313 is describe(\%Z), 'A:9, F:10';
315 is describe(\%Z), 'a:1';