Note that there are some explanatory texts on larger screens.

plurals
  1. POPerl help: Can't call method "display" on an undefined value
    primarykey
    data
    text
    <p>Let start with the basic back ground. We recently brought our web hosting in house. There are few old website still use Perl. I have no experience with Perl. Let's Begin. We have a this sub website on our main domain. </p> <p>Public link : <a href="http://www.gatewayrehab.org/eap" rel="nofollow">http://www.gatewayrehab.org/eap/</a> </p> <p>When you goto website we get the following error message</p> <pre><code> "Software error: Can't call method "display" on an undefined value at /var/www/www.gatewayrehab.org/app/webroot/eap/index.cgi line 47." </code></pre> <p>Looking at the EAP website/directory all files look in place with proper permission, again I have no experience with Perl/Cgi. Below is the index.cgi file :</p> <pre><code>#!/usr/bin/perl -w ### the main control file used in the system BEGIN { unshift @INC, qw(./cgi-bin/include/); } ### send all fatal errors to the browser use CGI::Carp qw(fatalsToBrowser); use CGI qw(:standard); use Error_Handler; use File_Handler; use Cookie_Handler; require "./cgi-bin/setup.cgi"; do "./cgi-bin/include/common.cgi"; ### initialize the file handling module my $File = new File_Handler; ### initialize the cookie handling module my $Cookie = new Cookie_Handler; ###parse $ENV{'REQUEST_METHOD'} =~ tr/a-z/A-Z/; if ($ENV{'REQUEST_METHOD'} eq "POST"){ read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); } else { $buffer = $ENV{'QUERY_STRING'}; } @pairs = split(/&amp;/, $buffer); #&amp;error_check; foreach $pair (@pairs){ ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $name =~ tr/+/ /; $name =~ s/\breq\_//ig; $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $name =~ tr/A-Z/a-z/; $name = trim($name); $FORM{$name} = trim($value); } my %cookiedata = $Cookie -&gt; get_cookies(); ### read the summary database my $summary_ref = $File -&gt; read($login_summary)|| $Error -&gt; display("$!". __LINE__); my (@summary) = @$summary_ref; ### read the companies database my $companies_ref = $File -&gt; read($companies_db)|| $Error -&gt; display("$!". __LINE__); my (@companies) = @$companies_ref; my %COMP = (); foreach (@companies) { $_ =~ s/\n|\r//g; my ($c_num, $c_name) = split(/\t/, $_); $COMP{$c_num} = $c_name; } if ( $cookiedata{'LOGIN'} != 1 ) { my $found = 0; my $company_number = $ENV{'REMOTE_USER'}; $company_number =~ s/s|e|w//g; foreach (@summary) { $_ =~ s/\n|\r//g; my @field = split(/\t/, $_); $field[0] = &amp;trim($field[0]); $field[2] = &amp;trim($field[2]); $field[3] = &amp;trim($field[3]); $field[4] = &amp;trim($field[4]); $field[5] = &amp;trim($field[5]); $field[6] = &amp;trim($field[6]); if ( $field[0] eq "$company_number" ) { $found = 1; my $firstletters = substr($ENV{'REMOTE_USER'}, 0, 2); $firstletters = trim($firstletters); if ( $firstletters ne "sw" &amp;&amp; $firstletters ne "lf" ) { $firstletters = substr($firstletters, 0, 1); } if ( lc($firstletters) eq "e" ) { $field[3] = ($field[3] + 1); } elsif ( lc($firstletters) eq "s" ) { $field[2] = ($field[2] + 1); } elsif ( lc($firstletters) eq "w" ) { $field[4] = ($field[4] + 1); } elsif ( lc($firstletters) eq "sw" ) { $field[5] = ($field[2] + 1); } elsif ( lc($firstletters) eq "lf" ) { $field[6] = ($field[6] + 1); } else { $field[3] = ($field[3] + 1); } $_ = join("\t", @field); } } if ( $found == 1 ) { # write data back to file # append to summary file open(LOG, "&gt;$login_summary") || $Error -&gt; display("$!". __LINE__); flock(LOG,2); foreach (@summary) { print LOG $_ ."\n"; } flock(LOG,8); close(LOG); #$File -&gt; file($login_summary); #$File -&gt; data(\@summary); #$File -&gt; write() || $Error -&gt; display("$!". __LINE__); } else { $e = 0; $s = 0; $w = 0; $sw = 0; $lf = 0; my $firstletters = substr($ENV{'REMOTE_USER'}, 0, 2); $firstletters = trim($firstletters); if ( $firstletters ne "sw" &amp;&amp; $firstletters ne "lf" ) { $firstletters = substr($firstletters, 0, 1); } if ( lc($firstletters) eq "e" ) { $e = 1; } elsif ( lc($firstletters) eq "s" ) { $s = 1; } elsif ( lc($firstletters) eq "w" ) { $w = 1; } elsif ( lc($firstletters) eq "sw" ) { #$sw = 1; $s = 1; } elsif ( lc($firstletters) eq "lf" ) { $lf = 1; } else { $e = 1; } # append to summary file open(LOG, "&gt;&gt;$login_summary") || $Error -&gt; display("$!". __LINE__); flock(LOG,2); print LOG $company_number ."\t". $COMP{$company_number} ."\t". $s ."\t". $e ."\t". $w . "\t". $sw ."\t". $lf ."\n"; flock(LOG,8); close(LOG); } my (@login_logs) = (); my $logline = ""; $login_logs[0] = $ENV{'REMOTE_USER'}; $login_logs[1] = $ENV{'REMOTE_ADDR'}; $login_logs[2] = time(); open(LOG, "&gt;&gt;$login_logs") || $Error -&gt; display("$!". __LINE__); flock(LOG,2); print LOG $ENV{'REMOTE_USER'} ."\t". $ENV{'REMOTE_ADDR'} ."\t". time() ."\n"; flock(LOG,8); close(LOG); print "Set-Cookie: LOGIN=1"; print "; path=$cookiepath; domain=$cookiedomain;\n"; } my $firstletters = substr($ENV{'REMOTE_USER'}, 0, 2); $firstletters = trim($firstletters); if ( $firstletters ne "sw" &amp;&amp; $firstletters ne "lf") { $firstletters = substr($firstletters, 0, 1); } if ( lc($firstletters) eq "e" ) { print "Location: http://www.gatewayrehab.org/eap/new/employee/member.htm\n\n"; } elsif ( lc($firstletters) eq "s" ) { print "Location: http://www.gatewayrehab.org/eap/supervisor/\n\n"; } elsif ( lc($firstletters) eq "w" ) { print "Location: http://www.gatewayrehab.org/eap/new/worklife/member.htm\n\n"; } elsif ( lc($firstletters) eq "sw" ) { print "Location: http://www.gatewayrehab.org/eap/supervisor-wl/\n\n"; exit; } elsif ( lc($firstletters) eq "lf" ) { print "Location: http://www.gatewayrehab.org/eap/legalandfinancial/\n\n"; exit; } else { print "Location: http://www.gatewayrehab.org/eap/new/employee/member.htm\n\n"; } #output html print "Content-type: text/html\n\n"; print "&lt;h1&gt;hello world!&lt;/h1&gt;"; $e = `perl -ver`; $r = `whereis perl5`; $z = `whereis sendmail`;# $w = `top`;# $d = `w`; print "&lt;pre&gt;perl version:&lt;br&gt;$e&lt;hr&gt;perl path:&lt;br&gt;$r&lt;hr&gt;sendmail path:&lt;br&gt;$z&lt;hr&gt;top:&lt;br&gt;$w&lt;hr&gt;w:&lt;br&gt;$d&lt;hr&gt;environment vars:&lt;br&gt;";## while (($key, $val) = each %ENV) { print "$key = $val\n"; } $x= 'lowercase'; print "&lt;hr&gt;path tranlsated(NT)&lt;br&gt;$ENV{'PATH_TRANSLATED'}&lt;/pre&gt;"; #$x = uc($x); print "&lt;br&gt;$x"; exit; </code></pre> <p>Please let me know what I am missing. If you need to look at more "included" files let me know.</p> <p>Also here is the link for our cgi config. <a href="http://www.gatewayrehab.org/eap/cgi-bin/cgi.cgi" rel="nofollow">http://www.gatewayrehab.org/eap/cgi-bin/cgi.cgi</a></p> <p>Thank You.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload