rkmagfeelingexpert

Posts Tagged ‘cpan GDS2 examples

This is a simple perl script that print the entire block of TEXT data from a GDS file (for this example).
usage: ./thisFile.pl gds2File.gds

—- start of script, Do not include this on your script —
#!/usr/bin/perl
# Author: Rk-magallon,
# Date: Nov. 4 2013
# more GDS2 info can be found at

#”http://search.cpan.org/~schumack/GDS2-3.00/lib/GDS2.pm”

use GDS2;
 my $gds2File = new GDS2(-fileName => $ARGV[0]); # to read
 $\="\n";
 $flag = 0;
 while ($record = $gds2File -> readGds2Record){
    # Marks the start of the block, Change it as preferred. 
    $flag = 1 if ($gds2File -> returnRecordTypeString eq 'TEXT'); 

    print $gds2File -> returnRecordAsString,"\n" if ( $flag == 1);

    # Marks the end of the block, Change it as preferred. 
    $flag = 0 if ($gds2File -> returnRecordTypeString eq 'ENDEL'); 
 }

$gds2File -> close(-markEnd=>1);
#--- End of script. Do not include this on your script ---
Advertisements