Blame t/make_56_interwork.pl

Packit 14c646
#!/usr/bin/perl -w
Packit 14c646
use strict;
Packit 14c646
Packit 14c646
use Config;
Packit 14c646
use Storable qw(freeze thaw);
Packit 14c646
Packit 14c646
# Lilliput decreed that eggs should be eaten small end first.
Packit 14c646
# Belfuscu welcomed the rebels who wanted to eat big end first.
Packit 14c646
my $kingdom = $Config{byteorder} =~ /23/ ? "Lillput" : "Belfuscu";
Packit 14c646
Packit 14c646
my $frozen = freeze
Packit 14c646
  ["This file was written with $Storable::VERSION on perl $]",
Packit 14c646
   "$kingdom was correct", (~0 ^ (~0 >> 1) ^ 2),
Packit 14c646
   "The End"];
Packit 14c646
Packit 14c646
my $ivsize = $Config{ivsize} || $Config{longsize};
Packit 14c646
Packit 14c646
my $storesize = unpack 'xxC', $frozen;
Packit 14c646
my $storebyteorder = unpack "xxxA$storesize", $frozen;
Packit 14c646
Packit 14c646
if ($Config{byteorder} eq $storebyteorder) {
Packit 14c646
  my $ivtype = $Config{ivtype} || 'long';
Packit 14c646
  print <<"EOM";
Packit 14c646
You only need to run this generator program where Config.pm's byteorder string
Packit 14c646
is not the same length as the size of IVs.
Packit 14c646
Packit 14c646
This length difference should only happen on perl 5.6.x configured with IVs as
Packit 14c646
long long on Unix, OS/2 or any platform that runs the Configure stript (ie not
Packit 14c646
MS Windows)
Packit 14c646
Packit 14c646
This is perl $], sizeof(long) is $Config{longsize}, IVs are '$ivtype', sizeof(IV) is $ivsize,
Packit 14c646
byteorder is '$Config{byteorder}', Storable $Storable::VERSION writes a byteorder of '$storebyteorder'
Packit 14c646
EOM
Packit 14c646
  exit; # Grr '
Packit 14c646
}
Packit 14c646
Packit 14c646
my ($i, $l, $p, $n) = unpack "xxxx${storesize}CCCC", $frozen;
Packit 14c646
Packit 14c646
print <<"EOM";
Packit 14c646
# byteorder	 '$storebyteorder'
Packit 14c646
# sizeof(int)	 $i
Packit 14c646
# sizeof(long)	 $l
Packit 14c646
# sizeof(char *) $p
Packit 14c646
# sizeof(NV)	 $n
Packit 14c646
EOM
Packit 14c646
Packit 14c646
my $uu = pack 'u', $frozen;
Packit 14c646
Packit 14c646
printf "begin %3o $kingdom,$i,$l,$p,$n\n", ord 'A';
Packit 14c646
print $uu;
Packit 14c646
print "\nend\n\n";