| 1 | #!/usr/local/bin/perl | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | Tie::Restore - restores ties to an existing object | ||
| 6 | |||
| 7 | =head1 DESCRIPTION | ||
| 8 | |||
| 9 | Provides the opposite of the 'tied' function. Say you have %hash that | ||
| 10 | is tied to $object. Then, it is relatively simple to get $object from | ||
| 11 | %hash simply by saying | ||
| 12 | |||
| 13 | $object = tied %hash; | ||
| 14 | |||
| 15 | But, how does one go the other way? Simple, with Tie::Restore | ||
| 16 | |||
| 17 | tie %hash, 'Tie::Restore', $object; | ||
| 18 | |||
| 19 | Works for any kind of tie. (scalar, array, hash, filehandle) | ||
| 20 | |||
| 21 | =head1 HISTORY | ||
| 22 | |||
| 23 | =over 2 | ||
| 24 | |||
| 25 | =item * | ||
| 26 | |||
| 27 | 05/22/02 - fixed problem with old .tar.gz - version 0.11 | ||
| 28 | |||
| 29 | =item * | ||
| 30 | |||
| 31 | 11/03/01 - Robby Walker - added documentation - version 0.1 | ||
| 32 | |||
| 33 | =back | ||
| 34 | |||
| 35 | =cut | ||
| 36 | #---------------------------------------------------------- | ||
| 37 | |||
| 38 | package Tie::Restore; | ||
| 39 | |||
| 40 | 1 | our $VERSION = 0.11; | |
| 41 | |||
| 42 | 1 | ▶ | sub TIESCALAR { $_[1] } |
|
Subroutine
TIESCALAR: called CC=1 SCAR=0.0
| |||
| 43 | 0 | ▶ | sub TIEARRAY { $_[1] } |
|
Subroutine
TIEARRAY: not called CC=1 SCAR=6.9
| |||
| 44 | 0 | ▶ | sub TIEHASH { $_[1] } |
|
Subroutine
TIEHASH: not called CC=1 SCAR=6.9
| |||
| 45 | 0 | ▶ | sub TIEHANDLE { $_[1] } |
|
Subroutine
TIEHANDLE: not called CC=1 SCAR=6.9
| |||
| 46 | |||
| 47 | 1 | 1; | |
| 48 | |||
| 49 | __END__ | ||