package Tie::Scalar::Miscellaneous; use Carp; use strict; sub TIESCALAR { my ($class, %functions) = @_; $_ ||= q(croak 'Not implemented') for @functions{qw/store fetch/}; $_ = eval "sub { $_ ( \@_ ) }" for @functions{qw/store fetch/}; bless \%functions, $class; } sub STORE { shift->{store}->(pop) } sub FETCH { shift->{fetch}->(); }