summaryrefslogtreecommitdiff
path: root/ext/Attribute-Handlers/demo/Descriptions.pm
blob: 023f6f752fe48f21f2f424f9c00f208f5f30a77f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package Descriptions;
$VERSION = '1.00';

use Attribute::Handlers;

my %name;

sub name {
	return $name{$_[2]}||*{$_[1]}{NAME};
}

sub UNIVERSAL::Name :ATTR {
	$name{$_[2]} = $_[4];
}

sub UNIVERSAL::Purpose :ATTR {
	print STDERR "Purpose of ", &name, " is $_[4]\n";
}

sub UNIVERSAL::Unit :ATTR {
	print STDERR &name, " measured in $_[4]\n";
}


1;