####
package ETTX;
use strict;
use warnings;
use XML::Simple;
local $XML::Simple::PREFERRED_PARSER = 'XML::Parser';
sub new(){#scalar file name
my $class = shift;
my $self =
{
ettxFile => '',
ettx => {},
};
bless $self, $class;
load($self,shift) if @_ ==1;
return $self;
};
sub load(){#scalar file name
my ($self, $ettxFile) = @_;
print "loading $ettxFile";
open(my $fh, '<', $ettxFile);
binmode($fh);
my $xml = XML::Simple->new();
$self->{ettx} =
$xml->XMLin($fh,
ForceArray => ['map'], KeyAttr => {},
)
->{table};
$self->{ettxFile} = $ettxFile;
1;
}
####
my $ettx = ETTX->new();
$ettx->load($ettxFile);