Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Object Serialization Basics

by chromatic (Archbishop)
on Apr 19, 2000 at 23:48 UTC ( #8070=perltutorial: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $data = "this is a string of text";
    my @dataset = qw( this is an array of text );
    my %datagroup = ( hash => "mine", text => "yours" );
    
  2. or download this
    use Storable;
    my $stored = freeze [ \$data, \@dataset, \%datagroup ];
    
    ...
    
    my ($newdata, $newdataset_ref, $newdatagroup_ref) = @$thawed;    # cop
    +ies of original variables
    (*data, *dataset, *datagroup) = @$thawed;    # restore into the origin
    +al variables
    
  3. or download this
    use FreezeThaw;
    
    my $stored = freeze (\$data, \@dataset, \%datagroup);
    ...
    my ($newdata, $newdataset_ref, $newdatagroup_ref) = @thawed;
    
    (*data, *dataset, *datagroup) = @thawed;
    
  4. or download this
    my $stored = Data::Dumper->Dump( [ $data, \@dataset, \%datagroup ],
                                     [ qw(data *dataset   *datagroup )] );
    
    print $stored;
    
    eval $stored;
    
  5. or download this
    $hi = bless( {
            'Data' => {},
            'Container' => 'Container',
    ...
            'main' => sub { "DUMMY" },
            'say_hi' => sub { "DUMMY" }
        }, 'Hello::Hi' );
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perltutorial [id://8070]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (12)
As of 2015-07-03 07:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (48 votes), past polls