| 1 | package Test::FIT; | ||
| 2 | $VERSION = '0.11'; | ||
| 3 | @EXPORT = qw(attribute); | ||
| 4 | use strict; | ||
| 5 | use base 'Exporter'; | ||
| 6 | |||
| 7 | sub attribute { | ||
| 8 | my $attribute = shift; | ||
| 9 | my $pkg = caller; | ||
| 10 | no strict 'refs'; | ||
| 11 | *{"${pkg}::$attribute"} = | ||
| 12 | sub { | ||
| 13 | my $self = shift; | ||
| 14 | return $self->{$attribute} unless @_; | ||
| 15 | $self->{$attribute} = shift; | ||
| 16 | return $self; | ||
| 17 | }; | ||
| 18 | } | ||
| 19 | |||
| 20 | 1; | ||
| 21 | |||
| 22 | __END__ |