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