title: Problem storing a hash in DB using Storable::nfreeze in Perl
body: <p>I want to insert a hash in the db using Storable::nfreeze but the data is not inserted properly.</p>
  
  <p>My code is as follows:</p>
  
  <pre><code>%rec=();
  $rec{'name'} = 'my name';
  $rec{'address'} = 'my address';
  
  my $order1 = new Order();
  $order1-&gt;set_session(\%rec);
  $self-&gt;createOrder($order1);
  
  sub createOrder {
  my $self  = $_[0];
  my $order = $_[1];
  
  
  # Retrieve the fields to insert into the database.
  my $st = $dbh-&gt;prepare("insert into order (session,.......) values(?,........)");
  
  my $session   = %{$order-&gt;get_session()};
  $st-&gt;execute(&amp;Storable::nfreeze(\%session),.....);
  $st-&gt;finish();
  
  }
  
  sub getOrder
  {
       ...
  
      my $session = &amp;Storable::thaw( $ref-&gt;{'session'} );
      .....
  }    
  </code></pre>
  
  <p>The <code>thaw</code> is working fine because I tested it withe some rows that have been inserted correctly, but when I try to get a row that was inserted using the <code>createOrder</code> subroutine, I get an error saying:</p>
  
  <blockquote>
    <p>Storable binary image v36.65 more recent than I am (v2.7) at blib/lib/Storable.pm (autosplit into blib/lib/auto/Storable/thaw.al) line 415</p>
  </blockquote>
  
  <p>The error comes from the line that have <code>thaw</code>. The <code>nfreeze</code> did not store the hash properly.</p>
  
  <p>Can someone point me to what I'm doing wrong in the <code>createOrder</code> subroutine?</p>
  
  <p>I know the module version have nothing to do with the problem.</p>