6 |
use isis_sf; |
use isis_sf; |
7 |
|
|
8 |
sub parse_format { |
sub parse_format { |
9 |
my $format = shift; |
my $format = shift || die "parse_format must be called with format!"; |
10 |
my $row = shift; |
my $row = shift || die "parse_format must be called with row!"; |
11 |
my $i = shift || 0; # isis repeatable number |
my $i = shift || 0; # isis repeatable number |
12 |
my $codepage = shift || die; |
my $codepage = shift || die "parse_format must be called with codepage!"; |
13 |
|
|
14 |
my $out; |
my $out; |
15 |
my $out_swish; |
my $out_swish; |
27 |
if ($format =~ s/^(\d\d\d)(\w?)//) { |
if ($format =~ s/^(\d\d\d)(\w?)//) { |
28 |
my $isis_tmp = isis_sf($row,$1,$2,$i); |
my $isis_tmp = isis_sf($row,$1,$2,$i); |
29 |
if ($isis_tmp) { |
if ($isis_tmp) { |
30 |
$isis_tmp = $codepage->convert($isis_tmp) if ($codepage); |
eval { |
31 |
|
$isis_tmp = $codepage->convert($isis_tmp) if ($codepage); |
32 |
|
}; |
33 |
|
if ($@) { |
34 |
|
print STDERR "FATAL: something bad happend while trying to convert '$isis_tmp' [mfn: ",$row->{mfn},"]\n" |
35 |
|
} |
36 |
$display .= $prefix . $isis_tmp; |
$display .= $prefix . $isis_tmp; |
37 |
$swish .= $isis_tmp." "; |
$swish .= $isis_tmp." "; |
38 |
#print STDERR " == $isis_tmp"; |
#print STDERR " == $isis_tmp"; |
44 |
} elsif ($format =~ s/^(1[01])//) { |
} elsif ($format =~ s/^(1[01])//) { |
45 |
my $isis_tmp = isis_sf($row,$1,undef,$i); |
my $isis_tmp = isis_sf($row,$1,undef,$i); |
46 |
if ($isis_tmp) { |
if ($isis_tmp) { |
47 |
$isis_tmp = $codepage->convert($isis_tmp) if ($codepage); |
eval { |
48 |
|
$isis_tmp = $codepage->convert($isis_tmp) if ($codepage); |
49 |
|
}; |
50 |
|
if ($@) { |
51 |
|
print STDERR "FATAL: something bad happend while trying to convert '$isis_tmp' [mfn: ",$row->{mfn},"]\n" |
52 |
|
} |
53 |
$display .= $prefix . $isis_tmp; |
$display .= $prefix . $isis_tmp; |
54 |
$swish .= $isis_tmp." "; |
$swish .= $isis_tmp." "; |
55 |
} |
} |