Re: Using $CGI::POST_MAX

2004-10-22 Thread Gunnar Hjalmarsson
Bill Stephenson wrote:
I've tweaked the code as much as I know how in order to make it
work as expected but have not been successful. Is this a bug in
CGI.pm or am I missing something simple here?
Opps! I hadn't tried everything and I was missing something
simple
if ($Q->cgi_error()) {
print $Q->header;
$message = $Q->cgi_error();
&error_trap($message);
   }
Yeah, I noticed too that the OO interface works. Nevertheless I'm
inclined to believe that it is a bug in CGI.pm and/or its docs, but it
would be good if somebody with more CGI.pm experience could comment on
it.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: Using $CGI::POST_MAX

2004-10-22 Thread Bill Stephenson
I've tweaked the code as much as I know how in order to make it work 
as expected but have not been successful. Is this a bug in CGI.pm or 
am I missing something simple here?

Opps! I hadn't tried everything and I was missing something simple
if ($Q->cgi_error()) {
print $Q->header;
$message = $Q->cgi_error();
&error_trap($message);
   }
Thanks again!
Bill Stephenson
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: Using $CGI::POST_MAX

2004-10-22 Thread Bill Stephenson
On Oct 21, 2004, at 8:07 PM, Gunnar Hjalmarsson wrote:
Bill Stephenson wrote:
I'm using this line in my script:
$CGI::POST_MAX = $CGI::POST_MAX = 30720; # 30k
I tested it to see if it works and it did not process the form and
write the data to a file when the data entered exceeded the amount
specified.
That's great, but I can't find a way in Lincoln's book to detect this
condition so I can respond accordingly to the client. Does anyone
here know how this might be done?
It's explained in "perldoc CGI".
Thanks for the tip, Gunnar.
In order to better understand this I created the script below. I tested  
it by running it in a browser and copying and pasting a paragraph of  
text into the text area and pressing submit. I kept adding more text  
until it trapped the error. But it doesn't always work. When it fails,  
the scripts responds as if there were no parameters passed and runs the  
default routine even though there was much more than 2k posted.

I'm running this on a Mac, OS X 10.3, with Apple's Safari browser.
I've tweaked the code as much as I know how in order to make it work as  
expected but have not been successful. Is this a bug in CGI.pm or am I  
missing something simple here?

Kindest Regards,
Bill Stephenson

#!/usr/bin/perl -w
use strict;
use CGI qw/:standard/;
use CGI::Carp('fatalsToBrowser');
$CGI::DISABLE_UPLOADS = 1;
$CGI::POST_MAX=1024 * 2;  # max 2k posts
# Create a new CGI Object for the form input
my $Q = new CGI;
# Trap post that are too large here...
my $message;
my $posted_content="";
if (cgi_error()) {
&error_trap($message = " Error:: 413 POST too large");
   }
if ($Q->param('overload')) {
$posted_content= $Q->param('overload');
}
print $Q->header;
print $Q->start_html;
print "Passed Through";
print $Q->start_form(-method=>'POST',
 -action=>'/cgi-bin/max_test.cgi');
print $Q->textarea(-name=>'overload',
   -value=>"$posted_content",
   -rows=>"20",
   -cols=>"72",
   -wrap=>"virtual");
print $Q->submit;
print $Q->end_form;
print "==";
print $Q->Dump;
print "==";
print $Q->end_html;
exit;
 
#
# sub error_trap
 
#
sub error_trap {
	print $Q->header;
	print $Q->start_html;
	print "$message";
	print $Q->end_html;
	exit;
}


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: Help with php & perl

2004-10-22 Thread David Dorward
On Fri, Oct 22, 2004 at 05:51:06PM +1000, [EMAIL PROTECTED] wrote:

> just spent absolutely days re writing all my html file into php with
> css & includes for reusable page elements. only to find that my perl
> script won't run the css or the php includes.

A CSS @import (assuming that is what you mean by a CSS include) is
client side. What software you use to generate your client side code
is rather irrelevent. Perl should not a be a factor in this not
working. (Of course it is possible you are generating invalid content,
or sending a Content-type header that claims the CSS is something
other then CSS, but that is impossible to debug without seeing the
code.)

As for Perl and PHP; they are different tools to do the same
job. While it is theoretically possible to configure your server to
chain together PHP and Perl interpretors (thus generating HTML from
PHP, but generating the PHP from Perl (or generating Perl from PHP and
the HTML from the Perl) this isn't something I'd want to do as it is
overly complex and inefficient.

Once you get down to it, there isn't anything you can do with PHP that
you can't do with Perl (and vice versa), although some things might be
easier in one or the other. I suggest you pick a language and stick to
it. (Perl is a good choice :D )

> the newbie at perl & php.

If you are a PHP beginner AND a Perl beginner then its even more of a
bad idea to try to use them both at the same time!

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Help with php & perl

2004-10-22 Thread catrionaw
HI folks,

just spent absolutely days re writing all my html file into php with css & includes 
for reusable page elements. only to find that my perl script won't run the css or the 
php includes.

Any ideas on what I can do to alter this, I know the perl script locks down to html 
only, but I have altered the file types to display to include the css and php 
includes...but it still doesn't pick up.

The script I have I picked up ages ago so it might have something else locking down 
the html, but what do I look for??

the newbie at perl & php.

thanks in advance

cat