RE: FreeBSD Apache/mod_perl/OpenSRS/expat problem + solution

2002-06-09 Thread Mike Melillo


I came across the same problem while trying to install a bunch of XML
modules via the CPAN module.  It was pretty frustrating when the module
installations kept dying when it got to expat, even after a installed
the expat port time and time again.  I think I solved the problem
similarly to the way you did, either that or I just decided I didn't
need the XML modules installed.

Mike 

-Original Message-
From: Bill O'Hanlon [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, June 09, 2002 10:31 AM
To: [EMAIL PROTECTED]
Subject: FreeBSD Apache/mod_perl/OpenSRS/expat problem + solution


Hi folks,

I just ran down a problem that was somewhat hard to find, and I didn't
see any
mention of anything like it in the archives anywhere.  I thought it
might be
helpful to mention the details in case someone else is ever in the same
situation. 

I'm running FreeBSD 4.5, with perl 5.6.1 and Apache 1.3.24.  I had a
working
installation of the regular OpenSRS perl code via cgi-bin, but I thought
I'd
get it running under Apache::Registry in mod_perl.  To my surprise, the
Apache
daemons would dump core whenever I tried to log in with manage.cgi.

It turns out that the current FreeBSD port of Apache uses it's own
internal
version of expat, which is an XML library of some kind.  This internal
version doesn't connect up well with the version that XML::Parser is
expecting
to find.  Turning this off in the Apache build fixed the problem, and
the
OpenSRS code runs very nicely under mod_perl now.  At this point, I
don't
understand what functionality I've lost by not having the expat code
built into
the Apache binary.

The configure option to leave out expat is --disable-rule=EXPAT.  In
the
FreeBSD port, that's easily added to the CONFIGURE_ARGS variable in the
Makefile.

I don't know if this applies to any other platform.  My guess is that it
could,
since I think the default for Apache is to use the internal version of
expat.

Hope this helps someone!

-Bill

--
Bill O'Hanlon
[EMAIL PROTECTED]
Professional Network Services, Inc.
612-379-3958
http://www.pro-ns.net




Image::Size, TT, and mod_perl Question

2002-05-21 Thread Mike Melillo



I posed this question to the Template Toolkit list and got no response,
so I figured I'd give this list a shot...


-

Hello, below is some code I have in a mod_perl handler that checks to
see if an uploaded image is less than 300 pixels tall or wide.
Everything seems to be working except the fact that the template is not
returning with the proper values processed.  Below is the code and the
err_log output when I output an image that is too wide.


[snip] 
my $upload = $r-upload;
my $type= $upload-type;
my $fh  = $upload-fh;
my $username= $r-param('username');


my ($x, $y) = imgsize($fh);
print STDERR Dumper($x);
print STDERR Dumper($y);

unless ($x  300) {
print STDERR the greater than works\n;
 # This checks to make sure the image isnt more than 300 x 300
 my %vars = {TOO_WIDE = 1};
 my $config = {
INCLUDE_PATH = '/moc/html/templates',
POST_CHOMP = 1,
EVAL_PERL = 1,
 };

 my $template = Template-new($config) || die New Template Failed:
$!\n;

#the process method prints the template out to the browser via
$r
$template-process('pic_upload.tt2', \%vars, $r) || do {
  $r-log_reason($template-error());
  return SERVER_ERROR;
};
return OK;

} # end of X/Y coordinate if

[snip]

The err_log output:

$VAR1 = 310;
$VAR1 = 72;
the greater than works

[end of err_log]

The problem is the template pic_upload.tt2 has this in it:

[% IF TOO_WIDE %]
font color=redYour File was too big.  Make it under 30K/fontp [%
END %]

But that isn't showing up.  I do the almost identical thing immediately
after this if clauses to check if the file's type is a jpeg.  That
works, so I don't understand what I pasted in wrong, or forgot to paste
in.

Mike







undef Upload object

2002-05-20 Thread Mike Melillo


I am trying to have a user upload an image and I am getting an undef
$apr-upload object.

Here is the code:


form method=post ENCTYPE=multipart/form-data action=/join
input type=hidden name=action value=upload
br
your picture (size limit: 30k)br
input type=file name=userpic size=20
p
input type=submit name=submit value=ADD PROFILE
/form




sub upload {

my ($r) = shift;
my $apr = Apache::Request-new($r);
my $status = $apr-parse;
my $upload = $apr-upload; 
print STDERR Dumper($upload);
my $size = $upload-size;
if ($size  3) {
   #file is too big
   warn(File is too big\n);   
   return SERVER_ERROR;
}  

my $type = $upload-type;
if ($type ne 'image/jpeg') {
   # not a jpeg
   warn(Not a jpeg\n);
   return SERVER_ERROR;
}
my $fh = $upload-fh;
my $filename = $upload-filename;

 $apr-send_http_header( 'text/html' );
$apr-print(hello file\n);
return OK;

} # end of upload


The upload subroutine is still in the debugging stages hence the return
SERVER_ERROR and warn'ings.The Date::Dumper prints $VAR1 = undef;

