473,406 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Perl + CGI

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
5 1387
Ganon11
3,652 Expert 2GB
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
3,509 Expert Mod 2GB
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
4,059 Expert 2GB
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
3,652 Expert 2GB
Right, I did forget that little detail, didn't I?

Thanks Kevin.
Apr 28 '08 #5
Thanks, It is really helpfull & will dig more into it wuth help of google....
Apr 29 '08 #6

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

Similar topics

4
by: Mark Wilson CPU | last post by:
This must be easy, but I'm missing something... I want to execute a Perl script, and capture ALL its output into a PHP variable. Here are my 2 files: -------------------------------------...
31
by: surfunbear | last post by:
I've read some posts on Perl versus Python and studied a bit of my Python book. I'm a software engineer, familiar with C++ objected oriented development, but have been using Perl because it is...
0
by: Kirt Loki Dankmyer | last post by:
So, I download the latest "stable" tar for perl (5.8.7) and try to compile it on the Solaris 8 (SPARC) box that I administrate. I try all sorts of different switches, but I can't get it to compile....
13
by: Otto J. Makela | last post by:
I'm trying to install to php the Perl-1.0.0.tgz package (from http://pecl.php.net/package/perl, enabling one to call perl libraries) to a pre-existing Solaris system. Unfortunately, the attempt...
6
by: surfivor | last post by:
I may be involved in a data migration project involving databases and creating XML feeds. Our site is PHP based, so I imagine the team might suggest PHP, but I had a look at the PHP documentation...
4
by: billb | last post by:
I installed a perl extension for PHP to use some perl inside my php primarily because I have perl working with oracle and not php and oracle. So I want to use my old perl scripts, and use the...
21
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.