Plan 9 from Bell Labs’s /usr/web/sources/contrib/gabidiaz/root/sys/src/cmd/perl/lib/Attribute/Handlers/demo/Descriptions.pm

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


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;

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].