Attribute-TieClasses
view release on metacpan or search on metacpan
"Tie::NetAddr::IP"), I have taken some artistic liberty to create an
attribute name. Some tie classes require the use of the return value
from "tie()" and are as such not directly usable by this mechanism,
AFAIK.
No censoring has been done as far as possible; there are several
attributes that accomplish more or less the same thing. TIMTOWTDI.
If you want any attribute added or renamed or find any mistakes or
omissions, please contact me at <marcel@codewerk.com>.
FUNCTIONS
make_handler
Generates and evaluates the attribute handler code. It takes the name of
the attribute to generate, the type of the variable it applies to -
scalar, array, hash, general variable -, the name of the package that
implements the "tie()", and the filename where that package lives in.
It calls one of the "make_tie_*()" functions that provides part of the
code to generate depending on the tied variable type.
make_tie_array
Returns the code line for the tie of a scalar variable that is needed by
"make_handler()".
make_tie_hash
Returns the code line for the tie of an array variable that is needed by
"make_handler()".
make_tie_scalar
Returns the code line for the tie of a hash variable that is needed by
"make_handler()".
make_tie_var
Is more flexible than the other "make_tie_*()" functions in that it
checks the type of the variable that the attribute is being applied to.
EXAMPLES
# Tie::Scalar::Timeout
my $m : Timeout(NUM_USES => 3, VALUE => 456, POLICY => 777);
print "$m\n" for 1..5;
# Tie::Hash::Rank
my %scores : Ranked;
%scores = (
Adams => 78,
Davies => 35,
Edwards => 84,
Thomas => 47
);
print "$_: $scores{$_}\n" for qw(Adams Davies Edwards Thomas);
# Tie::FlipFlop;
my $ff : FlipFlop(qw/Red Green/);
print "$ff\n" for 1..5;
INSTALLATION
See perlmodinstall for information and options on installing Perl
modules.
BUGS AND LIMITATIONS
No bugs have been reported.
Please report any bugs or feature requests through the web interface at
<http://rt.cpan.org>.
AVAILABILITY
The latest version of this module is available from the Comprehensive
Perl Archive Network (CPAN). Visit <http://www.perl.com/CPAN/> to find a
CPAN site near you, or see
<http://search.cpan.org/dist/Attribute-TieClasses/>.
The development version lives at
<http://github.com/hanekomu/Attribute-TieClasses/>. Instead of sending
patches, please fork this project using the standard git and github
infrastructure.
AUTHOR
Marcel Gruenauer <marcel@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2001 by Marcel Gruenauer.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
( run in 1.371 second using v1.01-cache-2.11-cpan-99c4e6809bf )