Perl error: no link

I recently ported some Perl code from SunSolaris to a 64-bit Linux (Ubuntu) box. After the migration of Storable.pm crashes with the following error:

 Byte order is not compatible at /usr/lib/perl/5.18/Storable.pm, at /home/VD/Cache.pm line 347. 

After some research on the internet, I found that I need to use nfreeze instead of thaw , but now I get the following error:

 not a reference at /home/VD/Cache.pm line 347. 

Any suggestions on how to fix this?

  sub get { my($self, $type, $param_ref) = @_; #return 1 if(!$self->{'INI'}{'sf.system.cache.enabled'}); if($self->{'INI'}{'sf.system.cache.database.enabled'}) { ### DATABASE my $param = $self->SF::Cache::convert_parameter($type, $param_ref); if($self->SF::Cache::CACHE_TABLE_USERCONTENT && $$param{'type'} == 2) { ### user-content my $query = 'SELECT PARAM_CONTENT AS C, DATA AS D FROM sf_cache_usercontent WHERE SITE=? AND PARAM_USER=?'; my $bindvar = { 1=>$self->{'site'}, 2=>$$param{'user'} }; my $sth = $self->db_select($query, $bindvar); #print SF::Util::debug_dumpquery($query, $bindvar); return undef if($self->{'Error'}); my %usercontent; undef(%usercontent); while(my $hashref = $self->db_fetch($sth)) { $usercontent{$$hashref{'C'}} = $$hashref{'D'};# ? 1 : 0; } return \%usercontent; } else ### ****************************************************************************************************** { my $ret = $self->SF::Cache::get_database('DATA', $param); return Storable::nfreeze($ret) if(defined $ret); } } else { ### FILESYSTEM my $filename = $self->SF::Cache::filename($type, $param_ref); if($filename && -e $filename) { if($self->{'INI'}{'sf.system.cache.lock.enabled'} && defined &lock_retrieve) { return lock_retrieve $filename; } else { return retrieve $filename; } } else { $! = 0; } } return undef; } 
+5
source share
2 answers

Return to the original system, thaw , then the nfreeze file to fix it.

 perl -MStorable=nstore,retrieve -e'nstore(retrieve($ARGV[0]), $ARGV[1])' file fixed 
+1
source

So, β€œno link” means ... exactly what it says in tin. Can you try to print a thing using Data::Dumper from the comments on this line:

 return Storable::nfreeze($ret) if(defined $ret) 

So - what does:

 print Dumper $ret; 

produce? This is a link?

I'm not sure that you are right to need nfreeze instead of thaw , because they both do different things. freeze packs a variable; thaw unpacks it. Therefore nfreeze can replace freeze .

But the main purpose of this is to transfer the packaged scalar to another program on a different architecture. Is that what you do?

If so, can I suggest translating it as JSON or XML instead instead?

0
source

All Articles