package MIF2MRFVal;

use 5.008008;
use strict;
use warnings;

require Exporter;

our @ISA = qw(Exporter);

# Items to export into callers namespace by default. Note: do not export
# names by default without a very good reason. Use EXPORT_OK instead.
# Do not simply export all your public functions/methods/constants.

# This allows declaration	use MIF2MRFVal ':all';
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
# will save memory.
our %EXPORT_TAGS = ( 'all' => [ qw(
	
) ] );

our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );

our @EXPORT = qw(MIF2MRFVal);
	


our $VERSION = '0.01';

sub MIF2MRFVal {
my $root = "/mt/apps";
my $dir = "/home/m/mccre004/GPMSscripts/MRF2ISOCombo/perlModVer";
my $file ="";
my $TMP= "";
my $err ="";
my $rootout="/mtdata/geo"; 
my $dotLocation ="";
my $ext ="";
my $validate = "";
my $outputdir ="$rootout/gpms/output/mrf";
my $errlogdir ="$rootout/gpms/log";
my $fgdcdir = "$rootout/gpms/output/fgdc";
my $stylesheet ="$root/gpms/FGDC2MRF/MIF2MRF.xsl";
my $Branch ="";
my $dateString = "";
my $newdir=$Branch . $dateString;
my $ISOdir="$rootout/gpms/output/ISO";
my $newerrdir ="$errlogdir/$newdir";



open (SAVEOUT,">&STDOUT");

use lib "/mt/apps/gpms/DateTrans/lib";
use DateTrans qw(monName monNumber timeFormat AmPmFormat dayNumbeFormat);

use lib "/mt/apps/gpms/DateTrans/lib";
use  xsdxsltcheck qw(xsdcheck xsltcheck FGDC2MRFcheck xsl4mrf2fgdccheck);

use lib "/mt/apps/gpms/MifCorrector/lib";
use MifCorrector qw(MifCorrector);
use UpdateMIF qw(UpdateMIF);

use File::Basename;





open (SAVEOUT,">&STDOUT");


#print SAVEOUT "Pre Saxon\n";
my $path = "PATH";
my $ENV{$path} = "/apps/saxon/jdk1.5.0_24/bin::/apps/saxon/saxon9ee.jar::/apps/saxon:$rootout/mrf/$newerrdir:$ENV{'PATH'}";
my $cp = "CLASSPATH";#goodone
my $ENV{$cp} = "/apps/saxon/jdk1.5.0_24/lib/:/apps/saxon/saxon9ee.jar:/apps/saxon/saxon9ee.jar $CLASSPATH:/usr/share/java/saxon.jar";






opendir DIR, "$dir" or die "cannot open $dir $!";

foreach $file (readdir DIR){


#open STDERR,">$err";

$dotLocation = rindex($file,".");
$ext=substr($file,$dotLocation+1);

print SAVEOUT "\$ext = $ext\n";
$TMP = "TMP_" .  $file;
print SAVEOUT "\$TMP = $TMP\n";
$err = "$file.err";

open STDOUT, ">$TMP";
open STDERR, ">$err";
if ($ext =~/xml/){
printf SAVEOUT "$validate: Please Wait, now validating $file\n";
$validate++;
my @csax = "java com.saxonica.Transform -outval:recover  $file  $root/gpms/xsl/MIF2MRF.xsl";
my $final = system(@csax);
print SAVEOUT "\$final = $final(after the new one!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!)\n";
}else{


};
};
};
# Preloaded methods go here.

1;
__END__
# Below is stub documentation for your module. You'd better edit it!

=head1 NAME

MIF2MRFVal - Perl extension for blah blah blah

=head1 SYNOPSIS

  use MIF2MRFVal;
  blah blah blah

=head1 DESCRIPTION

Stub documentation for MIF2MRFVal, created by h2xs. It looks like the
author of the extension was negligent enough to leave the stub
unedited.

Blah blah blah.

=head2 EXPORT

None by default.


=head1 HISTORY

=over 8

=item 0.01

Original version; created by h2xs 1.23 with options

  -ACXn
	MIF2MRFVal

=back



=head1 SEE ALSO

Mention other useful documentation such as the documentation of
related modules or operating system documentation (such as man pages
in UNIX), or any relevant external documentation such as RFCs or
standards.

If you have a mailing list set up for your module, mention it here.

If you have a web site set up for your module, mention it here.

=head1 AUTHOR

mccre004, E<lt>mccre004@localdomainE<gt>

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2014 by mccre004

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.8 or,
at your option, any later version of Perl 5 you may have available.


=cut
