Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File uploads with Mason/mod_perl

Status
Not open for further replies.

philote

MIS
Joined
Oct 2, 2003
Messages
861
Location
US
I just started using HTML::Mason with mod_perl to build cgi apps, but am having a problem getting file uploads to work. From what I read, I need to get the Apache::Upload object from the Apache::Request object. Then I can get then filename and file handle from the upload object.

My problem lies in this line:
Code:
my $upload = $r->upload
The error I get is:
Can't locate object method "upload" via package "Apache::RequestRec"
What is Apache::RequestRec, and isn't $r supposed to be the Apache::Request object? And am I even going about this the right way?


 
The error is because you don't have the proper module installed.

Use CPAN and install the Apache::RequestRec and you should be fine.

M. Brooks
X Concepts LLC
 
I have the Apache::RequestRec module already. The problem is, $r should be a Request object, not a RequestRec object. Or at least that was my understanding. Request has the upload subroutine whereas RequestRec does not.

I can only guess that I have something misconfigured. But I checked all the docs and everything seems ok. According to :

If you used the Apache::Request module to processing incoming arguments, which is Mason's default, then $r will actually be an Apache::Request object.


As far as I know, I didn't change this default.

When I get a chance, I'll post the relevant lines from my httpd.conf file.
 
Dummy me, I don't have the Apache::Request module. But when I try to install it via CPAN I get an error saying my version of mod_perl is too high. I'm running mod_perl 2 (actually 1.99_07). Is there another Apache::Request I need to get, and if so, where is it?

 
Well, I found libapreq2-2.02-dev and tried to install it. Once I finally got all the prerequisites for it installed I tried to install it but it bombed. It needs Apache version 2.0.46 or greater and I have 2.0.40! After all this, I really don't feel like bothering to upgrade Apache, especially since this version of libapreq is a development version.

Does anyone know if there's another way to perform file uploads without having Apache::Request? And would Apache::Reqeust really have helped?

 
That's what I was using. Then I decided to try Mason and found out I wouldn't need CGI.pm (or so I thought).
Thanks anyway.

 
Thanks, that looks pretty handy. But I think Mason fits my needs better right now.

 
Ok, I got my problem resolved for anyone who's interested. I had to do what I didn't want to do, but I learned a lot from it. I installed a newer version of Apache from source. I also reinstalled mod_ perl and finally got Apache::Request going. I also reinstalled Mason since I was on a roll. It's been an interesting day!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top