Hi
I'm using a java class in my perl script to encode zip files in a certain directory. Currently I'm defining the classes and relevant paths in a config file (Config-Tiny) and executing it using the "system" command. Here is some code to give you an idea:
#!/usr/bin/perl
use strict;
use warnings;
use Config::Tiny;
my $debug = 0;
my $Configfile = "config.conf";
my $outputdir = "C:\\Outputdir";
my $Config = Config::Tiny->new();
$Config = Config::Tiny->read( $Configfile );
my $zipdir = $Config->{Config}->{Zip_Out};
my $somedir = $Config->{Config}->{Somedir_Path};
my $parser = $Config->{Config}->{Parser_Path};
my $xercesimpl = $Config->{Config}->{xercesImpl_Path};
my $encode = $Config->{Config}->{Encode_Command};
my $name = $Config->{Config}->{Name};
my $destination = $Config->{Config}->{Destination};
if (opendir (ZIPDIR, "$zipdir") ) {
foreach my $zippedgif(readdir(ZIPDIR) ) {
next if $zippedgif =~ /^\./;
system("java -cp \"$somedir;$parser;$xercesimpl\" $enco
+de \"$zipdir\\$zippedgif\" \"$outputdir\\$name\" $destination");
if ($debug) { print "DEBUG \nResult: $?\n" };
sleep 3;
}
}
else {
print "Error opening $zipdir: $!\n";
}
closedir (ZIPDIR);
Is there an easier way to accomplish this in Perl rather than using the "system" or "backticks" commands or a config file?
Thanks
2006-04-20 Retitled by g0n, as per Monastery guidelines
Original title: 'Java Question'