my
$converter
= Convert::MRC->new();
sub
print_self {
print
Dumper
$converter
;
return
@_
;
}
sub
convert {
my
(
$mrc
) =
@_
;
open
my
$mrc_handle
,
'<'
, \
$mrc
;
my
(
$tbx
,
$log
);
open
my
$tbx_handle
,
'>'
, \
$tbx
;
open
my
$log_handle
,
'>'
, \
$log
;
$converter
->input_fh(
$mrc_handle
);
$converter
->tbx_fh(
$tbx_handle
);
$converter
->log_fh(
$log_handle
);
$converter
->convert;
close
$mrc_handle
;
close
$tbx_handle
;
close
$log_handle
;
$log
= remove_datetime(
undef
,
$log
);
return
[
$tbx
,
$log
];
}
sub
no_tbx {
my
(
$tbx_log
) =
@_
;
return
[
undef
,
$tbx_log
->[1] ];
}
sub
remove_datetime {
my
(
$text
) =
@_
;
defined
$text
or
return
;
$text
=~ s/\] \[[^\]]+\]/\]/gm;
return
$text
;
}
sub
fix_version {
my
(
$log
) =
@_
;
chomp
$log
;
$log
=~ s/\[version\]/Convert::MRC->_version/e;
return
$log
;
}
1;