Jump to content

Newbie Perl Help


Recommended Posts

I would appreciate some help to get perl scripts running on helio host.

 

I have uploaded my perl script to /home1/directory/public_html/cgi-bin

I have set permissions on the script to 755

I have added #!/usr/bin/perl to the first line of the script

I am testing the script using http://website.heliohost.org/cgi-bin/gf_test.pl

 

However, the script does not run at all and gives an Internal Server Error.

 

Can anyone tell me what I am doing wrong. :blink: I have spent ages trying to get a perl script to work but need some guidance.

 

My test script is below

 

#!/usr/bin/perl

 

$words="Hello World";

&fscreen($words);

 

sub fscreen

{

my ($xwords) = @_;

 

print <<__;

Content-type: text/html

 

$xwords

__

}

Link to comment
Share on other sites

If you are looking for some help getting that code working I won't be able to help (I am a beginner with Perl as well). However if you just want help getting something to work, I'll be glad to help. It looks like you have a sub routine but I don't see anything calling that subroutine to make it run. That might have absolutely nothing to do with it though.

 

Try this code instead:

#!/usr/bin/perl

print "content-type: text/html \n\n"; #HTTP HEADER

# DEFINE A STRINGS
$word= 'hello world';

# PRINT IT TO THE BROWSER
print $word."<br />";

 

I defined a string and then printed the string using print.

 

 

I would appreciate some help to get perl scripts running on helio host.

 

I have uploaded my perl script to /home1/directory/public_html/cgi-bin

I have set permissions on the script to 755

I have added #!/usr/bin/perl to the first line of the script

I am testing the script using http://website.heliohost.org/cgi-bin/gf_test.pl

 

However, the script does not run at all and gives an Internal Server Error.

 

Can anyone tell me what I am doing wrong. :blink: I have spent ages trying to get a perl script to work but need some guidance.

 

My test script is below

 

#!/usr/bin/perl

 

$words="Hello World";

&fscreen($words);

 

sub fscreen

{

my ($xwords) = @_;

 

print <<__;

Content-type: text/html

 

$xwords

__

}

Link to comment
Share on other sites

  • 1 month later...

Previous post answered your query, I guess.

 

Just to reiterate: For making a perl script run ion almost all servers, check 3 things:

 

1- permission 755 (if accessing via browser to run it)

2- The #! line

3- Do this before outputting anything: print "content-type: text/html \n\n"; #HTTP HEADER

 

Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...