#!/usr/bin/perl use v5.8.2; # Use the version which is on the AIX machines use strict; use bigint; use File::Basename; use lib File::Basename::dirname($0); # find .pm files in script's dir use FunctionsAPI; #<--- line 7. These are my modules... use DataObject; #<--- line 8 use OutputWriter; #<--- line 9 #main { my $argc = @ARGV; if($argc < 1){ die( drawError("Insufficient Parameters", "One or two parameters are needed.")); } my $inputfilename = $ARGV[0]; open(my $AVPFILE, $inputfilename) or die( drawError("Unable to open file $ARGV[0]", "Unfortunatelly, the file: $ARGV[0] is not readable.")); my $shortfilename; if($inputfilename =~ m/^(.*)\.avp$/) { $shortfilename = $1; } else { $shortfilename = $inputfilename; } my $data = new DataObject(); print "Proceeding ".$inputfilename." -->\n"; for(my $loop=0; !eof($AVPFILE); $loop++ ) { $data->readFile($AVPFILE); # continue to read the Test inside the AVP-File my $writer = manufacture OutputWriter( $data->{MNEMONIC} ); # Ask the factory to produce e.g. a KMF-moduleWriter with the mnemonic B92A if( defined($writer) ) # don't do anything if the mnemonic is not recognizesed by the factory { unless( translationIncompatible($data) || globalWarningIsSet() ) { my $outputfilename = $shortfilename.".".sprintf("%04i",$loop).'.src'; # e.g. $inputname = example.avp -> $shortfilename = example $writer->writeTest($data, $outputfilename); # produce the outputfile with the name example0001.src unlink($outputfilename) if globalWarningIsSet(); # delete file if there happend s.th. really evil print "\tsuccessfully written file: ".$outputfilename."\n" unless globalWarningIsSet(); # print that everything went fine } } $data->clearData(); } close($AVPFILE); };