Subject: | Byte order for STRANS and PRESENTATION |
Date: | Tue, 22 Jul 2014 15:36:17 +0200 |
To: | bug-GDS2 [...] rt.cpan.org |
From: | Andreas Pawlak <andreas.pawlak [...] tu-dresden.de> |
Hi,
I faced some problem when reading GDS2 files using STRANS and
PRESENTATION structs.
What I get is e.g.
* when using printStructAsString
STRANS 1000000000000000
* when using printStructAsPerl
$gds2File->printGds2Record(-type=>'STRANS',-data=>'0000000010000000');
One can see, that the two bytes are interchanged (with being correct in
the first case). However, when than applying simply an eval() on the
perl-string, the wrong STRANS value will be written into the GDS2 file,
giving no reflection.
The same happens for the PRESENTATION struct:
PRESENTATION 0000000000001000
$gds2File->printGds2Record(-type=>'PRESENTATION',-data=>'0000100000000000');
Also this can easily be fixed during execution, using
s/-data=>'(\d{8})(\d{8})'/-data=>$2$1/ if /-type=>'STRANS'/;
s/-data=>'(\d{8})(\d{8})'/-data=>$2$1/ if /-type=>'PRESENTATION'/;
I wonder if this is desired behavior, since in fact, without my
correction the layout would be wrong.
I'm running perl 5, version 21 under Ubuntu 14.04, 64 bit.
Best regards,
Andreas Pawlak