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

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
command syntax

 



sparsh
Novice

Jun 22, 2015, 2:15 PM

Post #1 of 9 (1993 views)
command syntax Can't Post

hi,

I wanted to run this script (ips_area_extraction) in a larger script (qa_scripts_core)

so I am using the line :

my $commandIPSArea = "/home/srastogi/begperl/ips_area_extraction.pl" . join(" ", "ips_area_extraction.pl", $macro, $txt_file);

print $commandIPSArea;
print ("\nPerforming IPS Area extraction...");
system ($commandIPSArea);


and the output is :

/home/srastogi/begperl/ips_area_extraction.plips_area_extraction.pl ips_tsmc40lp25od33_p1r32d0_ac DS_IPS_TSMC40LP25OD33_P1R32D0_AC.txt

Performing IPS Area extraction...Can't exec "/home/srastogi/begperl
/ips_area_extraction.plips_area_extraction.pl": No such file or directory at
/home/srastogi/begperl/qa_scripts_core line 4158.


clearly the syntax is wrong, can someone please point out what is wrong? The $macro and $txt_file parameters are correct.


Zhris
Enthusiast

Jun 22, 2015, 6:05 PM

Post #2 of 9 (1989 views)
Re: [sparsh] command syntax [In reply to] Can't Post

Hi,

Take a look at your stringified command:


Code
/home/srastogi/begperl/ips_area_extraction.plips_area_extraction.pl ips_tsmc40lp25od33_p1r32d0_ac DS_IPS_TSMC40LP25OD33_P1R32D0_AC.txt


You have appended the script filename ( ips_area_extraction.pl ) twice. Remove the one from the quoted string or the first argument to join.


Code
my $commandIPSArea = "/home/srastogi/begperl/" . join(" ", "ips_area_extraction.pl", $macro, $txt_file); 
# or
my $commandIPSArea = "/home/srastogi/begperl/ips_area_extraction.pl" . join(" ", $macro, $txt_file);


Chris


(This post was edited by Zhris on Jun 22, 2015, 6:06 PM)


sparsh
Novice

Jun 23, 2015, 1:09 PM

Post #3 of 9 (1968 views)
Re: [Zhris] command syntax [In reply to] Can't Post

Ok, I got it working, however, I need to compare some variables inside this ips_area_extraction.pl file to some of the global variables in qa_scripts_core. I'm not sure how to do that, I tried using subroutines but im running into issues. Any idea on how to get around this?


Laurent_R
Veteran / Moderator

Jun 23, 2015, 11:05 PM

Post #4 of 9 (1959 views)
Re: [sparsh] command syntax [In reply to] Can't Post

We need far more details to be able to help you. Perhaps the best would be for you to show the code that you tried and is leading to issues, as well as the warnings and/or error messages you get, and also some input data sample.


Zhris
Enthusiast

Jun 24, 2015, 12:59 AM

Post #5 of 9 (1955 views)
Re: [sparsh] command syntax [In reply to] Can't Post

Hi,

As Laurent stated, we need more details to confidently help you.

Perhaps you want to pass your globals as other arguments in qa_scripts_core then fetch these via @ARGV in ips_area_extraction:


Code
# qa_scripts_core.pl 

our $global = 77;
system("ips_area_extraction.pl $global");



Code
# ips_area_extraction.pl 

my $variable = 77;
my $global = $ARGV[0];
print +($variable == $global) ? 'equal' : 'not equal';


Although, more often than not, it would be most suitable to refactor your scripts into one, modularizing if need be, removing the system call altogether. Another alternative would be to treat ips_area_extraction.pl as a library file and require it.

Chris


sparsh
Novice

Jun 24, 2015, 1:44 PM

Post #6 of 9 (1949 views)
Re: [Zhris] command syntax [In reply to] Can't Post

Alright, I will explain the issue abit more clearly with some code

As I stated, I need to compare some variables within ips_area_extraction to some global variables in qa_scripts_core.

Here is the way I'm calling ips_area_extraction in qa_scripts_core:


