use Carp;
use File::Glob qw(:globally :nocase);
-use Data::Dumper;
-
BEGIN {
use Exporter ();
use vars qw ($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
- $VERSION = 0.13;
+ $VERSION = 0.20;
@ISA = qw (Exporter);
#Give a hoot don't pollute, do not export more than needed by default
@EXPORT = qw ();
}
}
- print STDERR "## using files: ",join(" ",@isis_files),"\n" if ($self->{debug});
+ if ($self->{debug}) {
+ print STDERR "## using files: ",join(" ",@isis_files),"\n";
+ eval "use Data::Dump";
+
+ if (! $@) {
+ *Dumper = *Data::Dump::dump;
+ } else {
+ use Data::Dumper;
+ }
+ }
# if you want to read .FDT file use read_fdt argument when creating class!
if ($self->{read_fdt} && -e $self->{fdt_file}) {
read($self->{'fileMST'}, $buff, 4) || croak "can't read NXTMFN from MST: $!";
$self->{'NXTMFN'}=unpack("V",$buff) || croak "NXTNFN is zero";
- print STDERR Dumper($self),"\n" if ($self->{debug});
+ print STDERR "## self ",Dumper($self),"\n" if ($self->{debug});
# open files for later
open($self->{'fileXRF'}, $self->{xrf_file}) || croak "can't open '$self->{xrf_file}': $!";
}
],
+In case there are repeatable subfields in record, this will create
+following structure:
+
+ '900' => [ {
+ 'a' => [ 'foo', 'bar', 'baz' ],
+ }]
+
This method will also create additional field C<000> with MFN.
=cut
if ($l =~ m/\^/) {
foreach my $t (split(/\^/,$l)) {
next if (! $t);
- $val->{substr($t,0,1)} = substr($t,1);
+ my ($sf,$v) = (substr($t,0,1), substr($t,1));
+ warn "### $k^$sf:$v",$/ if ($self->{debug} > 1);
+ if (ref( $val->{$sf} ) eq 'ARRAY') {
+ push @{ $val->{$sf} }, $v;
+ } elsif (defined( $val->{$sf} )) {
+ # convert scalar field to array
+ $val->{$sf} = [ $val->{$sf}, $v ];
+ } else {
+ $val->{$sf} = $v;
+ }
}
} else {
$val = $l;