Ideas?




$r-args vs $r-content

2002-05-14 Thread Mike Melillo














Ok, I've switched to A::Request,
but it still seems my parameters table is empty. I'll paste in the form data,
as well as some code snippets to see if that helps find the bug.



form
method=post ENCTYPE=multipart/form-data
action=/join input type=hidden name=action value=submit



usernamebr

input type=text size=30 maxlength=255
name=username value=[% username %] p



passwordbr

input type=password
size=30 maxlength=20 name=password value=[% password%]



input type=submit
name=submit value=ADD PROFILE



/form



**End HTML Template**



** Join.pm **



sub submit {

 my $DEBUG = 1;

 my ($r) = shift;

 my $apr = Apache::Request-new($r);

 my $status = $apr-parse;

 my @param = $apr-param;

 $DEBUG 
print STDERR Dumper($apr-parms)

 $DEBUG 
print STDERR Dumper(@param);



...

}





The first Data::Dumper print
statement sends this to the errlog - 

$VAR1 = bless( {}, 'Apache::Table'
);



The second print statement
prints nothing.



I looked at perldoc Apache::Request,
but didnt see anything wrong...



Help?



Mike







-Original Message-

From: Issac Goldstand [mailto:[EMAIL PROTECTED]] 

Sent: Tuesday, May 14, 2002
4:39 AM

To: Mike Melillo

Cc: [EMAIL PROTECTED]

Subject: Re: $r-args vs
$r-content



Quoting Mike Melillo
[EMAIL PROTECTED]:



 

 Hi,

 



 One of the fields is an
image file that will be uploaded so I need to 

 use POST requests. Is
this a job for Apache::Request? The eagle book 

 doesn't cover it much
because it was experimental at the time of 

 publishing.

 

There's a version 1.0 out by
now. That means stable as it's ever gonna get :-) I use it all the time, go
for it!



 Issac





Internet is a wonderful
mechanism for making a fool of

yourself in front of a very
large audience.

 --Anonymous



Moving the mouse won\'t get
you into trouble... Clicking it might.

 --Anonymous



PGP Key 0xE0FA561B -
Fingerprint:

7E18 C018 D623 A57B 7F37
D902 8C84 7675 E0FA 561B












$r-args vs $r-content

2002-05-13 Thread Mike Melillo


Hi,

I'm having issues processing user input via POST requests.  I have a
simple form page, that when you click submit I just want to redisplay
the page but with the values filled in. If I do a GET request and do
%params = $r-args;

It works, but if I use the method in the eagle book for POST requests
%params = $r-content; then nothing gets returned.  I've even printed
%params to the apache errlog with DataDumper, and its empty.  

One of the fields is an image file that will be uploaded so I need to
use POST requests.  Is this a job for Apache::Request?  The eagle book
doesn't cover it much because it was experimental at the time of
publishing.

Thanks,

Mike




RE: $r-args vs $r-content

2002-05-13 Thread Mike Melillo


No, It specifies multipart/form-data because page 131 of the eagle says
its used for file uploads.

Mike 

-Original Message-
From: Todd Finney [mailto:[EMAIL PROTECTED]] 
Sent: Monday, May 13, 2002 11:16 PM
To: [EMAIL PROTECTED]
Subject: Re: $r-args vs $r-content

At 10:29 PM 5/13/02, Mike Melillo wrote:
It works, but if I use the method in the eagle book for POST requests
%params = $r-content; then nothing gets returned.  I've even printed
%params to the apache errlog with DataDumper, and its empty.

One of the fields is an image file that will be uploaded so I need to
use POST requests.  Is this a job for Apache::Request?  The eagle book
doesn't cover it much because it was experimental at the time of
publishing.

Does your FORM tag specify enctype=application/x-www-urlencoded?

cheers,
Todd




File does not exist/Location error

2002-04-28 Thread Mike Melillo








[Sun Apr 28 18:05:42 2002] [error] [client 192.168.1.100]
File does not exist: /moc/ticketLogin



There is the Apache errlog entry for the request I am
making. I am just trying to do the TicketTool, etc example from Chapter 6
of the Eagle mod_perl book but I am getting that error.



Here are my httpd.conf entries:



Location /members

PerlAccessHandler Apache::TicketAccess

PerlSetVar
TicketDomain .not_really_the_domain.com

PerlSetVar
TicketSecret http://not_really_the_domain.com/secrets.txt

ErrorDocument
403 http://www. not_really_the_domain.com/ticketLogin

/Location



Location /ticketLogin

SetHandler perl-script

PerlAccessHandler Apache::TicketMaster

PerlSetVar
TicketDomain . not_really_the_domain.com

PerlSetVar
TicketSecret http://www. not_really_the_domain.com/secrets.txt

PerlSetVar
TicketDatabase mysql:table

PerlSetVar
TickerTable user:user_nm:password

PerlSetVar
TicketExpires 10

/Location





Any ideas why Apache woulnt recognize the Location
Tag and look for the file instead?



Thanks,





Mike Melillo