#!/usr/bin/perl

use strict;
use warnings;

use Carp qw(cluck longmess shortmess croak confess);
use Data::Dumper;

use Ernad::Common;
use Ernad::Erimp;
use Ernad::Learn::Mocla;

my $impna='';
#our $repcode='';
my $issuedate='';
my $file= $ARGV[0];
if(not -f $file) {
  confess "I can't open the file $file";
}
$impna=&Ernad::Common::find_impna_from_file($file)
  or confess "I can't get the impna from the file $file";
our $e=Ernad::Erimp->new({'impna'=> $impna, 'verbose'=>1});  
our $repcode=$e->find_repcode_from_file($file,$impna)
  or confess "I can't get the repcode from the file $file";

$issuedate=&Ernad::Common::find_issuedate_from_file($file);
my $time=&Ernad::Common::find_time_from_file($file)
  or confess "I can't get the time from $file";
my $m=Ernad::Learn::Mocla->new({'impna' => $impna,
                                'repcode'=>$repcode,
                                'time'=> $time,
                                'verbose' => 10});

#$m->type_train_file($file);
$m->type_train_file($repcode);
 
exit;
