| 1 |
============================================================================== |
| 2 |
Release of version 0.78 of Attribute::Handlers |
| 3 |
============================================================================== |
| 4 |
|
| 5 |
|
| 6 |
NAME |
| 7 |
Attribute::Handlers - Simpler definition of attribute handlers |
| 8 |
|
| 9 |
DESCRIPTION |
| 10 |
This module, when inherited by a package, allows that package's class to |
| 11 |
define attribute handler subroutines for specific attributes. Variables |
| 12 |
and subroutines subsequently defined in that package, or in packages |
| 13 |
derived from that package may be given attributes with the same names as |
| 14 |
the attribute handler subroutines, which will then be called at the end |
| 15 |
of the compilation phase (i.e. in a `CHECK' block). |
| 16 |
|
| 17 |
EXAMPLE |
| 18 |
|
| 19 |
package UNIVERSAL; |
| 20 |
use Attribute::Handlers; |
| 21 |
|
| 22 |
my %name; |
| 23 |
sub name { return $name{$_[2]}||*{$_[1]}{NAME} } |
| 24 |
|
| 25 |
sub Name :ATTR { $name{$_[2]} = $_[4] } |
| 26 |
|
| 27 |
sub Purpose :ATTR { print STDERR "Purpose of ", &name, " is $_[4]\n" } |
| 28 |
|
| 29 |
sub Unit :ATTR { print STDERR &name, " measured in $_[4]\n" } |
| 30 |
|
| 31 |
|
| 32 |
package main; |
| 33 |
|
| 34 |
my $capacity : Name(capacity) |
| 35 |
: Purpose(to store max storage capacity for files) |
| 36 |
: Unit(Gb); |
| 37 |
|
| 38 |
package Other; |
| 39 |
|
| 40 |
sub foo : Purpose(to foo all data before barring it) { } |
| 41 |
|
| 42 |
|
| 43 |
AUTHOR |
| 44 |
Damian Conway (damian@conway.org) |
| 45 |
|
| 46 |
COPYRIGHT |
| 47 |
Copyright (c) 2001-2002, Damian Conway. All Rights Reserved. |
| 48 |
This module is free software. It may be used, redistributed |
| 49 |
and/or modified under the same terms as Perl itself. |
| 50 |
|
| 51 |
|
| 52 |
============================================================================== |
| 53 |
|
| 54 |
0.78 Sat Oct 5 07:18:09 CEST 2002 |
| 55 |
|
| 56 |
- [#17940] Includes :unique and :shared in the builtin types |
| 57 |
|
| 58 |
- From perl 5.8 { __CALLER__::foo => __PACKAGE } is missparsed, |
| 59 |
the proper approach is to use { '__CALLER__::foo' => __PACKAGE }. |
| 60 |
The documentation is updated to reflect this. |
| 61 |
|
| 62 |
============================================================================== |
| 63 |
|
| 64 |
AVAILABILITY |
| 65 |
|
| 66 |
Attribute::Handlers has been uploaded to the CPAN |
| 67 |
and is also available from: |
| 68 |
|
| 69 |
http://www.csse.monash.edu.au/~damian/CPAN/Attribute-Handlers.tar.gz |
| 70 |
|
| 71 |
============================================================================== |