Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Help using cgi
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
prashant kaushal  
View profile  
 More options Apr 11 2011, 7:05 am
Newsgroups: perl.beginners
From: p.kausha...@gmail.com (prashant kaushal)
Date: Mon, 11 Apr 2011 04:05:31 -0700 (PDT)
Local: Mon, Apr 11 2011 7:05 am
Subject: Help using cgi
Hi Di,

Yesterday i tried a "Hello world" program in perl using cgi script on a windows platform. The steps i followed were:

1. Made a directory in "C:" and named it "cgi-bin"
2. Wrote  my source code file and saved it with "test.cgi"

########################################################################### ##
Source code-
#!/usr/bin/perl

print "Content-type:text/html\r\n\r\n";
print '<html>';
print '<head>';
print '<title>Hello Word - First CGI Program</title>';
print '</head>';
print '<body>';
print '<h2>Hello Word! This is my first CGI program</h2>';
print '</body>';
print '</html>';

1;
########################################################################### ###

3. opened it with my web browser.

but now instead of giving the output it just shows the original source code.  
please help!
regards

PS: software that I've installed on my pc is "Strawberry perl plus padre"


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alan Haggai Alavi  
View profile  
 More options Apr 12 2011, 4:22 am
Newsgroups: perl.beginners
From: alanhag...@alanhaggai.org (Alan Haggai Alavi)
Date: Tue, 12 Apr 2011 13:52:04 +0530
Local: Tues, Apr 12 2011 4:22 am
Subject: Re: Help using cgi
Hello Prashant,

> Yesterday i tried a "Hello world" program in perl using cgi script
> on a windows platform.

Check out the CGI module on CPAN.

> 3. opened it with my web browser.

> but now instead of giving the output it just shows the original
> source code. please help! regards

You have to configure your web server to execute CGI scripts.

Regards,
Alan Haggai Alavi.
--
The difference makes the difference


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Erez Schatz  
View profile  
 More options Apr 12 2011, 5:28 am
Newsgroups: perl.beginners
From: moonb...@gmail.com (Erez Schatz)
Date: Tue, 12 Apr 2011 12:28:44 +0300
Local: Tues, Apr 12 2011 5:28 am
Subject: [moonbuzz@gmail.com: Re: Help using cgi]Re: Help using cgi

On Mon, Apr 11, 2011 at 04:05:31AM -0700, prashant kaushal wrote:
> Hi Di,

> Yesterday i tried a "Hello world" program in perl using cgi script on a windows platform. The steps i followed were:

> 1. Made a directory in "C:" and named it "cgi-bin"
> 2. Wrote  my source code file and saved it with "test.cgi"

That won't do, you need to configure a webserver to execute that code. There are 2 ways to go about it:

1: install Apache, you can find a ready-to-go distribution at http://apachefriends.org
2: configure IIS to execute perl CGI, which is not extremely difficult, but requires you to know how to create a website on IIS.
Also, the top results on that search sadly still refer to ActiveState, so are not relevant anymore.

In a sense, what you need to do is add a .pl/.cgi association to IIS and configure it to open these files with Strawberry/perl/bin/perl.exe

If no further information will be given here by the time I get home (to a windows machine), I'll post a more thorough guide.

--
Erez                                                                                                                                                                                                                

La perfection soit atteinte non quand il n'ya plus rien à ajouter,                                                                                                                                                  
mais quand il n'ya plus rien à retrancher.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rob Dixon  
View profile  
 More options Apr 12 2011, 11:16 pm
Newsgroups: perl.beginners
From: rob.di...@gmx.com (Rob Dixon)
Date: Wed, 13 Apr 2011 04:16:14 +0100
Local: Tues, Apr 12 2011 11:16 pm
Subject: Re: Help using cgi
On 11/04/2011 12:05, prashant kaushal wrote:

Fist of all, either change the line

    #!/usr/bin/perl

to reflect the true path to the perl compiler on your machine. Either
that or change the file type to .pl and make the association with the
compiler.

