package Tie::Scalar::Symlink; # Copyright (C) 2001 Drake Wilson # # This module is free software; you may redistribute and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation, either version # 2 of the License or (at your option) any later version. # # This module is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, without even the implied warranty # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See # the GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this module; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA. use strict; use warnings; use Carp; use vars qw($VERSION @ISA); $VERSION = 0.01; @ISA = qw//; sub TIESCALAR { my ($class, $r) = @_; (ref($r) eq 'SCALAR') || croak 'Argument must be an unblessed reference to a scalar'; return bless \$r, $class; } sub FETCH { $ {$ {$_[0]}} } sub STORE { $ {$ {$_[0]}} = $_[1] } sub DESTROY { undef $ {$_[0]} } =head1 NAME Tie::Scalar::Symlink =head1 SYNOPSIS $t = 5; tie $u, 'Tie::Scalar::Symlink', \$t; print $u; # prints 5 -- $u is linked to $t. $u = 6; print $t; # prints 6 untie $u; $t = 7; print $u; # prints 6 =head1 DESCRIPTION This module allows you to link a scalar (source) to another (target) using the tie interface, such that accesses to the store are redirected to accesses to the target. See SYNOPSIS. =head1 SEE ALSO L, L =cut "Tie::Scalar::Symlink v0.01"; # It's very simple, but I can imagine it being very useful. # Feedback?