By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,848 Members | 1,319 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,848 IT Pros & Developers. It's quick & easy.

Perl + CGI

P: 48
Hi all,

I have designed a form in which I call a perl script but the issue is "Iam not able to see the output"...
<FORM ACTION="/cgi-bin/filecheck.pl" METHOD="post" ENCTYPE="multipart/form-data">

Contents of filecheck.pl is

print check;

There are few more lines I need to add in the .pl file to make the output available on screen. Can someone help me on the same.( Iam running in Windows)

Thanks
Apr 28 '08 #1
Share this Question
Share on Google+
5 Replies


Ganon11
Expert 2.5K+
P: 3,652
Remember that when using Perl to make CGI, you are actually printing out HTML. So you need to have all the tags necessary, like:

[HTML]<HTML>
<HEAD>This is a sample web page.</HEAD>
<BODY>
<p>This is a sample paragraph.</p>
<br>
</BODY>
</HTML>[/HTML]

You can either manually output all these tags (which will be messy and boring), or you can use some of the CGI methods imported when you 'use' it like so:

Expand|Select|Wrap|Line Numbers
  1. use CGI qw/:standard/;
Now many great functions are available. To generate the above HTML, I would write, in Perl,

Expand|Select|Wrap|Line Numbers
  1. print start_html('This is a sample web page.');
  2. print p('This is a sample paragraph');
  3. print br;
  4. print end_html;
Apr 28 '08 #2

numberwhun
Expert Mod 2.5K+
P: 3,503
Hi all,

I have designed a form in which I call a perl script but the issue is "Iam not able to see the output"...
<FORM ACTION="/cgi-bin/filecheck.pl" METHOD="post" ENCTYPE="multipart/form-data">

Contents of filecheck.pl is

print check;

There are few more lines I need to add in the .pl file to make the output available on screen. Can someone help me on the same.( Iam running in Windows)

Thanks
In addition to what Gannon provided, you should really open your browser, point it at Google and search for something like "CGI Perl tutorial" or something similar. There are plenty of good tutorials out there that will teach you the basics and sometimes, beyond.

Regards,

Jeff
Apr 28 '08 #3

KevinADC
Expert 2.5K+
P: 4,059
Remember that when using Perl to make CGI, you are actually printing out HTML. So you need to have all the tags necessary, like:

[HTML]<HTML>
<HEAD>This is a sample web page.</HEAD>
<BODY>
<p>This is a sample paragraph.</p>
<br>
</BODY>
</HTML>[/HTML]

You can either manually output all these tags (which will be messy and boring), or you can use some of the CGI methods imported when you 'use' it like so:

Expand|Select|Wrap|Line Numbers
  1. use CGI qw/:standard/;
Now many great functions are available. To generate the above HTML, I would write, in Perl,

Expand|Select|Wrap|Line Numbers
  1. print start_html('This is a sample web page.');
  2. print p('This is a sample paragraph');
  3. print br;
  4. print end_html;
You left out an important bit of information, with perl you have to print the http headers before any content is printed to the screen. If using CGI in standard more:

Expand|Select|Wrap|Line Numbers
  1. use CGI qw/:standard/;
  2. print header; 
  3. print p('This is a sample paragraph');
  4. print br;
  5. print end_html;
Apr 28 '08 #4

Ganon11
Expert 2.5K+
P: 3,652
Right, I did forget that little detail, didn't I?

Thanks Kevin.
Apr 28 '08 #5

P: 48
Thanks, It is really helpfull & will dig more into it wuth help of google....
Apr 29 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.