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:
Script, is calling from sub is not working

 



digioleg54
User

May 3, 2017, 1:43 PM

Post #1 of 5 (322 views)
Script, is calling from sub is not working Can't Post

Could you please check, why in my sub, $plscript is not working?

Code
#!/usr/bin/dwebenv perl 

my($lib_path,$data_path);
BEGIN{
$lib_path=$ENV{'DWEB_SITE_PATH'};
$data_path=$ENV{'DWEB_SITE_CGI_DATADIR'};
}
use lib $lib_path.'/lib/web';
use CGI qw(:standard -debug);
use File::Basename;
use FindBin qw( $RealBin);
use DBI;
use Cwd;
use strict;
use warnings;

require 'GetDatesdirs.pl';
my $oracle_user = &db_connect({'DSN'=> 'NYFISWCD'});
my $script = $work_path."/".$prog."job.pl";
my $proc_dt = &set_default_values ($name, $process_date,$oracle_user);
&file_request_user($script, $oracle_user,$process_date)
sub file_request_user
{
my ($plscript, $orauser,$proc_dt) = @_;
print "Content-type: text/html\n\n inside sub\n";
print "$plscript $orauser $process_date\n";
eval {
system ("/versions/perl-5.22.2/bin/perl $plscript $orauser $process_date");
}

}



Thanks


(This post was edited by digioleg54 on May 4, 2017, 12:01 PM)


Laurent_R
Veteran / Moderator

May 3, 2017, 2:55 PM

Post #2 of 5 (310 views)
Re: [digioleg54] Script, is calling from sub is not working [In reply to] Can't Post

Hi,
I'm not sure by what you mean with "$plscript is not working", but $plscript is apparently the first parameter passed to the file_request_user function, and you don't show the call to that function. So we don't know which argument you pass to this function, and therefore can't say anything about $plscript, since you don't show how it is populated.


digioleg54
User

May 4, 2017, 12:02 PM

Post #3 of 5 (303 views)
Re: [Laurent_R] Script, is calling from sub is not working [In reply to] Can't Post

Added function call

Thanks


Laurent_R
Veteran / Moderator

May 4, 2017, 2:49 PM

Post #4 of 5 (300 views)
Re: [digioleg54] Script, is calling from sub is not working [In reply to] Can't Post

OK, now we have $plscript populated with $script which is populated as follows:

Code
my $script = $work_path."/".$prog."job.pl";


But we still don't know the content of $prog. Can you enlighten us on this? Are you using this to build dynamically the name of the Perl program? Or is it perhaps supposed to be part of the path? Or something else?

One more comment on your syntax for calling subroutines: don't use & to call subs, this is an obsolete syntax (which can still be used for some very specific purposes not applicable to your program). So, for example, instead of:


Code
&file_request_user($script, $oracle_user,$process_date)


Simply use:

Code
file_request_user($script, $oracle_user, $process_date);



digioleg54
User

May 5, 2017, 5:39 AM

Post #5 of 5 (284 views)
Re: [Laurent_R] Script, is calling from sub is not working [In reply to] Can't Post

Below is my explanation.

Code
$prog = filerequ 

$script=/vhosts/dw18637/cgi-bin/filerequjob.pl


Both scripts

Code
 filerequ.pl and filerequjob.pl


are working on the same directory

In error_log I found below message:

Code
sh: -c: line 1: syntax error near unexpected token `(' 
[Fri May 05 09:31:30 2017] [error] [client 10.153.216.241] sh: -c: line 1: `/versions/perl-5.22.2/bin/perl /vhosts/dw18637/cgi-bin/filerequjob.pl DBI::db=HASH(0x8ac83d0) 20170505'


I am trying to send database connection. Is it wrong?
Thanks


(This post was edited by digioleg54 on May 5, 2017, 6:34 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