CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
System calls on a few files



Jun 30, 2015, 8:06 AM

Post #1 of 1 (1356 views)
System calls on a few files Can't Post


So I need some help with another integration issue.

Basically, I am checking consistency of information between a set of 3 or more files and one text file. I have a program that checks this for me, and now I have to integrate this into the main checks.

The text file itself is being checked through a system call via this snippet of code:

print ("\n calling\n"); 
my $my_start_folder = getcwd();
#print (" >>>>>>>>==0\n$my_start_folder \n" );
my @dirs = split (/\//,$my_start_folder);
my $snapshot_folder_qa = $dirs[-2];
#print (" >>>>>>>>==2 $snapshot_folder_qa \n" );
my @snaps = split (/_/,$snapshot_folder_qa);
pop @snaps;
my $snapshot_folder = join('_',@snaps);

#print ("Release note filepath: \n ../../$snapshot_folder/$macro.rls \n" );
my $commandR = " ../../$snapshot_folder/$macro.rls";
system ($commandR);

print ("\nRelease note checking is finished.\n" );

For my purposes, I need to call this text file as an input to my own script (which is also takes a directory input, which has the 3 or more files. Now before we get into how to actually code it, any suggestions on how to solve this issue, at least on a top level?

The main script that I am integrating into, has 3 global variables set as the 3 files in the directory, however, sometimes there are more than 3 files there. has a glob function to grab all the files, and extract the information, as below:

my @libertyFiles_array = glob("$liberty_directory/*.lib"); 
foreach (glob("$liberty_directory/*/*.lib")) {
push (@libertyFiles_array, $_);

if (@libertyFiles_array == 0) {
die "\nNo Liberty File found. No point in proceeding further\n";

my %liberty_files_extracted_hash;
print "Found the liberty file corners:\n";

foreach (@libertyFiles_array)

open (FILE, "<", $_);

my @contents_each_file = <FILE>;

close (FILE);

foreach (@contents_each_file)

if (m/^\s*(voltage)\s*(:)\s*(\d+\.?\d*)/)
$voltage_lib = $3;

if (m/^\s*(temperature)\s*(:)\s*([+ -]?\d+\.?\d*)/)
$temperature_lib = $3;

if (m/^\s*(default_operating_conditions)\s*(:)\s*(\w+)/)
$cornerLib = $3;

if (m/^\s*default/)
$enReadCorner_lib = 0;


Any idea how to tackle this, all the files in the directory that is being passed in end with .lib so this script works.

(This post was edited by FishMonger on Jun 30, 2015, 9:43 AM)


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives