siddheshsawant has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks !!!!

I am working on the Perl project I am trying to invoke load_data_to_db.pl through poll_pkg_windows.pl script.When I run load_data_to_db.pl through CLI with command "perl load_data_to_db.pl 2010_06_15 2010_06_15 WINDOWS" it runs properly. But when I try to run it through poll_pkg_windows.pl it gives me just following lines as the output

2010-06-15_13-51-21: Script started

platform done is ===> Windows2010_06_15

The code of poll_pkg_windows.pl is as follows:

#!/usr/bin/perl use strict; use Cwd qw( abs_path ); my ($cwd, $above, $below, $tinc); my $Common; BEGIN { $cwd = abs_path "."; ($above, $below) = $cwd =~ m~^(.+)/pp2dev/src(/.+|)$~ or die "Not in a pp2dev source tree\n"; $Common="$above/pp2dev/src/testsuite/user"; my $tinc = "$above/pp2dev/src/testsuite/user/tinc"; unshift @INC, $tinc; unshift @INC, $Common; } use DataLoader::Configuration qw( &get_common_path &get_loader_log_file $LOADER_LOG_DIR $DATE_SEPARATOR ); use nightly::common; use DataLoader::DataLoader; use DataLoader::LogWriter; use lib &DataLoader::Configuration::get_common_path(); use Common; $windows_trunk = `rsh lcla238 -l root tail /nightly_results/today/ +WINDOWS_poll_pkg.log`; my $date = Common::get_current_date_string($sep); if($windows_trunk =~ /All done/){ print "platform done is ===> Windows".$date."\n"; my $result = `perl load_data_to_db +.pl 2010_05_15 2010_05_15 WINDOWS`; }

Kindly let me know where I am doing mistake?

Replies are listed 'Best First'.
Re: A doubt about invoking perl script through other perl script
by SuicideJunkie (Vicar) on Jun 15, 2010 at 18:28 UTC

    Start by cutting out all the unnecessary stuff when debugging:

    use warnings; use strict; my $result = `perl load_data_to_db +.pl 2010_05_15 2010_05_15 WINDOWS`;

    When you run that, do you get what you expect?

    Perhaps you want to print the value of $result

Re: A doubt about invoking perl script through other perl script
by ssandv (Hermit) on Jun 15, 2010 at 18:22 UTC

    The output of a command enclosed in backticks (or qx()) is not printed, it's returned. So $result contains the output of your load_data_to_db.pl. If you wanted the output to go to the screen, you need to either print $result or use system() instead of backticks.

    If you have some reason other than the lack of output for claiming the command failed, you need to say that. But, as presented, I wouldn't expect that command to output to the terminal.

    A reply falls below the community's threshold of quality. You may see it by logging in.