Move Attribute::Handlers from lib to ext. The layout in ext is the same as the
[p5sagit/p5-mst-13.2.git] / ext / Attribute-Handlers / demo / Descriptions.pm
1 package Descriptions;
2 $VERSION = '1.00';
3
4 use Attribute::Handlers;
5
6 my %name;
7
8 sub name {
9         return $name{$_[2]}||*{$_[1]}{NAME};
10 }
11
12 sub UNIVERSAL::Name :ATTR {
13         $name{$_[2]} = $_[4];
14 }
15
16 sub UNIVERSAL::Purpose :ATTR {
17         print STDERR "Purpose of ", &name, " is $_[4]\n";
18 }
19
20 sub UNIVERSAL::Unit :ATTR {
21         print STDERR &name, " measured in $_[4]\n";
22 }
23
24
25 1;