NAME
Attribute::Alias - An Alias attribute
SYNOPSIS
use Attribute::Alias;
sub color : Alias(colour) { return 'red' }
DESCRIPTION
If you need a variable or subroutine to be known by another name, use this attribute. Internally, the attribute's handler assigns typeglobs to each other. As such, the Alias
attribute provides a layer of abstraction. If the underlying mechanism changes in a future version of Perl (say, one that might not have the concept of typeglobs anymore :), a new version of this module will take care of that, but your Alias
declarations are going to stay the same.
Note that assigning typeglobs means that you can't specify a synonym for one element of the glob and use the same synonym for a different target name in a different slot. I.e.,
sub color :Alias(colour) { ... }
my $farbe :Alias(colour);
doesn't make sense, since the sub declaration aliases the whole colour
glob to color
, but then the scalar declaration aliases the whole colour
glob to farbe
, so the first alias is lost.
BUGS
None known so far. If you find any bugs or oddities, please do inform the author.
AUTHOR
Marcel Grunauer, <marcel@codewerk.com>
Dan Kogai, <dankogai+cpan at gmail.com>
COPYRIGHT
Copyright 2001 Marcel Grunauer. All rights reserved.
Copyright 2006 Dan Kogai. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
perl(1), Attribute::Handlers