Secondly, you don't need to print "\r\n" as line terminators. This will
only do what you want if you 'binmode' the output stream; otherwise "\n"
will be output as CR LF, and adding a preceding "\r" will produce CR CR
LF, which doesn't comply with HTTP standards.

Now, you are opening a Perl program file in a web browser. The browser's
job is to interpret what it receives (whether from a local file or a
remote HTTP server) and present it on screen. It expects HTML data (or
perhaps XML) and does its best with any other content by presenting the
data just as it is. There is never any possibility that the browser
should know to /execute/ a Perl program if it sees one; indeed any CGI
code must be run on the server so that it has access to the server's
environment: files, databases etc.

So it is the server's job to run your Perl program and pass its output
to the browser for display. But you have no web server - all you have is
a file, so the browser displays the data from that file.

You must install and configure an HTTP server. The configuration will
determine whether the contents of a given file should be served
unmodified, or be run as a program and the output delivered instead. It
is quite possible to run a server process on the same machine as where
the file and web browser exist, but expect to do a lot of reading to
understand the details of the configuration.

On Windows you should install the 'World Wide Web Services' features.
Unfortunately this is not the forum to help you further with that.

I hope this helps you.

Rob


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
prashant kaushal  
View profile  
 More options Apr 12 2011, 5:12 am
Newsgroups: perl.beginners
From: p.kausha...@gmail.com (prashant kaushal)
Date: Tue, 12 Apr 2011 02:12:13 -0700 (PDT)
Local: Tues, Apr 12 2011 5:12 am
Subject: Re: Help using cgi
Thanx alan..
please suggest the steps to configure my web server.

regards


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alan Haggai Alavi  
View profile  
 More options Apr 14 2011, 12:46 am
Newsgroups: perl.beginners
From: alanhag...@alanhaggai.org (Alan Haggai Alavi)
Date: Thu, 14 Apr 2011 10:16:23 +0530
Local: Thurs, Apr 14 2011 12:46 am
Subject: Re: Help using cgi
Hello Prashant,

> Thanx alan..

You are welcome.

> please suggest the steps to configure my web server.

It depends on which web server you are using. You will probably find a
cgi-bin directory (in Debian/Ubuntu, Apache's cgi-bin is at
/usr/lib/cgi-bin/) which is configured to serve CGI scripts. Else, you
will have to configure the web server to allow another directory to
serve CGI scripts and copy the script there.

Regards,
Alan Haggai Alavi.
--
The difference makes the difference


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Abizer Lokhandwala  
View profile  
 More options Apr 13 2011, 12:54 pm
Newsgroups: perl.beginners
From: abize...@gmail.com (Abizer Lokhandwala)
Date: Wed, 13 Apr 2011 09:54:28 -0700
Local: Wed, Apr 13 2011 12:54 pm
Subject: Re: Help using cgi

If you are using a Windows System, you can go into the Control Panel, click
"Enable or Disable Windows Components" and select IIS. Depending on
your version of Windows, you should either have IIS 6 / 7, probably IIS7 if
you are using Windows 7 as well. After selecting it, let Windows Install it,
then reboot your computer, use this (http://goo.gl/Ale0z) to download and
set up Perl on IIS. Bind the webserver to your internal IP address, because
so far you probably do not need a publicly available website. Then, put the
*.cgi / *.pl file in your website root, usually C:\inetpub\wwwroot\, and
access it with your browser. It took me a few days of tinkering to get it up
and working properly, but this should suffice for now.

Otherwise, you can download Apache webserver, which comes with perl,
but the instructions for setting that up is different depending on your OS.

(http://httpd.apache.org/, http://perl.apache.org/)

On Tue, Apr 12, 2011 at 2:12 AM, prashant kaushal <p.kausha...@gmail.com>wrote:

> Thanx alan..
> please suggest the steps to configure my web server.

> regards

> --
> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> For additional commands, e-mail: beginners-h...@perl.org
> http://learn.perl.org/

--
Abizer Lokhandwala

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »