Alias-Any

 view release on metacpan or  search on metacpan

t/perl_5.20.t  view on Meta::CPAN

use warnings;
use strict;

use Test::More;
plan tests => 6;

use Alias::Any;

my $original = 1;

alias my $var = $original;

is  $var,  $original => 'Values the same';
is \$var, \$original => 'Alias aliased';

alias my $const = 7;
ok !eval { $const = 2 } => 'An alias to a constant';


no Alias::Any;

{
    no warnings 'redefine';
    sub alias {};
}


alias my $unvar = $original;

is    $unvar,  $original => 'Values still the same';
isnt \$unvar, \$original => 'Alias did not alias';

alias my $inconst = 7;
ok eval { $inconst = 2 } => 'Not an alias to a constant';


done_testing();



( run in 0.244 second using v1.01-cache-2.11-cpan-069f9db706d )