| line | stmt | bran | cond | sub | pod | time | code | 
| 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 |  |  |  |  |  |  | our $VERSION = 0.11; | 
| 41 |  |  |  |  |  |  |  | 
| 42 | 1 |  |  | 1 |  | 130 | sub TIESCALAR { $_[1] } | 
| 43 | 0 |  |  | 0 |  |  | sub TIEARRAY  { $_[1] } | 
| 44 | 0 |  |  | 0 |  |  | sub TIEHASH   { $_[1] } | 
| 45 | 0 |  |  | 0 |  |  | sub TIEHANDLE { $_[1] } | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  | 1; | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | __END__ |