Code
my $commandIPSArea = join(" ", '/home/srastogi/begperl/ips_area_extraction.pl', $macro, $txt_file); 
print $commandIPSArea;
print ("\nPerforming IPS Area extraction...\n");
system ($commandIPSArea);


and the output is :

/home/srastogi/begperl/ips_area_extraction.pl ips_YRTlp35od33_p1r32d0_ac DS_IPS_YRTLP35OD33_P1R32D0_AC.txt
Performing IPS Area extraction...
Node is 35
DS area is as follows: 329 microns by 150 microns and the area is 0.493


Now, some variables within ips_area_extraction, such as:

$ips_x, $ips_y,

have to match global variables in qa_scripts_core, and those variables are : $lef_x, $lef_y.


Here is the code for ips_area_extraction:


Code
my ($macroname, $parsed_ds) = @ARGV; 
my ($ips_x, $ips_y) = (0,0);
my $ips_area = 0;
my ($temp_x, $temp_y, $temp_area) = (0,0,0);
my ($foundry_name, $node);


if ($macroname =~ m/(ips_)([a-z]+)(\d+)/i)

{
$node = $3;
}

print "Node is $3 \n";


open(DATA, $parsed_ds) or die "Cannot locate file \n";



while(my $parsed_ds = <DATA>)
{

if ($node == 28)
{

if ($parsed_ds =~ m/^\s*(Physical)\s*(Dimensions)\s*(X=)\s*(\d+\.?\d*)(Ám)/)
{
$ips_x = $4;
}


if ($parsed_ds =~ m/^\s*(Y=)\s*(\d+\.?\d*)(Ám)/)
{
$ips_y = $2;
}

}

if ($node == 35)
{
if ($parsed_ds =~ m/^\s*(X=)\s*(\d+\.?\d*)(Ám)(,)\s*(Y=)\s*(\d+\.?\d*)(Ám)(,)\s*(A)\s*(=)\s*(\d+\.?\d*)(mm2)/)
{

$temp_x = $2;
$temp_y= $6;
$temp_area = $11;


if ($temp_area > $ips_area && $temp_x > $ips_x && $temp_y > $ips_y)
{
$ips_x = $temp_x;
$ips_y = $temp_y;
$ips_area = $temp_area;
}
}


}
}



print "DS area is as follows: $ips_x microns by $ips_y microns and the area is $ips_area \n";


Hopefully this is abit more clear.


(This post was edited by FishMonger on Jun 24, 2015, 4:17 PM)


Zhris
Enthusiast

Jun 24, 2015, 3:03 PM

Post #7 of 9 (1945 views)
Re: [sparsh] command syntax [In reply to] Can't Post

Hi,

As per my first suggestion, how about passing in $lef_x and $lef_y as additional arguments then extending your @ARGV assignment list:


Code
# qa_scripts_core.pl 

...
my $commandIPSArea = join(" ", '/home/srastogi/begperl/ips_area_extraction.pl', $macro, $txt_file, $lef_x, $lef_y);
...



Code
# ips_area_extraction.pl 

...
my ($macroname, $parsed_ds, $lef_x, $lef_y) = @ARGV;
...


Chris


(This post was edited by Zhris on Jun 24, 2015, 3:04 PM)


FishMonger
Veteran / Moderator

Jun 24, 2015, 4:32 PM

Post #8 of 9 (1938 views)
Re: [sparsh] command syntax [In reply to] Can't Post

$ips_x and $ips_y are private/local to ips_area_extraction.pl and are not accessible from qa_scripts_core especially since it's being executed via a system call.

You either need to capture and parse the output of ips_area_extraction.pl to extract the desired items, or you need to refactor your code so that both scripts are combined into one or one is turned into a module and provides access to those values.


sparsh
Novice

Jun 25, 2015, 7:56 AM

Post #9 of 9 (1923 views)
Re: [FishMonger] command syntax [In reply to] Can't Post

Thanks for the suggestions friends.

The method of passing in the globals into the script works.

Got it working as I wanted.

THANKS A LOT! :D

 
 


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

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