summaryrefslogtreecommitdiff
path: root/lib/Attribute/Handlers/demo/Descriptions.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Attribute/Handlers/demo/Descriptions.pm')
-rwxr-xr-xlib/Attribute/Handlers/demo/Descriptions.pm24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/Attribute/Handlers/demo/Descriptions.pm b/lib/Attribute/Handlers/demo/Descriptions.pm
new file mode 100755
index 0000000000..e904dbb7f7
--- /dev/null
+++ b/lib/Attribute/Handlers/demo/Descriptions.pm
@@ -0,0 +1,24 @@
+package Descriptions;
+
+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;