Apache2::Upload and End of file found error

2006-12-05 Thread cfaust-dougot
Hi,
 
I'm trying to use Apache2::Upload as shown in the examples and the only thing I 
get is "End of file found" in the error log.
 
I've found quite a few messages on the subject, but I'm not using Mason and I'm 
using libapreq2.0.7.1.
 
I've tried the fh and slurp methods and both are the same.
 
Code I've been playing with
 
 my $req = Apache2::Request->new($r);
 my $upload = $req->upload('new_image');
 my $size = $upload->size;
 my $uploaded_file = $upload->fh;
 #$upload->slurp($uploaded_file);
 #$upload->link($uploaded_photo_name) or
#  die sprintf "link from '%s' failed: $!", $upload->tempname;
 
Server Info
Apache/2.0.55 (Ubuntu) PHP/5.1.6 mod_apreq2-20051231/2.5.7 mod_perl/2.0.2 
Perl/v5.8.8 configured
 
TIA


Apache2::Upload and End of file found error Part 2

2006-12-06 Thread cfaust-dougot
Folks,
 
I'm still trying to figure out what to do about this upload problem.. I've 
figured out that somehow creating a new CGI object is causing the problem but I 
have no idea how or what to do.
 
Below is a bare bone test upload script, if you comment out the "my $CGI = new 
CGI();" in the sub "init_global_vals" then the update works fine, if its 
uncommented then the server error of "End of file found" happens.
 
http://208.3.90.212/test.pm.txt
 
I have no idea how one relates to the other, any ideas?
 
Thanks
-Chris



From: cfaust-dougot [mailto:[EMAIL PROTECTED]
Sent: Tue 12/5/2006 1:28 PM
To: modperl@perl.apache.org
Subject: Apache2::Upload and End of file found error


Hi,
 
I'm trying to use Apache2::Upload as shown in the examples and the only thing I 
get is "End of file found" in the error log.
 
I've found quite a few messages on the subject, but I'm not using Mason and I'm 
using libapreq2.0.7.1.
 
I've tried the fh and slurp methods and both are the same.
 
Code I've been playing with
 
 my $req = Apache2::Request->new($r);
 my $upload = $req->upload('new_image');
 my $size = $upload->size;
 my $uploaded_file = $upload->fh;
 #$upload->slurp($uploaded_file);
 #$upload->link($uploaded_photo_name) or
#  die sprintf "link from '%s' failed: $!", $upload->tempname;
 
Server Info
Apache/2.0.55 (Ubuntu) PHP/5.1.6 mod_apreq2-20051231/2.5.7 mod_perl/2.0.2 
Perl/v5.8.8 configured
 
TIA


Re: Apache2::Upload and End of file found error Part 2

2006-12-06 Thread Fred Moyer

cfaust-dougot wrote:

Folks,
 
I'm still trying to figure out what to do about this upload problem.. I've figured out that somehow creating a new CGI object is causing the problem but I have no idea how or what to do.
 
Below is a bare bone test upload script, if you comment out the "my $CGI = new CGI();" in the sub "init_global_vals" then the update works fine, if its uncommented then the server error of "End of file found" happens.
 
http://208.3.90.212/test.pm.txt
 
I have no idea how one relates to the other, any ideas?


I'm not sure why you would want a CGI object shared between requests but 
my guess is that it's doing something strange as a result and I can't 
see any advantage to that approach.  If you don't have that $CGI object 
around and it works fine that might be telling you that it's causing 
trouble and not helping.


A few other comments that might keep you from running into other problems:

1) 'perldoc vars' - use 'our' in favor of 'use vars'

2) don't use global variables unless you really need them and they serve 
a useful purpose ($template_header and $template_footer globals are ok 
since they are stateless, $CGI objects are not)


3) try the latest version of libapreq, 2.08.  I don't think it will fix 
your existing problem (which the $CGI seems to be the root of), but 
there have been a number of bug fixes since the release you're using.


4) Take a look at Apache::DBI instead of keeping $db in a global -
$db = ISMH::ConnectDBUser->connect_to_db();

HTH  - I think the simple issue to fix your problem is don't use a 
global $CGI object FWIW


 
Thanks

-Chris

____

