develooper Front page | perl.perl5.porters | Postings from October 2007

Re: Storable issue

Thread Previous
From:
Glenn Linderman
Date:
October 27, 2007 20:35
Subject:
Re: Storable issue
Message ID:
4724036A.9030501@NevCal.com
On approximately 10/27/2007 11:36 AM, came the following characters from 
the keyboard of moka@hol.gr:
> I have come across a case where two identical data structrures are  
> stored in two different files using the storable module. The only thing 
> is the filesizes of these  two files is different, maybe by as much as 10%.
> Any ideas why this is so?
> 
> Thanks,
> Spiros Alexiou
> 
>> perl compare.pl destdighash destdighashnew
> structures of destdighash and destdighashnew are identical.
> Died at compare.pl line 12.
> me@linuxblushingSECUR/KPI> ls -l destdig*
> -rw-r--r--  1 me users 8872 2007-10-20 02:00 destdighash
> -rw-r--r--  1 me users 7938 2007-10-25 21:25 destdighashnew
> 
> here is the script:
> use strict;
> use Storable;
>  use Data::Compare;
> 
> require('dumpvar.pl');
> my $file1=shift; my $file2=shift;#e.g. destdighash, destdighashnew
> if(-e "$file1"){  $main::rdestdighash=retrieve("$file1");}else{die 
> "could not find $file1 to get hashref1 from\n";}
> if(-e "$file2"){  $main::rdestdighashnew=retrieve("$file2");}else{die 
> "could not find $file2 to get hashref2 from\n";}
> 
> print "structures of $file1 and $file2 are ",
>       Compare($main::rdestdighash, $main::rdestdighashnew) ? "" : "not 
> ", "identical.\n";
> die;
> 
> My only guess as to the size difference is that the original one was 
> created on an older(though also linux) system.
>  STill , I cannot figure out why this could happen

I see more white space in the second file.  I see more non-ASCII 
characters in the second file.

I speculate that the systems differ in either or both of: integer size 
(32-bit vs 64-bit), locale (ASCII vs Unicode).  I can't tell from here, 
though.  Some information about the character of the systems may help 
someone help you figure it out.

-- 
Glenn -- http://nevcal.com/
===========================
A protocol is complete when there is nothing left to remove.
-- Stuart Cheshire, Apple Computer, regarding Zero Configuration Networking

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About