Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8974401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:40:18+00:00 2026-06-15T18:40:18+00:00

Let start with the basic back ground. We recently brought our web hosting in

  • 0

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.

Public link : http://www.gatewayrehab.org/eap/

When you goto website we get the following error message

 "Software error:

Can't call method "display" on an undefined value at /var/www/www.gatewayrehab.org/app/webroot/eap/index.cgi line 47."

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 :

#!/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(/&/, $buffer);

#&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 -> get_cookies();

### read the summary database
my $summary_ref = $File -> read($login_summary)|| $Error -> display("$!". __LINE__);
my (@summary) = @$summary_ref;

### read the companies database
my $companies_ref = $File -> read($companies_db)|| $Error -> 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] = &trim($field[0]);
        $field[2] = &trim($field[2]);       
        $field[3] = &trim($field[3]);
        $field[4] = &trim($field[4]);
        $field[5] = &trim($field[5]);
        $field[6] = &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" && $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, ">$login_summary") || $Error -> display("$!". __LINE__);
        flock(LOG,2);
        foreach (@summary) {
            print LOG $_ ."\n";
        }
        flock(LOG,8);
        close(LOG);         
        #$File -> file($login_summary);
        #$File -> data(\@summary);
        #$File -> write() || $Error -> 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" && $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, ">>$login_summary") || $Error -> 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, ">>$login_logs") || $Error -> 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" && $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 "<h1>hello world!</h1>";

$e = `perl -ver`;
$r = `whereis perl5`;
$z = `whereis sendmail`;#
$w = `top`;#
$d = `w`;

print "<pre>perl version:<br>$e<hr>perl path:<br>$r<hr>sendmail path:<br>$z<hr>top:<br>$w<hr>w:<br>$d<hr>environment vars:<br>";##

while (($key, $val) = each %ENV) {
    print "$key = $val\n";
}


$x= 'lowercase';
print "<hr>path tranlsated(NT)<br>$ENV{'PATH_TRANSLATED'}</pre>";
#$x = uc($x);
print "<br>$x";
exit;

Please let me know what I am missing. If you need to look at more “included” files let me know.

Also here is the link for our cgi config. http://www.gatewayrehab.org/eap/cgi-bin/cgi.cgi

Thank You.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T18:40:19+00:00Added an answer on June 15, 2026 at 6:40 pm

    I have resolved the problem with a quick fix. I don’t know why it work but it does for me.
    Here what i did…After reading online i found that adding “-w” on the header of all .(dot)cgi files make it work.
    I do hope there is a better method to add “-w” in one place then adding it on all .cgi files.

    In short change #!/usr/bin/perl to #!/usr/bin/perl -w

    Thanks all.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let me start off by saying I know I've violated some basic Java principles
Let me just start out by saying I am completely new to Java web
Let's start with the Hello World program detailed at http://developer.android.com/resources/tutorials/hello-world.html . Let's add the
Let me start by saying this is a homework assignment, I don't need any
Let me start by saying that I've never coded in Python. I need to
Let me start by saying, I like the border that chrome is using for
Let me start by telling you that I never used anything besides SVN and
Let me start out by saying that I'm not a C developer and I
Let’s start with this statement: We have published couple of free applications on the
Let me start off by saying I don't want to print only the duplicate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.