From: cfaust-dougot [mailto:[EMAIL PROTECTED]
Sent: Tue 12/5/2006 1:28 PM
To: modperl@perl.apache.org
Subject: Apache2::Upload and End of file found error


Hi,
 
I'm trying to use Apache2::Upload as shown in the examples and the only thing I get is "End of file found" in the error log.
 
I've found quite a few messages on the subject, but I'm not using Mason and I'm using libapreq2.0.7.1.
 
I've tried the fh and slurp methods and both are the same.
 
Code I've been playing with
 
 my $req = Apache2::Request->new($r);

 my $upload = $req->upload('new_image');
 my $size = $upload->size;
 my $uploaded_file = $upload->fh;
 #$upload->slurp($uploaded_file);
 #$upload->link($uploaded_photo_name) or
#  die sprintf "link from '%s' failed: $!", $upload->tempname;
 
Server Info

Apache/2.0.55 (Ubuntu) PHP/5.1.6 mod_apreq2-20051231/2.5.7 mod_perl/2.0.2 
Perl/v5.8.8 configured
 
TIA






RE: Apache2::Upload and End of file found error Part 2

2006-12-07 Thread cfaust-dougot
Thanks for the tips Fred, but I don't understand what you mean about the CGI 
object being shared between requests - that CGI object wasn't global or 
anything, its created and used within that sub and that's it??
 
I don't know if I can remove the use of CGI.pm completely, is there no way to 
get them to work together??
 
Thanks
-Chris



From: Fred Moyer [mailto:[EMAIL PROTECTED]
Sent: Thu 12/7/2006 2:33 AM
To: cfaust-dougot
Cc: modperl@perl.apache.org
Subject: Re: Apache2::Upload and End of file found error Part 2



cfaust-dougot wrote:
> Folks,
> 
> I'm still trying to figure out what to do about this upload problem.. I've 
> figured out that somehow creating a new CGI object is causing the problem but 
> I have no idea how or what to do.
> 
> Below is a bare bone test upload script, if you comment out the "my $CGI = 
> new CGI();" in the sub "init_global_vals" then the update works fine, if its 
> uncommented then the server error of "End of file found" happens.
> 
> http://208.3.90.212/test.pm.txt
> 
> I have no idea how one relates to the other, any ideas?

I'm not sure why you would want a CGI object shared between requests but
my guess is that it's doing something strange as a result and I can't
see any advantage to that approach.  If you don't have that $CGI object
around and it works fine that might be telling you that it's causing
trouble and not helping.

A few other comments that might keep you from running into other problems:

1) 'perldoc vars' - use 'our' in favor of 'use vars'

2) don't use global variables unless you really need them and they serve
a useful purpose ($template_header and $template_footer globals are ok
since they are stateless, $CGI objects are not)

3) try the latest version of libapreq, 2.08.  I don't think it will fix
your existing problem (which the $CGI seems to be the root of), but
there have been a number of bug fixes since the release you're using.

4) Take a look at Apache::DBI instead of keeping $db in a global -
$db = ISMH::ConnectDBUser->connect_to_db();

HTH  - I think the simple issue to fix your problem is don't use a
global $CGI object FWIW

