123456789101112131415161718192021222324252627 |
- package NIC::Tie::Method;
- use parent qw(Tie::Scalar);
- sub TIESCALAR {
- my $class = shift;
- my $for = shift;
- my $method = shift;
- my $self = { FOR => $for, METHOD => $method };
- bless($self, $class);
- return $self;
- }
- sub FETCH {
- my $self = shift;
- my $obj = $self->{FOR};
- { unshift @_, $obj; goto &{$self->{FOR}->can($self->{METHOD})}; }
- }
- sub STORE {
- my $self = shift;
- my $obj = $self->{FOR};
- { unshift @_, $obj; goto &{$self->{FOR}->can($self->{METHOD})}; }
- }
- 1;
|