File: 28_alias_const.t

package info (click to toggle)
libdata-alias-perl 1.28-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 368 kB
  • sloc: perl: 1,976; makefile: 3
file content (29 lines) | stat: -rw-r--r-- 364 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/perl -w

use strict;
use warnings qw( FATAL all NONFATAL void );
use lib 'lib';
use Test::More tests => 5;

use Data::Alias;

alias our $foo = "foo";
alias our $bar = $foo;

is \$foo, \$bar;

eval { $foo = 42 };
is $foo, "foo";

my @x;
for (0, 1) {
	alias $x[$_] = $_ + 1;
}

is $x[0], 1;
is $x[1], 2;

eval { $x[1] = 42 };
is $x[1], 2;

# vim: ft=perl