Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
    0: <code>package Tie::Scalar::Symlink;
    1: # Copyright (C) 2001 Drake Wilson <premchai21 {at} bigfoot.com>
    2: #
    3: # This module is free software; you may redistribute and/or
    4: # modify it under the terms of the GNU General Public License
    5: # as published by the Free Software Foundation, either version
    6: # 2 of the License or (at your option) any later version.
    7: #
    8: # This module is distributed in the hope that it will be useful,
    9: # but WITHOUT ANY WARRANTY, without even the implied warranty
    10: # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
    11: # the GNU General Public License for more details.
    12: #
    13: # You should have received a copy of the GNU General Public License
    14: # along with this module; if not, write to the Free Software
    15: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
    16: # USA.
    17: 
    18: use strict;
    19: use warnings;
    20: use Carp;
    21: use vars qw($VERSION @ISA);
    22: 
    23: $VERSION = 0.01;
    24: @ISA = qw//;
    25: 
    26: sub TIESCALAR
    27: {
    28:     my ($class, $r) = @_;
    29:     (ref($r) eq 'SCALAR')
    30: 	|| croak 'Argument must be an unblessed reference to a scalar';
    31:     return bless \$r, $class;
    32: }
    33: 
    34: sub FETCH { $ {$ {$_[0]}} }
    35: sub STORE { $ {$ {$_[0]}} = $_[1] }
    36: sub DESTROY { undef $ {$_[0]} }
    37: 
    38: =head1 NAME
    39: 
    40: Tie::Scalar::Symlink
    41: 
    42: =head1 SYNOPSIS
    43: 
    44:         $t = 5;
    45:         tie $u, 'Tie::Scalar::Symlink', \$t;
    46:         print $u;  # prints 5 -- $u is linked to $t.
    47:         $u = 6;
    48:         print $t;  # prints 6
    49:         untie $u;
    50:         $t = 7;
    51:         print $u;  # prints 6
    52: 
    53: =head1 DESCRIPTION
    54: 
    55: 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.
    56: 
    57: =head1 SEE ALSO
    58: 
    59: L<perltie>, L<Tie::Scalar>
    60: 
    61: =cut
    62: 
    63: "Tie::Scalar::Symlink v0.01";
    64: 
    65: # It's very simple, but I can imagine it being very useful.
    66: # Feedback?
    67: </code>

In reply to Tie::Scalar::Symlink by premchai21

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (None)
    As of 2024-04-25 00:47 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found