in reply to Re: perl script not working after moved to new host
in thread perl script not working after moved to new host

I am new to perl, I can't see where it get stops, on this host machine, so I posted completed code. Pls note that this same perl script is working fine on another host, on shell and browser as well. but here it is give this errors

perl -wd ngcf.pl node=servername

Loading DB routines from perl5db.pl version 1.32 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help.

Name "main::wday" used only once: possible typo at ngcf.pl line 41. at ngcf.pl line 41

Name "main::hour" used only once: possible typo at ngcf.pl line 41. at ngcf.pl line 41

Name "main::yday" used only once: possible typo at ngcf.pl line 41. at ngcf.pl line 41

Name "main::min" used only once: possible typo at ngcf.pl line 41. at ngcf.pl line 41

Name "main::sec" used only once: possible typo at ngcf.pl line 41. at ngcf.pl line 41

main::(ngcf.pl:12): $target="raksan"; Use of uninitialized value $tid in concatenation (.) or string at /usr/share/perl5/perl5db.pl line 2237. at /usr/share/perl5/perl5db.pl line 2237 DB::DB called at ngcf.pl line 12

  • Comment on Re^2: perl script not working after moved to new host

Replies are listed 'Best First'.
Re^3: perl script not working after moved to new host
by prabhakard (Novice) on Jan 25, 2016 at 11:08 UTC

    in this host from shell it runs and generates gif graph image file with data,

    but from browser it is generating graph file with empty data.

    I have compared perl and its modules wt both hosts, all are same, also checked permission, browser can able to write empty file

    but still not able to find where it is get struck when this script from browser.

Re^3: perl script not working after moved to new host
by Old_Gray_Bear (Bishop) on Jan 26, 2016 at 00:33 UTC
    And what happened after you fixed these errors?

    ----
    I Go Back to Sleep, Now.

    OGB

      after fix the permission error, from shell I can run that shell script(system)-------------------- same script when we calling from perl script not working,.....................it through system error 256 on browser

      Again please note that the same script working via perl on other system without any issue.

      Please help me to identify the issue on this system

        Try this cut down version of your program on both working and non-working systems and compare the contents of $ENV{'PATH'}

        #!/usr/bin/perl use strict; use warnings; use CGI ':standard'; use CGI::Carp 'fatalsToBrowser'; my $node = param('node'); my $target = "raksan"; my $wwwpath = '/target'; my $wwwrealpath = "/home/nagios/stat/$target/htdocs"; my $tmpgraph = "rrd-$$.gif"; my $recenttimes = time - 3600 * 36; print header(),start_html(); my $cmd = "/home/nagios/stat/scripts/ng_rrd2img.sh $target $node dig $ +recenttimes now 300 130 > $wwwrealpath/tmp/$tmpgraph"; my $status = system($cmd); if ($status){ warn "$?"; } my $path = join "\n",split ';',$ENV{'PATH'}; print qq!<pre>$cmd</pre> <pre>PATH $path</pre> <img src="$wwwpath/tmp/$tmpgraph" alt="$wwwpath/tmp/$tmpgraph" border= +"1"/>!; print end_html();
        poj