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

what is param() in CGI PERL

P: 36
HI,

I have problem in this code

it is not working it is not going insdie param condition...

please what will be the problem

please help me

Expand|Select|Wrap|Line Numbers
  1. use CGI qw(:standard);
  2.  
  3. print "Content-type: text/plain\n\n";
  4.  
  5. if (param()) {
  6.     my $dest = param('dest');
  7.     my $opt  = param('opt');
  8.     my $file = param('file');
  9.     my $user = param('user');
  10.  
  11.     print "\n-->$dest  $opt  $file $user\n";
  12.     if ($file =~ /Z$/) {
  13.         `zcat $file | lp -d$dest -t $user $opt `;
  14.     } else {
  15.          `lp -d$dest -t $user $opt $file  `;
  16.     }
  17. ##Added by Ram K Maddela for deleting files from Server after Printer...    
  18.     `rm -f $file`;
  19. }
  20.  
Feb 5 '08 #1
Share this Question
Share on Google+
5 Replies


eWish
Expert 100+
P: 971
I would add the following this will tell you what params the script is seeing.

Before this section of code:
Expand|Select|Wrap|Line Numbers
  1. if (param()) {
  2.     my $dest = param('dest');
  3.     my $opt  = param('opt');
  4.     my $file = param('file');
  5.     my $user = param('user');
Add this section of code:
Expand|Select|Wrap|Line Numbers
  1. foreach my $key (param) {
  2.     print "<strong>$key</strong> -> ";
  3.     my @values = param($key);
  4.     print join(", ",@values),"<br>\n";
  5. }
--Kevin
Feb 5 '08 #2

P: 36
Can any one tell me how to execute this CGI script.

what are the configurations are required. and where to place this script. and any link or something is required for webserver or something.


shafi
Feb 6 '08 #3

eWish
Expert 100+
P: 971
If you don't know how to execute the script then how do you know that the param() are not being set?

Since you are running is as CGI you will need a webserver.

--Kevin
Feb 6 '08 #4

P: 36
I need details like where to keep this perl script.

what are the webervers are required for my program.
is it required to create any link between my program and webserver

please tell me those details

shafi
Feb 6 '08 #5

numberwhun
Expert Mod 2.5K+
P: 3,503
I need details like where to keep this perl script.

what are the webervers are required for my program.
is it required to create any link between my program and webserver

please tell me those details

shafi

Well, assuming that you will be using the Apache web server, here is a tutorial for setting it up. That should tell you what you need to know.

Regards,

Jeff
Feb 6 '08 #6

Post your reply

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