Alias-Any
view release on metacpan or search on metacpan
Initial release.
0.000002 Thu Jul 6 13:06:35 2017
No changes logged
0.000003 Thu Jul 6 19:22:14 2017
Corrected errors and omissions in Makefile.PL
0.000004 Sat Jul 8 14:37:12 2017
* Added missing dependency on Keyword::Declare
(Thanks, Father C.)
* Corrected version selection for refaliasing
(Thanks, Father C...for both the report and for refaliasing! :-)
lib/Alias/Any.pm view on Meta::CPAN
alias my $scalar_alias = $scalar_var;
alias my @array_alias = @array_var;
alias my %hash_alias = %hash_var;
no Alias::Any;
alias my $var = $ref; # Syntax error
=head1 DESCRIPTION
This module is simply a convenient wrapper around the various mechanisms
by which aliases can be defined under different versions of Perl.
Under Perl 5.12 to 5.18, the module uses the 'alias' function
from the Data::Alias module to create the requested alias.
lib/Alias/Any.pm view on Meta::CPAN
=head1 DIAGNOSTICS
=over
=item C<< 'alias' keyword requires Data::Alias module under Perl %d >>
Under Perl 5.12 to 5.18, the module uses Data::Alias to implement
its magic. You used the module, but it couldn't load Data::Alias.
=item C<< syntax error at %s, near "alias" >>
You attempted to declare an alias at a point in the code where the
C<alias> keyword was not installed. Did you forget to put a
S<C<use Alias::Any;>> earlier in that lexical scope?
Or did you insert a S<C<no Alias::Any;>> somewhere above the alias?
=back
The module may also produce any diagnostic that Data::Alias or
t/no_alias.t view on Meta::CPAN
is shift, 2 => 'Non-keyword alias sub';
pass '...works as expected'; }
eval {
alias my $y = 2;
ok eval { $y++ } => 'not aliased to constant';
1;
}
or do {
like $@, qr/\AUndefined subroutine &Data::Alias::alias called/
=> 'Right error message';
ok $^V < 5.022 => '...fails as expected';
pass '...so works as expected';
}
}
use Alias::Any;
alias my $q = 42;
is $q, 42 => 'alias works again';
( run in 0.275 second using v1.01-cache-2.11-cpan-65fba6d93b7 )