...A couple of header lines...
FILETYPE=XXXXXX
...The useful information I'm after...
####
package My::Package;
use strict;
use warnings;
...other module stuff...
sub read_slurp {
# "worst-case-scenario" way of splitting up the
# file into its separate lines
foreach ( split /(?:\015{1,2}\012|\015|\012)/, shift ) {
# Skip comments
if ( /^(?:\#|\!|$)/ ) {
next;
}
######################################
# Parse the Filetype info
######################################
if ( /^FILETYPE=(.*)\s*$/ ) {
$self->{'FILETYPE'} = "$1";
next;
}
... LOAD THE APPROPRIATE MODULE ...
... AND CONTINUE PARSING ...
####
######################################
# Parse the blockname
######################################
if ( /^blockname\s+(.*)\s*$/ ) {
$self->{'blockname'} = "$1";
next;
}
######################################
# Parse the list info
######################################
if ( /^list\s+(\d+)\s+(.*)\s*$/ ) {
$self->{'list'}->{"$1"}->{"$3"} = "$2";
next;
}
...ETC ETC ETC...