> 
> Thanks
> -Chris
>
> ____
>
> From: cfaust-dougot [mailto:[EMAIL PROTECTED]
> Sent: Tue 12/5/2006 1:28 PM
> To: modperl@perl.apache.org
> Subject: Apache2::Upload and End of file found error
>
>
> Hi,
> 
> I'm trying to use Apache2::Upload as shown in the examples and the only thing 
> I get is "End of file found" in the error log.
> 
> I've found quite a few messages on the subject, but I'm not using Mason and 
> I'm using libapreq2.0.7.1.
> 
> I've tried the fh and slurp methods and both are the same.
> 
> Code I've been playing with
> 
>  my $req = Apache2::Request->new($r);
>  my $upload = $req->upload('new_image');
>  my $size = $upload->size;
>  my $uploaded_file = $upload->fh;
>  #$upload->slurp($uploaded_file);
>  #$upload->link($uploaded_photo_name) or
> #  die sprintf "link from '%s' failed: $!", $upload->tempname;
> 
> Server Info
> Apache/2.0.55 (Ubuntu) PHP/5.1.6 mod_apreq2-20051231/2.5.7 mod_perl/2.0.2 
> Perl/v5.8.8 configured
> 
> TIA
>





Re: Apache2::Upload and End of file found error Part 2

2006-12-07 Thread Fred Moyer

cfaust-dougot wrote:

Thanks for the tips Fred, but I don't understand what you mean about the CGI 
object being shared between requests - that CGI object wasn't global or 
anything, its created and used within that sub and that's it??


Argh you're right - since it was created in the global hash I thought it 
was part of the globals and didn't look closely enough.  You don't need 
it if you're using Apache::Request though.  You can use Apache::Request 
_or_ CGI, you don't need to use both at the same time.


 
I don't know if I can remove the use of CGI.pm completely, is there no way to get them to work together??
 
Thanks

-Chris



From: Fred Moyer [mailto:[EMAIL PROTECTED]
Sent: Thu 12/7/2006 2:33 AM
To: cfaust-dougot
Cc: modperl@perl.apache.org
Subject: Re: Apache2::Upload and End of file found error Part 2



cfaust-dougot wrote:

Folks,

I'm still trying to figure out what to do about this upload problem.. I've 
figured out that somehow creating a new CGI object is causing the problem but I 
have no idea how or what to do.

Below is a bare bone test upload script, if you comment out the "my $CGI = new CGI();" in the sub 
"init_global_vals" then the update works fine, if its uncommented then the server error of 
"End of file found" happens.

http://208.3.90.212/test.pm.txt

I have no idea how one relates to the other, any ideas?


I'm not sure why you would want a CGI object shared between requests but
my guess is that it's doing something strange as a result and I can't
see any advantage to that approach.  If you don't have that $CGI object
around and it works fine that might be telling you that it's causing
trouble and not helping.

A few other comments that might keep you from running into other problems:

1) 'perldoc vars' - use 'our' in favor of 'use vars'

2) don't use global variables unless you really need them and they serve
a useful purpose ($template_header and $template_footer globals are ok
since they are stateless, $CGI objects are not)

3) try the latest version of libapreq, 2.08.  I don't think it will fix
your existing problem (which the $CGI seems to be the root of), but
there have been a number of bug fixes since the release you're using.

4) Take a look at Apache::DBI instead of keeping $db in a global -
$db = ISMH::ConnectDBUser->connect_to_db();

HTH  - I think the simple issue to fix your problem is don't use a
global $CGI object FWIW


Thanks
-Chris

________________

