Find the answer to your Linux question:
Results 1 to 2 of 2
Hello. I get a weird error when I run my script, and I just don't see where the problem is. Here is the script: Code: #!/usr/bin/perl/ -wT use CGI qw/:standard/; ...
  1. #1
    Just Joined! vitalka's Avatar
    Join Date
    Oct 2004
    Location
    Toronto, ON
    Posts
    77

    [SOLVED] Weird error in perl script

    Hello.

    I get a weird error when I run my script, and I just don't see where the problem is.

    Here is the script:
    Code:
    #!/usr/bin/perl/ -wT 
     
    use CGI qw/:standard/; 
    use strict; 
    use CGI::Carp qw(warningsToBrowser fatalsToBrowser); 
    use DBI; 
    use CGI::Session; 
    use Digest::SHA1 qw(sha1_base64); 
     
    #-------------------------------------------------------------- 
    my $cgi = new CGI; 
    my $session = new CGI::Session(); 
    my $CGISESSID = $session->id(); 
     
    my $user_status = $session->param("user_status"); 
    my $user_name = $session->param("user_name") 
     
    #-------------------------------------------------------------- 
    # check if user is allowed to be here 
     
    if ($user_status ne "allow"){ 
    	print redirect('./login.dhtml'); 
    } 
     
    #------------------------------------------------------------- 
    # 
    if (param('register')){ 
    	my $password = param('password'); 
    	my $digest = sha1_base64($password); 
    	print $session->header; 
    	print start_html; 
    	print $digest; 
    	print end_html; 
    } else { 
    	print $session->header; 
    	print start_html; 
    	&user_form; 
    	print end_html; 
    } 
     
    #------------------------------------------------------------- 
    # form for user registration 
     
    sub user_form 
    { 
    print "Register New User", br; 
    print start_form(-method=>'post'), 
    	"<table border = '1'>", 
    	"<tr>", 
    		"<td>Full Name:</td>", 
    		"<td>",textfield(-name=>'user_ame',-size=>'20',-maxlength=>'20'),"</td>", 
    	"</tr>", 
    	"<tr>", 
    		"<td>Login:</td>", 
    		"<td>",textfield(-name=>'login',-size=>'10',-maxlength=>'10'),"</td>", 
    	"</tr>", 
    	"<tr>", 
    		"<td>Password:</td>", 
    		"<td>",password_field(-name=>'pass',-size=>'10',-maxlength=>'10'),"</td>", 
    	"</tr>", 
    	"<tr>", 
    		"<td>&nbsp</td>", 
    		"<td>",submit(-name=>'register',-value=>'Register'),"</td>", 
    	"</tr>", 
    	"</table>", 
    	end_form; 
    } 
    #------------------------------------------------------------- 
     
    exit; 
     
    __END__

    And here is the error:
    Code:
    [Mon Jul 28 00:00:13 2008] [error] [client 192.168.1.100] (20)Not a directory: exec of 
     '/export/srv/www/vhosts/main/htdocs/dhtml/thm/add_user.dhtml' failed 
    [Mon Jul 28 00:00:13 2008] [error] [client 192.168.1.100] Premature end of script headers: add_user.dhtml
    At first I thought that it was a permission issue, but it's not. I tried running it with permissions set to 777 and it didn't help.

    I hope that some one has clue.

    Thank you.

  2. #2
    Just Joined! vitalka's Avatar
    Join Date
    Oct 2004
    Location
    Toronto, ON
    Posts
    77
    Ok, I solved it.

    Look at this line:
    #!/usr/bin/perl/ -wT

    And this is how it should be:
    #!/usr/bin/perl -wT


    Last slash should not be there.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...