From: cfaust-dougot [mailto:[EMAIL PROTECTED]
Sent: Tue 12/5/2006 1:28 PM
To: modperl@perl.apache.org
Subject: Apache2::Upload and End of file found error


Hi,

I'm trying to use Apache2::Upload as shown in the examples and the only thing I get is 
"End of file found" in the error log.

I've found quite a few messages on the subject, but I'm not using Mason and I'm 
using libapreq2.0.7.1.

I've tried the fh and slurp methods and both are the same.

Code I've been playing with

 my $req = Apache2::Request->new($r);
 my $upload = $req->upload('new_image');
 my $size = $upload->size;
 my $uploaded_file = $upload->fh;
 #$upload->slurp($uploaded_file);
 #$upload->link($uploaded_photo_name) or
#  die sprintf "link from '%s' failed: $!", $upload->tempname;

Server Info
Apache/2.0.55 (Ubuntu) PHP/5.1.6 mod_apreq2-20051231/2.5.7 mod_perl/2.0.2 
Perl/v5.8.8 configured

TIA










RE: Apache2::Upload and End of file found error Part 2

2006-12-08 Thread cfaust-dougot
>>Argh you're right - since it was created in the global hash I thought it
>>was part of the globals and didn't look closely enough. 
Yep, I was just making sure.. That makes it even more of a mystery though, 
don't you think?
Since then I went though created a new CGI object within that sub whenever I've 
needed it, and it seems to work. The problem only appears to happen if a new 
CGI object is created within the handler or within a sub that is called from 
the handler and it only effects upload?? Bizzare, but I'm trying to move 
on..
 
>>You don't need it if you're using Apache::Request though.  You can use 
>>Apache::Request_or_ CGI, you don't need to use >>both at the same time.
I'm giving that a shot now, If I can get Apache2::Cookie to work right and find 
some way to duplicate CGI.pm's "escape" and "unescape" methods I won't need 
CGI.pm at all..
 
Thanks! 

> 
>
> From: Fred Moyer [mailto:[EMAIL PROTECTED]
> Sent: Thu 12/7/2006 2:33 AM
> To: cfaust-dougot
> Cc: modperl@perl.apache.org
> Subject: Re: Apache2::Upload and End of file found error Part 2
>
>
>
> cfaust-dougot wrote:
>> Folks,
>>
>> I'm still trying to figure out what to do about this upload problem.. I've 
>> figured out that somehow creating a new CGI object is causing the problem 
>> but I have no idea how or what to do.
>>
>> Below is a bare bone test upload script, if you comment out the "my $CGI = 
>> new CGI();" in the sub "init_global_vals" then the update works fine, if its 
>> uncommented then the server error of "End of file found" happens.
>>
>> http://208.3.90.212/test.pm.txt
>>
>> I have no idea how one relates to the other, any ideas?
>
> I'm not sure why you would want a CGI object shared between requests but
> my guess is that it's doing something strange as a result and I can't
> see any advantage to that approach.  If you don't have that $CGI object
> around and it works fine that might be telling you that it's causing
> trouble and not helping.
>
> A few other comments that might keep you from running into other problems:
>
> 1) 'perldoc vars' - use 'our' in favor of 'use vars'
>
> 2) don't use global variables unless you really need them and they serve
> a useful purpose ($template_header and $template_footer globals are ok
> since they are stateless, $CGI objects are not)
>
> 3) try the latest version of libapreq, 2.08.  I don't think it will fix
> your existing problem (which the $CGI seems to be the root of), but
> there have been a number of bug fixes since the release you're using.
>
> 4) Take a look at Apache::DBI instead of keeping $db in a global -
> $db = ISMH::ConnectDBUser->connect_to_db();
>
> HTH  - I think the simple issue to fix your problem is don't use a
> global $CGI object FWIW
>
>> Thanks
>> -Chris
>>
>> 
>>
>> From: cfaust-dougot [mailto:[EMAIL PROTECTED]
>> Sent: Tue 12/5/2006 1:28 PM
>> To: modperl@perl.apache.org
>> Subject: Apache2::Upload and End of file found error
>>
>>
>> Hi,
>>
>> I'm trying to use Apache2::Upload as shown in the examples and the only 
>> thing I get is "End of file found" in the error log.
>>
>> I've found quite a few messages on the subject, but I'm not using Mason and 
>> I'm using libapreq2.0.7.1.
>>
>> I've tried the fh and slurp methods and both are the same.
>>
>> Code I've been playing with
>>
>>  my $req = Apache2::Request->new($r);
>>  my $upload = $req->upload('new_image');
>>  my $size = $upload->size;
>>  my $uploaded_file = $upload->fh;
>>  #$upload->slurp($uploaded_file);
>>  #$upload->link($uploaded_photo_name) or
>> #  die sprintf "link from '%s' failed: $!", $upload->tempname;
>>
>> Server Info
>> Apache/2.0.55 (Ubuntu) PHP/5.1.6 mod_apreq2-20051231/2.5.7 mod_perl/2.0.2 
>> Perl/v5.8.8 configured
>>
>> TIA
>>
>
>
>
>




Re: Apache2::Upload and End of file found error Part 2

2006-12-08 Thread Perrin Harkins

cfaust-dougot wrote:

 >>Argh you're right - since it was created in the global hash I thought it
 >>was part of the globals and didn't look closely enough. 
Yep, I was just making sure.. That makes it even more of a mystery 
though, don't you think?


Well, although the CGI object is not a global, you are keeping the HTTP 
data in a global, %form_data.


Since then I went though created a new CGI object within that sub 
whenever I've needed it, and it seems to work. The problem only appears 
to happen if a new CGI object is created within the handler or within a 
sub that is called from the handler and it only effects upload?? 
Bizzare, but I'm trying to move on..


This is probably because CGI.pm is reading all the form input and not 
leaving it for Apache2::Request to read.


 >>You don't need it if you're using Apache::Request though.  You can 
use Apache::Request_or_ CGI, you don't need to use >>both at the same time.
I'm giving that a shot now, If I can get Apache2::Cookie to work right 
and find some way to duplicate CGI.pm's "escape" and "unescape" methods 
I won't need CGI.pm at all..


See the docs for porting escape_uri and escape_html from mod_perl 1 here:
http://perl.apache.org/docs/2.0/user/porting/compat.html

- Perrin