Apache::Reload
Hello, I'm having a problem with Apache::Reload and I'm not sure what I can do to debug. Long story short, I use Apache::Reload all the time but I recently setup a new development server and its under the new machine that its a problem. The module is installed and when I add to my conf: PerlInitHandler Apache::Reload PerlSetVar ReloadAll Off I can restart apache and everything loads up (apache starts and will serve static pages etc). The problem happens as soon as you invoke a mod_perl content handler. The first time you hit a script URL you get a 500 internal server error, but as soon as you comment out those 2 lines everything works (except apache reload of course). What is killing me is there is NOTHING logged!!! The apache log and domain logs show nothing. This server is a WHM/CPANEL server and I'm wondering if that has anything to do with it? I don't know if its just a coincidence, but on every non-cpanel machine I have ever seen has apache reload, but on the cpanel machines its apache graceful. I wouldn't think that should matter but the timing is there because the module does load via the conf but the first time you invoke a mod_perl content handler, Apache::Reload should be tell apache to reload its configs and that's when you get the 500 error. My install is old because I'm trying to stay within the available repositores instead of building from source, I guess I could update but I don't know if that's going to solved my problem. CentOS 5.8 Apache/2.2.22 (Unix) mod_apreq2-20090110/2.8.0 mod_perl/2.0.5 Perl/v5.8.8 Any ideas of how I can debug this? I can't believe that apache is throwing a 500 error and no information about it is being logged, that at least might tell me something. TIA! -Chris
RE: Content-Disposition
I'm all set, I had to use err_headers_out for some reason so, $r-err_headers_out-add('Content-Disposition' = 'attachment; filename=' . $download_name . ''); Works. -Chris From: cfaust-dougot [mailto:cfa...@doyougot.com] Sent: Sun 1/22/2012 6:20 AM To: Earle Ake; modperl@perl.apache.org Subject: RE: Content-Disposition Thanks for the reply Earle, I actually did try both attachment and inline and neither worked (I should have said that in the org post). -Chris From: Earle Ake [mailto:e...@woh.rr.com] Sent: Sat 1/21/2012 9:19 PM To: cfaust-dougot; modperl@perl.apache.org Subject: RE: Content-Disposition I have done it before using something like: print Content-Disposition:attachment;filename=$download_name\n; So maybe try: $r-header_out( 'Content-Disposition' = 'attachment; filename=' . $download_name . ''); From: cfaust-dougot [mailto:cfa...@doyougot.com] Sent: Saturday, January 21, 2012 7:02 PM To: modperl@perl.apache.org Subject: Content-Disposition Hello, I'm guessing there is a real simple answer to my question but as uasual, I can't find it :) Simply put I'm trying to create a Zip file and push it to the user using a filename I've defined. Everything works except the name of the file that comes up in the browser dialog. It always defaults to the script/location name. I thought that all I needed was Content-Disposition but that doesn't seem to be working. CentOS 5.5, mod_perl 2.0.4, apache 2.2.3 (both mod_perl and apache should be backported via yum update). my $zip = Archive::Zip-new(); my $member = $zip-addString('yadda yadda yadda'); my $download_name = 'download.zip'; if ( $zip-writeToFileNamed('someothernamed.zip'); open(ZIP, 'someothernamed.zip') or die could not open sonz $!; binmode ZIP; my $output = do { local $/; ZIP }; close(ZIP); $r-content_type('application/zip'); $r-header_out( 'Content-Disposition' = 'inline; filename=' . $download_name . ''); $r-send_http_header; print $output; return Apache2::Const::OK; } I tried setting the header before the content_type and with and without send_http_header. What am I doing wrong? How can I get the user to be prompted to save the file as download.zip?? TIA!
Same script with different locations
Folks, I wanted to know if there was anything wrong with using the same MP2 content handler with multiple Location directives in apache and using $r-location() to determine the script that should be used in forms, redirects etc. We have someone that insists in having different URL's doing something pretty specific while 75% of everything else is share (auth, profiles etc). It seems to work fine, whatever URL you come in on you will stay on, but there is just something about doing it that made me want to ask. TIA!
RE: [ot] Perl Survey
Closed now, just missed it :( From: Fred Moyer [mailto:f...@redhotpenguin.com] Sent: Wed 6/2/2010 12:45 PM To: mod_perl list Subject: [ot] Perl Survey I just read that the Perl Survey will be closing in 24 hours so if you get this I'd encourage you to fill it out. I guess it has only been up for a little over a week, but they've gotten ~3k responses and are closing it off tomorrow. http://survey.perlfoundation.org/
RE: Is this an acceptable way to multipurpose a sub?
I'm sure someone where will pipe in a better way, but you could pass via a hash, something like ($result_code, $error) = submit_changes({ 'apache_request' = $r, 'user_name' = \...@user_names, 'latest_news' = $latest_news_file, 'archived_news' =$archived_news_file, 'cgi_obj' =$q); sub submit_changes { my $hash_ref = @_; # $hash_ref-{'apache_request'} is $r # $hash_ref-{'user_name' } is the user arrayref # $hash_ref-{'archived_news' } may or may not be defined if it was passed in.. etc. } -Chris From: Chris Bennett [mailto:ch...@bennettconstruction.biz] Sent: Mon 4/26/2010 4:12 PM To: mod_perl list Subject: Is this an acceptable way to multipurpose a sub? I am combining into my module, subs for two scripts doing very similar, yet a little different functions. Many subs can be used by both unchanged. Some are almost right except for the arguments One script works on two output files at once, the other, just one. So I did this and it seems to work perfectly. Is this an OK way to accomplish this? ($result_code, $error) = submit_changes($r, \...@user_names, $latest_news_file, $archived_news_file, $q); ($result_code, $error) = submit_changes($r, \...@user_names, $site_directory/$article_directory/$article_file, undef, $q); ### ## sub submit_changes sub submit_changes { my $r = shift; my $usernames_aref = shift; my $latest_news_file = shift; my $archived_news_file = shift; my $q = shift; my $body = shift || ''; my $sent_username = $q-param(username) || ''; my $sent_password = $q-param(password) || ''; my $can_pass = 0; foreach my $user_w_pass (@$usernames_aref) { if ($user_w_pass eq $sent_username:$sent_password) { $can_pass = 1; #last; } } unless ($can_pass) { return(0, pbUsername or Password unsuccessful/b/p); } my $textfile1 = $q-param(filetext1) || ''; my $textfile2 = $q-param(filetext2) || ''; open (OUTFILE, , $latest_news_file) || die(unable to open $latest_news_file $!); print OUTFILE $textfile1; print OUTFILE $body; close (OUTFILE); if (defined $archived_news_file) { open (OUTFILE2, , $archived_news_file) || die(unable to open $archived_news_file $!); print OUTFILE2 $textfile2; close (OUTFILE2); } return(1, pChanges Successful/p); } -- A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects. -- Robert Heinlein
RE: Apache Blank Pages
Thanks Perrin, Long story short, I'm in the process of moving to another machine. I wanted to ask you though, is there any modules I should stay away from loading in startup.pl? Should DBI and DBD be loaded within each script and not within startup? I've always been under the impression that if it was a module that I was going to be using in the majority of my scripts then I should put it in startup. Was that thinking wrong? TIA!!! From: Perrin Harkins [mailto:phark...@gmail.com] Sent: Thu 1/14/2010 4:30 PM To: cfaust-dougot Cc: modperl@perl.apache.org Subject: Re: Apache Blank Pages On Wed, Jan 13, 2010 at 5:52 PM, cfaust-dougot cfa...@doyougot.com wrote: Below is what I currently call in startup, by any chance does anything pop out at you? Nope, those all look fine to me. Other wise I'll start going though them one at a time. A binary search is good for this sort of thing. - Perrin
RE: Apache Blank Pages
It's prefork Apache/2.2.3 (Debian) PHP/4.4.4-8+etch6 mod_apreq2-20051231/2.6.0 mod_perl/2.0.2 Perl/v5.8.8 I've isolated the problem, you guys will say I'm crazy but I can reproduce the results over and over again. If I try to connect to a DB in that 2nd virtual host I have the problem. If I make no connection then there is no problem. Also if I connect to the same DB that the 1st virtual host does, then there is no problem. It's only when I try to connect to another DB that the problem comes into play. That makes no sense to me, but I've been able to reproduce it 8 different times without fail. This problem started when I updated DBI and DBD:mysql to the latest version, although I can't see where the conflict is as I have the latest versions running on other machines without any issues. It's really bizarre!! From: ??? [mailto:chen...@maxthon.net] Sent: Wed 1/13/2010 7:08 AM To: cfaust-dougot Cc: modperl@perl.apache.org Subject: Re: Apache Blank Pages what is your apache's mpm? worker or prefork? Our site sometimes also rise similar error(like glibc detected ... in error log ) under worker mpm. ??? | ChenJianchun ??Web??? E-mail: chen...@maxthon.net Maxthon® --?! ???! ??(??) http://www.maxthon.cn/ | www.maxthon.cn http://www.maxthon.cn/ ???! cfaust-dougot ??: Hello, I have a bizarre problem I'm hoping someone could give me some suggestions with. I have a couple of MP2 scripts running on a server, they are both similar in use of modules and structure. Without any recent changes, one of the scripts is producing a blank apache page on SOME requests. It's not always the same function, it can happen to any of the function calls contained in the script. When the blank page happens there is nothing in either the access log or the error log of that virtual host (like the request never made it that far). In the default error log I will get something like [notice] child pid 11497 exit signal Aborted (6) Sometimes (but not always), I'll see *** glibc detected *** malloc(): memory corruption: 0x09c120f8 *** There is also no consistency to the blank page, sometimes you hit the URL and you get the content, sometimes you get a blank page, sometimes 1 refresh on the blank page gives you content, other times it can take 3 - 7 refreshes before the content comes. I've been trying to pull apart my script piece by piece in the hopes that I could at least narrow it down to some specific section but I'm not having a lot of luck. Any thoughts on how I could debug this better? TIA!
RE: Apache Blank Pages
It's prefork Apache/2.2.3 (Debian) PHP/4.4.4-8+etch6 mod_apreq2-20051231/2.6.0 mod_perl/2.0.2 Perl/v5.8.8 I've isolated the problem, you guys will say I'm crazy but I can reproduce the results over and over again. If I try to connect to a DB in that 2nd virtual host I have the problem. If I make no connection then there is no problem. Also if I connect to the same DB that the 1st virtual host does, then there is no problem. It's only when I try to connect to another DB that the problem comes into play. That makes no sense to me, but I've been able to reproduce it 8 different times without fail. This problem started when I updated DBI and DBD:mysql to the latest version, although I can't see where the conflict is as I have the latest versions running on other machines without any issues. It's really bizarre!! From: ??? [mailto:chen...@maxthon.net] Sent: Wed 1/13/2010 7:08 AM To: cfaust-dougot Cc: modperl@perl.apache.org Subject: Re: Apache Blank Pages what is your apache's mpm? worker or prefork? Our site sometimes also rise similar error(like glibc detected ... in error log ) under worker mpm. ??? | ChenJianchun ??Web??? E-mail: chen...@maxthon.net Maxthon® --?! ???! ??(??) http://www.maxthon.cn/ | www.maxthon.cn http://www.maxthon.cn/ ???! cfaust-dougot ??: Hello, I have a bizarre problem I'm hoping someone could give me some suggestions with. I have a couple of MP2 scripts running on a server, they are both similar in use of modules and structure. Without any recent changes, one of the scripts is producing a blank apache page on SOME requests. It's not always the same function, it can happen to any of the function calls contained in the script. When the blank page happens there is nothing in either the access log or the error log of that virtual host (like the request never made it that far). In the default error log I will get something like [notice] child pid 11497 exit signal Aborted (6) Sometimes (but not always), I'll see *** glibc detected *** malloc(): memory corruption: 0x09c120f8 *** There is also no consistency to the blank page, sometimes you hit the URL and you get the content, sometimes you get a blank page, sometimes 1 refresh on the blank page gives you content, other times it can take 3 - 7 refreshes before the content comes. I've been trying to pull apart my script piece by piece in the hopes that I could at least narrow it down to some specific section but I'm not having a lot of luck. Any thoughts on how I could debug this better? TIA!
RE: Apache Blank Pages
Do you mean on apache startup? I'm not calling DBI or DBD in startup.pl. Any other module would be after the fork, wouldn't? Thanks!! From: Perrin Harkins [mailto:phark...@gmail.com] Sent: Wed 1/13/2010 12:07 PM To: cfaust-dougot Cc: ???; modperl@perl.apache.org Subject: Re: Apache Blank Pages On Wed, Jan 13, 2010 at 7:28 AM, cfaust-dougot cfa...@doyougot.com wrote: If I try to connect to a DB in that 2nd virtual host I have the problem. If I make no connection then there is no problem. Also if I connect to the same DB that the 1st virtual host does, then there is no problem. It's only when I try to connect to another DB that the problem comes into play. It's possible you are opening this handle during startup and trying to use it after the fork. That would result in the sort of failures you're seeing. - Perrin
RE: Apache Blank Pages
Ouch, that could get messy. Below is what I currently call in startup, by any chance does anything pop out at you? Other wise I'll start going though them one at a time. Thanks Perrin use ModPerl::MethodLookup; ModPerl::MethodLookup::preload_all_modules( ); use ModPerl::Util ( ); #for CORE::GLOBAL::exit use APR::Request (); use APR::Request::Apache2 (); use APR::Request::CGI (); use APR::Request::Cookie (); use APR::Request::Error (); use APR::Request::Hook (); use APR::Request::Param (); use APR::Request::Parser (); use APR::Table (); use Apache2::RequestRec; use Apache2::RequestIO; use Apache2::RequestUtil; use Apache2::Upload (); use Apache2::Request (); use Apache2::Cookie (); use Apache2::ServerUtil(); use Apache2::Connection(); use Apache2::Log(); use ModPerl::Registry(); use Apache2::Const -compile = ':common'; use Apache2::Const -compile = qw(OK); use Apache2::Const -compile = qw(REDIRECT); use MIME::Lite (); use MIME::Lite::HTML (); use HTML::Template (); use HTML::TagFilter (); use Data::Page (); use Data::Pageset (); use Image::Magick (); use Image::Magick::Thumbnail (); use Image::Magick::Thumbnail::Fixed (); From: Perrin Harkins [mailto:phark...@gmail.com] Sent: Wed 1/13/2010 5:36 PM To: cfaust-dougot Cc: modperl@perl.apache.org Subject: Re: Apache Blank Pages On Wed, Jan 13, 2010 at 5:31 PM, cfaust-dougot cfa...@doyougot.com wrote: Do you mean on apache startup? I'm not calling DBI or DBD in startup.pl. Any other module would be after the fork, wouldn't? Some modules (e.g. Class::DBI) will open a connection when you use them. If you're loading any modules at all in startup, there's a possibility that this could be the issue. - Perrin
Apache Blank Pages
Hello, I have a bizarre problem I'm hoping someone could give me some suggestions with. I have a couple of MP2 scripts running on a server, they are both similar in use of modules and structure. Without any recent changes, one of the scripts is producing a blank apache page on SOME requests. It's not always the same function, it can happen to any of the function calls contained in the script. When the blank page happens there is nothing in either the access log or the error log of that virtual host (like the request never made it that far). In the default error log I will get something like [notice] child pid 11497 exit signal Aborted (6) Sometimes (but not always), I'll see *** glibc detected *** malloc(): memory corruption: 0x09c120f8 *** There is also no consistency to the blank page, sometimes you hit the URL and you get the content, sometimes you get a blank page, sometimes 1 refresh on the blank page gives you content, other times it can take 3 - 7 refreshes before the content comes. I've been trying to pull apart my script piece by piece in the hopes that I could at least narrow it down to some specific section but I'm not having a lot of luck. Any thoughts on how I could debug this better? TIA!
RE: Apache Blank Pages
Thanks for the reply William, at first I thought the same thing but as time went on and this only effected 1 virtual host and not the other (and the other had 10x the traffic), I didn't seem like hardware or config related. I've gotten a little further since my last post, but it still doesn't make sense. If I take the DB connection out of the script, it doesn't happen. I've added and removed it a few times just because I couldn't belive it. The DB is on another machine and both virtual hosts call the same machine (each virtual is a different DB on the dedicated DB server). The only difference in the DB connection call between the 2 scripts is that virtual host 1 calls it via a custom package (as other scripts need the same DB) - this is the site that works. Virtual Host 2 makes the connection within sub handler and that's the one that doesn't work. No closer to a solution though - any method I try to use to connect to the DB from VH2 results in this problem. Still doesn't make a lot of sense. From: William T [mailto:dietbud...@gmail.com] Sent: Tue 1/12/2010 11:47 AM To: cfaust-dougot Cc: modperl@perl.apache.org Subject: Re: Apache Blank Pages It seems pretty clear the blank pages are from the apache children dieing badly (hence the errors). I would make an educated guess based on the malloc error that your ram is bad. Try running your app on a different box and see if you get the same errors. On Jan 12, 2010 7:19 AM, cfaust-dougot cfa...@doyougot.com wrote: Hello, I have a bizarre problem I'm hoping someone could give me some suggestions with. I have a couple of MP2 scripts running on a server, they are both similar in use of modules and structure. Without any recent changes, one of the scripts is producing a blank apache page on SOME requests. It's not always the same function, it can happen to any of the function calls contained in the script. When the blank page happens there is nothing in either the access log or the error log of that virtual host (like the request never made it that far). In the default error log I will get something like [notice] child pid 11497 exit signal Aborted (6) Sometimes (but not always), I'll see *** glibc detected *** malloc(): memory corruption: 0x09c120f8 *** There is also no consistency to the blank page, sometimes you hit the URL and you get the content, sometimes you get a blank page, sometimes 1 refresh on the blank page gives you content, other times it can take 3 - 7 refreshes before the content comes. I've been trying to pull apart my script piece by piece in the hopes that I could at least narrow it down to some specific section but I'm not having a lot of luck. Any thoughts on how I could debug this better? TIA!
$r-connection-remote_ip with proxy and non proxy env
Folks, I'm guessing this has been answered but I couldn't find it. We need to do some IP checking and need to support it on both a load balanced environment and in a dedicated machine setup. In the load balanced situation $r-connection-remote_ip returns 1 - Is that correct and consistent so I can use it to switch between how I get the IP address? In other words should I be doing something like if ($r-connection-remote_ip == 1) my $ip = $r-headers_in-{'X-Forwarded-For'} } else { my $ip = $r-connection-remote_ip; } Or is there a better way? TIA! -Chris
RE: Caching a hash - am I missing something?
Thanks Andre and Tyler. Believe it or not I never even thought of that until you guys pointed it out (that the hash would live for the the life of the apache child). I can be such a fool sometimes :) In this case I assume %cache is global - it only appers in that sub, there is no my %cache = () any place else in the pm file and there is no Use strict. I guess I'll just keep it the same way except I'll use strict and I'll declare my %cache = () outside that sub. Thanks Guys!! -Chris From: André Warnier [mailto:[EMAIL PROTECTED] Sent: Wed 8/20/2008 3:28 AM To: mod_perl list Cc: W. Tyler Gee Subject: Re: Caching a hash - am I missing something? W. Tyler Gee wrote: On Tue, Aug 19, 2008 at 5:35 PM, Chris Faust [EMAIL PROTECTED] wrote: Hi, This might be a little off topic, I hope it's OK to post. I'm not positive if mod_perl matters or not because it's a little confusing to me. I've taken over some pretty old code that I'm updating and making mp2 content handlers out of. The main script is a standard cgi script start.cgi there is nothing special in the apache conf for it. Directory /xxx/ SetHandler perl-script PerlFixupHandler My::Fixup PerlResponseHandler ModPerl::PerlRun PerlOptions +ParseHeaders DirectoryIndex start.cgi Options +ExecCGI +Indexes allow from all /Directory start.cgi calls a custom module (use CustomModule;) which exports a bunch of subs, for example foobar and all over the place in the subs that are exported from CustomModule I see code like sub foobar { my $key = @_; if ($cache{$key}) { return $cache{$key}; } else { my $do_some_query = ; $cache{$key} = $do_some_query_results return $cache{$key}; } } My question is isn't the else in foobar always going to be true anyplace where start.cgi is calling foobar('somekey')?? I don't understand how %cache could already be populate from a previous browser request or something? I'm I just missing something stupid? %cache is defined outside the scope of the sub so it will persist for the lifetime of the apache server. The very first time foobar('somekey') is called it will do the query lookup, the next time it will return from cache. I believe the above is almost, but not totally true. It should probably be for the lifetime of this particular apache child. Each apache child process has it's own copy of the above code, and it's own copy of the above global (*) %cache hash. Thus whether the first or second part of the if will run, depends of the previous history of the particular apache child which handles the current request. If this particular child has already previously accessed the same hash key, it will server it from (it's own) cache, and otherwise it will execute the query to create the key (in it's own cache). Apache children are created, and die, as directed by the main Apache process configuration, and HTTP requests are served more or less at random, by whichever child is available when the request comes in. Is is thus quite possible for instance that the first 10 requests for a particular hash key would each be handled by a different apache child, and would each result in a query; then the 11th request would be handled by a child that has already accessed this same key before, and thus served from cache; the 13th request would be handled by a brand-new apache child just created, thus would re-do the query, etc.. I this would be useful, I believe that it would be possible to avoid this, by priming the mod_perl module during the initial start of Apache, before it forks into children. Then each new child (being a copy of the main apache) would start it's life with a number of keys already in its cache. Of course this would work only if the contents of the keys of the hash are never modified while apache is running. And it probably involves some delicate mod_perl programming to do the priming process. (*) like the previous contributor, I guess that the %cache hash is somehow global, because it is not declared within the sub that you show. Whether it really is though, may depend on other code that we don't see here. But anyway, global would mean only global to this apache child, not to the whole apache server. And something that I don't know at all, is how this all works out with a threaded apache, such as under Windows e.g. André
RE: Cookie help - using both cgi.pm and APR::Request::Cookie
Hi Andre, That was is. Once I created the cookie value like my $cookie_value = qq|$val1$val2$val3.|; It worked! Now I just got to update everything so I don't need to do that anymore :) Thanks! -Chris From: André Warnier [mailto:[EMAIL PROTECTED] Sent: Wed 5/28/2008 6:27 AM To: cfaust-dougot Cc: modperl@perl.apache.org Subject: Re: Cookie help - using both cgi.pm and APR::Request::Cookie I don't guarantee that this is the real issue you're having, but be careful of the following : either of the Apache2::Request::Cookie or CGI::Cookie (don't remember which one) URL-encodes the cookie value by default, and the other one does not. Maybe you're getting caught by that. One of the modules above offers a raw_cookie method to get around this, but again I don't remember which one. cfaust-dougot wrote: Folks, I taking over some really old code and I'm in the process of converting it over to mp2. I want to be able to use APR::Request::Cookie to create the cookie for the new things I'm doing but I need to create it exactly like CGI.pm is currently doing so the old code will continue to work until I get everthing updated. I'm hoping someone knows both methods enough to tell me what I'm doing wrong. The CGI.pm cookie is being created like: $query-cookie(-name='name',-value=[val1,val2,val3,val4,val5,val6,val7],-expires='+5y',-domain=www.domain.com,-path=/); I do my cookies like: my $packed_cookie = APR::Request::Cookie-new($r-pool, name = 'name', value = $cookie_value, path = '/', domain = 'www.domain.com', expires = +5y, ); $r-err_headers_out-add('Set-Cookie' = $packed_cookie-as_string); For the value I made an array @cookie_value = ('val1','val2','val3','val4','val5',val6','val7'); In $packed_cookie I tried using @cookie_value directly, I tried it as an arrayref ($cookie_value), I tried it like [EMAIL PROTECTED] etc and not matter what I do I can't get the old code to read it via my ($val1,$val2,$val3,$val4,$val5,$val6,$val7) = $query-cookie(-name='name'); The cookie is getting set though, I can view it from within Mozilla. It just isn't being read by CGI.pm Does anyone know what I'm doing wrong? TIA!!
Cookie help - using both cgi.pm and APR::Request::Cookie
Folks, I taking over some really old code and I'm in the process of converting it over to mp2. I want to be able to use APR::Request::Cookie to create the cookie for the new things I'm doing but I need to create it exactly like CGI.pm is currently doing so the old code will continue to work until I get everthing updated. I'm hoping someone knows both methods enough to tell me what I'm doing wrong. The CGI.pm cookie is being created like: $query-cookie(-name='name',-value=[val1,val2,val3,val4,val5,val6,val7],-expires='+5y',-domain=www.domain.com,-path=/); I do my cookies like: my $packed_cookie = APR::Request::Cookie-new($r-pool, name = 'name', value = $cookie_value, path = '/', domain = 'www.domain.com', expires = +5y, ); $r-err_headers_out-add('Set-Cookie' = $packed_cookie-as_string); For the value I made an array @cookie_value = ('val1','val2','val3','val4','val5',val6','val7'); In $packed_cookie I tried using @cookie_value directly, I tried it as an arrayref ($cookie_value), I tried it like [EMAIL PROTECTED] etc and not matter what I do I can't get the old code to read it via my ($val1,$val2,$val3,$val4,$val5,$val6,$val7) = $query-cookie(-name='name'); The cookie is getting set though, I can view it from within Mozilla. It just isn't being read by CGI.pm Does anyone know what I'm doing wrong? TIA!!
Replacement for CGI.pm escape and unescape
Hi All, I'm running the latest mp2 with Libapreq. Is there some method to duplicate CGI.pm's escape and unescape methods? I found escape_path, but obviously that isn't the same thing. I'm trying to remove CGI.pm from all my code and these are the last 2 things I need to take care of. TIA! -Chris
RE: Replacement for CGI.pm escape and unescape
Yes, I'm trying to HTML escape/unescape, although looking at URI::Escape it seems like it might work. I'll have to give it a try. Thanks!! From: Michael Peters [mailto:[EMAIL PROTECTED] Sent: Thu 6/7/2007 10:32 AM To: Jonathan Vanasco Cc: cfaust-dougot; modperl@perl.apache.org Subject: Re: Replacement for CGI.pm escape and unescape Jonathan Vanasco wrote: I use URI::Escape http://search.cpan.org/~gaas/URI-1.35/URI/Escape.pm its small, and comes in the std perl distro Good for URI escaping, but that's not the same thing as HTML escaping, which is what CGI's escape/unescape do right? -- Michael Peters Developer Plus Three, LP
Help with Manual removal of libapreq2
Hi All, I'm trying to remove libapreq2 via make clean without a whole lot of success. Below is what I get back from make clean (and Request.so still exists afterwards) Any ideas? The long story is I decided to run the Ubuntu update to bring one of our dev servers up to date. Now I keep getting an error with Request.so and I'm thinking it might have something to do with the fact that I installed libapreq2 manually (as Ubuntu didn't have the lastest version at the time) and the update installed a latter version. So I'm trying to remove it all and reinstall the Ubuntu version, I've even gone as far as uninstall Apache2,mod_perl, libapreq etc from Ubuntu and then running the make clean, but Request.so is still in there. Ths is the error I get no matter what is installed or uninstalled, if that makes any difference Can't load '/usr/local/lib/perl/5.8.8/auto/APR/Request/Request.so' for module APR::Request: libaprutil-0.so.0: cannot open shared object file: No such file or directory at /usr/lib/perl/5.8/DynaLoader.pm line 225 TIA -Chris Output from make clean Making clean in glue make[1]: Entering directory `/home/analog/libapreq2-2.08/glue' rm -rf .libs _libs cd perl; make clean make[2]: Entering directory `/home/analog/libapreq2-2.08/glue/perl' make[2]: *** No rule to make target `clean'. Stop. make[2]: Leaving directory `/home/analog/libapreq2-2.08/glue/perl' make[1]: [perl_clean] Error 2 (ignored) rm -f *.lo make[1]: Leaving directory `/home/analog/libapreq2-2.08/glue' Making clean in module make[1]: Entering directory `/home/analog/libapreq2-2.08/module' Making clean in apache2 make[2]: Entering directory `/home/analog/libapreq2-2.08/module/apache2' rm -rf .libs _libs test -z mod_apreq2.la || rm -f mod_apreq2.la rm -f ./so_locations rm -f *.o rm -f *.lo make[2]: Leaving directory `/home/analog/libapreq2-2.08/module/apache2' Making clean in . make[2]: Entering directory `/home/analog/libapreq2-2.08/module' rm -rf .libs _libs cd t/c-modules make clean make[3]: Entering directory `/home/analog/libapreq2-2.08/module/t/c-modules' make[3]: *** No rule to make target `clean'. Stop. make[3]: Leaving directory `/home/analog/libapreq2-2.08/module/t/c-modules' make[2]: [cmodules_clean] Error 2 (ignored) rm t/c-modules/Makefile t/c-modules/*/Makefile t/c-modules/apache_httpd_test.h rm: cannot remove `t/c-modules/Makefile': No such file or directory rm: cannot remove `t/c-modules/*/Makefile': No such file or directory rm: cannot remove `t/c-modules/apache_httpd_test.h': No such file or directory make[2]: [cmodules_clean] Error 1 (ignored) MAKE=make /usr/bin/perl t/TEST -clean Can't open perl script t/TEST: No such file or directory make[2]: [test_clean] Error 2 (ignored) rm -rf t/htdocs t/logs t/modules t/TEST t/core t/core.* t/cgi-bin/test_cgi t/cgi-bin/.libs t/.libs t/conf/extra.conf t/conf/ssl/ca t/conf/ssl/httpd-passphrase.pl rm -f test_cgi test_cgi rm -f *.o rm -f *.lo make[2]: Leaving directory `/home/analog/libapreq2-2.08/module' make[1]: Leaving directory `/home/analog/libapreq2-2.08/module' Making clean in library make[1]: Entering directory `/home/analog/libapreq2-2.08/library' test -z libapreq2.la || rm -f libapreq2.la rm -f ./so_locations rm -rf .libs _libs rm -f *.o rm -f *.lo make[1]: Leaving directory `/home/analog/libapreq2-2.08/library' Making clean in include make[1]: Entering directory `/home/analog/libapreq2-2.08/include' rm -rf .libs _libs rm -f *.lo make[1]: Leaving directory `/home/analog/libapreq2-2.08/include' Making clean in . make[1]: Entering directory `/home/analog/libapreq2-2.08' test -z apreq2-config || rm -f apreq2-config rm -rf .libs _libs rm -f *.lo make[1]: Leaving directory `/home/analog/libapreq2-2.08'
RE: Help with Manual removal of libapreq2
Thanks Jonathan, I think that helped get me closer. I removed the Request.so (don't know where it came from if it shouldn't have been there), now I get Can't locate loadable object for module APR::Request which is coming from use APR::Request (); in my startup.pl Am i just missing something stupid? APR::Request should be there by way of installing libapreq2, shouldn't it? Thanks -Chris AFAIK , libapreq2 will only install mod_apreq2.a mod_apreq2.la mod_apreq2.so in the modules dir of apache2 that its configured against ( on my systems, thats /usr/local/apache2 ) , and the perl docs/libs . there shoudln't ever be a physical Request.so file That error looks like your code is creating an APR::Request object, but you haven't had 'use APR::Request' in your code yet. that kind of error tends to create messages like that. I'd try just tossing in a use line before that error gets thrown, and see if it fixes things.
RE: Help with Manual removal of libapreq2
Thanks Guys, Everything is working now (but I still have no idea how they got that way). I removed the entire APR/* dir out of the perl dir and everything was good. So I must have had 2 versions of libapreq installed and the wrong one was being found via @INC??? I don't know, but its working!!! Thanks! -Chris From: Frank Wiles [mailto:[EMAIL PROTECTED] Sent: Mon 5/14/2007 1:25 PM To: cfaust-dougot Cc: Jonathan Vanasco; modperl@perl.apache.org Subject: Re: Help with Manual removal of libapreq2 On Mon, 14 May 2007 11:40:46 -0400 cfaust-dougot [EMAIL PROTECTED] wrote: Thanks Jonathan, I think that helped get me closer. I removed the Request.so (don't know where it came from if it shouldn't have been there), now I get Can't locate loadable object for module APR::Request which is coming from use APR::Request (); in my startup.pl Am i just missing something stupid? APR::Request should be there by way of installing libapreq2, shouldn't it? Thanks You need Request.so for that. Your install issues sound like it might be a perl or gcc difference between what you used to build mod_perl and libapreq2. - Frank Wiles [EMAIL PROTECTED] http://www.wiles.org http://www.wiles.org/ -
Apache2::Cookie/APR::Request::Cookie
I'm down to the last thing I need to handle without CGI.pm to get rid of it, cookies... But I'm having a problem.. I've tried both Apache2::Cookie and APR::Request::Cookie (from the posts I read I got the impression it was better to use ARP::Request::Cookie then Apache2::Cookie). The problem I'm having is the cookie value I'm getting is cookie_name=cookie_value, pretty much the same thing being talked about here http://www.gossamer-threads.com/lists/modperl/modperl/82277?search_string=APR%3A%3ARequest%3A%3ACookie;#82277 Here is how I've tried setting the cookie (seems to be fine) my $packed_cookie = APR::Request::Cookie-new($r-pool, name = 'ISMH_SESSION_ID', value = someval, expires = '+7d', ); $r-err_headers_out-add('Set-Cookie' = $packed_cookie-as_string); The man page then says to use APR::Request::Cookie I should: my $jar = $r-jar; my $cookie = $jar-get(ISMH_SESSION_ID); That results in the error of Can't call method get without a package or object reference If I use Apache2::Cookie all the way my $cookie_req = Apache2::Cookie::Jar-new($r); my $cookie = $cookie_req-cookies(ISMH_SESSION_ID); I get cookie_name=cookie_value. I've tried the freeze and thaw methods, but there was no change... I even tried updating libpreq from version 2.07 to 2.08 and there was no change. Am I missing something?? Thanks -Chris 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
RE: Apache2::Cookie/APR::Request::Cookie
Thanks for the reply Clinton, I was just using the same request obj from the handler, guess that was wrong :) I tried your read example and now I don't get anything at all (even though I can see the cookie on the machine) my $req = APR::Request::Apache2-handle( $r ); my $jar = $req-jar; my %cookies; foreach my $key ( keys %$jar ) { print Key is $key and value is . $jar-get($key); $cookies{$key} = $jar-get($key); } And if I do just this my $req = APR::Request::Apache2-handle( $r ); my $jar = $req-jar; my $cookie = $jar-get('ISMH_SESSION_ID'); I get the error of Can't call method get on an undefined value If it matters, I load the modules in my startup.pl use Apache2::Request (); use Apache2::RequestRec (); use Apache2::Cookie (); use Apache2::Const -compile = qw(REDIRECT); use Apache2::Const -compile = qw(OK); use APR::Table (); use APR::Request (); use APR::Request::Cookie (); Am I doing anything that is clearly wrong? Thanks -Chris From: Clinton Gormley [mailto:[EMAIL PROTECTED] Sent: Sat 12/9/2006 8:53 AM To: cfaust-dougot Cc: modperl@perl.apache.org Subject: Re: Apache2::Cookie/APR::Request::Cookie The man page then says to use APR::Request::Cookie I should: my $jar = $r-jar; my $cookie = $jar-get(ISMH_SESSION_ID); What is $r in this case? It should be an APR::Request::Apache2 or (APR::Request::CGI I think) handle. So, where $r is an Apache2::RequestRec object: To set: --- my $cookie = APR::Request::Cookie-new( $r-pool, expires = '+7d', value = 'value', name = 'name' ) or die; $r-err_headers_out-add( 'Set-Cookie', $cookie-as_string ); To read: my $req = APR::Request::Apache2-handle( $r ); my $jar = $req-jar; my %cookies; foreach my $key ( keys %$jar ) { $cookies{$key} = $jar-get($key); } clint
RE: Apache2::Cookie/APR::Request::Cookie
I can both see the cookie being sent in the browser, and I can view the cookie itself on the filesystem after its been created... After the cookie has been set... my $req = APR::Request::Apache2-handle( $r ); my $jar = $req-jar; print $req-jar_status(); Just gives me the error of Missing Input Data and I'm sure apreq2 is loaded. Man, I wish getting rid of CGI.pm was as easy as using it :) - Back to the drawing board!! Thanks -Chris From: Clinton Gormley [mailto:[EMAIL PROTECTED] Sent: Sat 12/9/2006 10:00 AM To: cfaust-dougot Cc: modperl@perl.apache.org Subject: RE: Apache2::Cookie/APR::Request::Cookie On Sat, 2006-12-09 at 09:37 -0500, cfaust-dougot wrote: Thanks for the reply Clinton, I was just using the same request obj from the handler, guess that was wrong :) I tried your read example and now I don't get anything at all (even though I can see the cookie on the machine) What do you mean by 'I can see the cookie on the machine'? Can you see in the browser that it is being set? my $req = APR::Request::Apache2-handle( $r ); my $jar = $req-jar; Try : print $req-jar_status(); and see : perldoc APR::Request my %cookies; foreach my $key ( keys %$jar ) { print Key is $key and value is . $jar-get($key); $cookies{$key} = $jar-get($key); } And if I do just this my $req = APR::Request::Apache2-handle( $r ); my $jar = $req-jar; my $cookie = $jar-get('ISMH_SESSION_ID'); I get the error of Can't call method get on an undefined value If it matters, I load the modules in my startup.pl use Apache2::Request (); use Apache2::RequestRec (); use Apache2::Cookie (); use Apache2::Const -compile = qw(REDIRECT); use Apache2::Const -compile = qw(OK); use APR::Table (); use APR::Request (); use APR::Request::Cookie (); Am I doing anything that is clearly wrong? Not to me, but it is too long since I wrote my code to remember the issues I had. I remember it took me a while to get it write. Here is what I use at the top of my module: use APR::Request qw/encode decode/; use APR::Request::Apache2(); use APR::Request::Param(); use APR::Request::Cookie(); use APR::Table(); Are you sure that libapreq is correctly installed? Did you run make test? Is it loaded in your httpd.conf file? I'm clutching at straws good luck clint
RE: Apache2::Cookie/APR::Request::Cookie
Thanks Clinton,John and Philip.. Everything is helpful. Can I ask if there is something different when redirecting? It would appear the cookie isn't being sent in a redirect. When logging in from the post form I see the Set-Cookie header being set but when I redirect them back to the URl they should be on I don't see the Set-Cookie header being set even though I pack up the cookie and set it again (just like in the previous POST request) But does that even matter? A cookie isn't always set before its read in the same session, I might be looking for a cookie that was saved the last time you were on the site. Thanks -Chris From: Clinton Gormley [mailto:[EMAIL PROTECTED] Sent: Sat 12/9/2006 11:07 AM To: cfaust-dougot Cc: modperl@perl.apache.org Subject: RE: Apache2::Cookie/APR::Request::Cookie After the cookie has been set... my $req = APR::Request::Apache2-handle( $r ); my $jar = $req-jar; print $req-jar_status(); Just gives me the error of Missing Input Data and I'm sure apreq2 is loaded. from what John said: jar() returns undef if the browser sent no Cookie header - hence can't call get method on undefined. it sounds like your cookie isn't being sent by your browser back to your web server. i remember having some problems with the parameters I was passing to the cookie. Try just setting name and value and see what happens there. Also, check what headers your browser is sending back. (The LiveHeader add-on in firefox will do this for you) Man, I wish getting rid of CGI.pm was as easy as using it :) - Back to the drawing board!! Thanks -Chris __ From: Clinton Gormley [mailto:[EMAIL PROTECTED] Sent: Sat 12/9/2006 10:00 AM To: cfaust-dougot Cc: modperl@perl.apache.org Subject: RE: Apache2::Cookie/APR::Request::Cookie On Sat, 2006-12-09 at 09:37 -0500, cfaust-dougot wrote: Thanks for the reply Clinton, I was just using the same request obj from the handler, guess that was wrong :) I tried your read example and now I don't get anything at all (even though I can see the cookie on the machine) What do you mean by 'I can see the cookie on the machine'? Can you see in the browser that it is being set? my $req = APR::Request::Apache2-handle( $r ); my $jar = $req-jar; Try : print $req-jar_status(); and see : perldoc APR::Request my %cookies; foreach my $key ( keys %$jar ) { print Key is $key and value is . $jar-get($key); $cookies{$key} = $jar-get($key); } And if I do just this my $req = APR::Request::Apache2-handle( $r ); my $jar = $req-jar; my $cookie = $jar-get('ISMH_SESSION_ID'); I get the error of Can't call method get on an undefined value If it matters, I load the modules in my startup.pl use Apache2::Request (); use Apache2::RequestRec (); use Apache2::Cookie (); use Apache2::Const -compile = qw(REDIRECT); use Apache2::Const -compile = qw(OK); use APR::Table (); use APR::Request (); use APR::Request::Cookie (); Am I doing anything that is clearly wrong? Not to me, but it is too long since I wrote my code to remember the issues I had. I remember it took me a while to get it write. Here is what I use at the top of my module: use APR::Request qw/encode decode/; use APR::Request::Apache2(); use APR::Request::Param(); use APR::Request::Cookie(); use APR::Table(); Are you sure that libapreq is correctly installed? Did you run make test? Is it loaded in your httpd.conf file? I'm clutching at straws good luck clint Clinton Gormley [EMAIL PROTECTED] www.TravelJury.com - For travellers, By travellers
RE: Apache2::Cookie/APR::Request::Cookie
Does the order matter? I'm doing this $r-err_headers_out-add( 'Set-Cookie', $cookie-as_string ); $r-headers_out-set( Location = 'http://domain.com/page'); http://smtp.net.prevare.com/exchweb/bin/redir.asp?URL=http://domain.com/page%27); return Apache2::Const::REDIRECT; I'm guess it doesn't cause when it does work I'm doing $r-err_headers_out-add( 'Set-Cookie', $cookie-as_string ); return Apache2::Const::OK; I don't get it then, I'm using the same exact thing in both the case of the login (post request) and following get request my $packed_cookie = APR::Request::Cookie-new($r-pool, name = 'ISMH_SESSION_ID', value = 'xxx' expires = '+7d', ); $r-err_headers_out-add('Set-Cookie' = $packed_cookie-as_string); Its never easy :(.. Thanks!! From: Clinton Gormley [mailto:[EMAIL PROTECTED] Sent: Sat 12/9/2006 12:24 PM To: cfaust-dougot Cc: modperl@perl.apache.org Subject: RE: Apache2::Cookie/APR::Request::Cookie Can I ask if there is something different when redirecting? It would appear the cookie isn't being sent in a redirect. It should be fine setting cookies in a redirect as long as 1) you're using $r-err_headers_out-add() 2) you're not doing an internal redirect so, for instance, this sequence: $r-headers_out-set( Location = 'http://domain.com/page'); $r-err_headers_out-add( 'Set-Cookie', $cookie-as_string ); return Apache2::Const::HTTP_SEE_OTHER; When logging in from the post form I see the Set-Cookie header being set but when I redirect them back to the URl they should be on I don't see the Set-Cookie header being set even though I pack up the cookie and set it again (just like in the previous POST request) If you're setting the cookie header but you're not seeing it in the headers from the server, then you're not setting it properly. Are you not overwriting the err_headers_out by using -set instead of -add? But does that even matter? A cookie isn't always set before its read in the same session, I might be looking for a cookie that was saved the last time you were on the site. It only matter because it doesn't seem to be working... clint
RE: Apache2::Cookie/APR::Request::Cookie
I have read that and I used to use the 2nd method on that page without any problems.. Because I'm trying to do away with CGI.pm I'm now using the 3rd method using libapreq2' but without the content type etc when its a redirect. Because there isn't a redirect example using libapreq2, does that mean it doesn't work with redirects?? Thanks -Chris From: Philip M. Gollucci [mailto:[EMAIL PROTECTED] Sent: Sat 12/9/2006 12:26 PM To: cfaust-dougot Cc: Clinton Gormley; modperl@perl.apache.org Subject: Re: Apache2::Cookie/APR::Request::Cookie cfaust-dougot wrote: Thanks Clinton,John and Philip.. Everything is helpful. Can I ask if there is something different when redirecting? It would appear the cookie isn't being sent in a redirect. When logging in from the post form I see the Set-Cookie header being set but when I redirect them back to the URl they should be on I don't see the Set-Cookie header being set even though I pack up the cookie and set it again (just like in the previous POST request) But does that even matter? A cookie isn't always set before its read in the same session, I might be looking for a cookie that was saved the last time you were on the site. See these FAQs: http://perl.apache.org/docs/2.0/user/coding/cooking.html -- Philip M. Gollucci ([EMAIL PROTECTED]) 323.219.4708 Consultant / http://p6m7g8.net/Resume/resume.shtml Senior Software Engineer - TicketMaster - http://ticketmaster.com http://ticketmaster.com/ 1024D/EC88A0BF 0DE5 C55C 6BF3 B235 2DAB B89E 1324 9B4F EC88 A0BF I never had a dream come true 'Til the day that I found you. Even though I pretend that I've moved on You'll always be my baby. I never found the words to say You're the one I think about each day And I know no matter where life takes me to A part of me will always be... A part of me will always be with you.
RE: Apache2::Cookie/APR::Request::Cookie
The path was it I'm always passing a relitive path to Location so I didn't think it would matter.. Sure enough once I simply added 'Path = '/', to all my cookie create statements, SUCCESS!!! I'm now 100% without CGI.pm in my scripts, WooHoo!!! Thanks John, Clinton and Philip, you guys rock!! -Chris From: John ORourke [mailto:[EMAIL PROTECTED] Sent: Sat 12/9/2006 1:19 PM To: cfaust-dougot Cc: modperl@perl.apache.org Subject: Re: Apache2::Cookie/APR::Request::Cookie Ummm... this should be obvious but are you redirecting to a different hostname? In your code you're not explicitly setting the cookie domain or path, so the browser will only send the cookie to pages with the same hostname. That would explain why you don't see it on the redirect... Note that a good browser won't allow one domain to set a cookie for another domain too - I've never tested this though. John cfaust-dougot wrote: I have read that and I used to use the 2nd method on that page without any problems.. Because I'm trying to do away with CGI.pm I'm now using the 3rd method using libapreq2' but without the content type etc when its a redirect. Because there isn't a redirect example using libapreq2, does that mean it doesn't work with redirects?? Thanks -Chris From: Philip M. Gollucci [mailto:[EMAIL PROTECTED] Sent: Sat 12/9/2006 12:26 PM To: cfaust-dougot Cc: Clinton Gormley; modperl@perl.apache.org Subject: Re: Apache2::Cookie/APR::Request::Cookie cfaust-dougot wrote: Thanks Clinton,John and Philip.. Everything is helpful. Can I ask if there is something different when redirecting? It would appear the cookie isn't being sent in a redirect. When logging in from the post form I see the Set-Cookie header being set but when I redirect them back to the URl they should be on I don't see the Set-Cookie header being set even though I pack up the cookie and set it again (just like in the previous POST request) But does that even matter? A cookie isn't always set before its read in the same session, I might be looking for a cookie that was saved the last time you were on the site. See these FAQs: http://perl.apache.org/docs/2.0/user/coding/cooking.html -- Philip M. Gollucci ([EMAIL PROTECTED]) 323.219.4708 Consultant / http://p6m7g8.net/Resume/resume.shtml Senior Software Engineer - TicketMaster - http://ticketmaster.com http://ticketmaster.com/ 1024D/EC88A0BF 0DE5 C55C 6BF3 B235 2DAB B89E 1324 9B4F EC88 A0BF I never had a dream come true 'Til the day that I found you. Even though I pretend that I've moved on You'll always be my baby. I never found the words to say You're the one I think about each day And I know no matter where life takes me to A part of me will always be... A part of me will always be with you.
RE: Apache2::Upload and End of file found error Part 2
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
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
Apache2::Upload and End of file found error Part 2
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
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
MP2 Script within another script AND via SSI
Morning All, What I have below works, but for some reason I'm not all that comfortable with it.. Could someone tell me if I'm doing anything evil with my approach?? MP2 (ParseNav.pm) Script Description: Needed a script to create page navigation, the nav needs to be called within other MP2 scripts as well as in standard static pages (via ssi) When I want the nav within another MP2 script, I simply... my $top_nav = SCRIPTS::ParseNav-cgi_nav($r); When I want the nav in a static HTML page, I simply.. !--#include virtual="/parsenav" -- Below is the basic ParseNav script - TIA for any help or advise.. -Chris package SCRIPTS::ParseNav; use strict;use vars qw($r); ## Set some Constants# Template Path$ENV{'HTML_TEMPLATE_ROOT'} = xxx";# Our Content Templatemy $content = "Navigation.tmpl"; ### Main# Our Mod_Perl Content Handlersub handler {$r = shift; cgi_nav(); # As this is being called from a include, set a header and print it out$r-send_http_header;print $content-output;# Return our headeras we are done!!!return Apache::OK;} # End of Sub##sub cgi_nav {my ($self,$r) = @_; # do what we want to do and return the content template to the requesting MP2 script return $content; }
RE: MP2 Script within another script AND via SSI
Title: Re: MP2 Script within another script AND via SSI Thanks Perrin, don't know why it was bothering me soo much, but I feel better now!! From: Perrin Harkins [mailto:[EMAIL PROTECTED]Sent: Tue 7/11/2006 11:03 AMTo: cfaust-dougotCc: modperl@perl.apache.orgSubject: Re: MP2 Script within another script AND via SSI On Tue, 2006-07-11 at 09:50 -0400, cfaust-dougot wrote: What I have below works, but for some reason I'm not all thatcomfortable with it.. Could someone tell me if I'm doing anything evil with myapproach??Looks fine to me. SSI virtual includes are quite efficient withmod_perl.- Perrin
Previous Pages/Requests appearing
Folks, I am having problems with previous pages/requests showing up on refreshes and/or the clicking on links not going to the proper page etc. etc. Its a new server and I didn't think it was the code so I commented out allmod_perl scripts and added the simple script below. I also got the same problem with the script, even though I had "?aaa=true", the page wouldn't change to what was defined by the "print_aaa" sub, switching to "?bbb=true" would result in no change either. What is strange is all I would need to do is wait 4 or 5 seconds and then go back and the very first request would always do the proper thing, of course "perl-status" showed a new process (perl-status never showed more then 1 process during the testing). Any idea? Thanks -Chris # Test Script ## package MP2ShareTest; use strict;use CGI;use vars qw($r $CGI); ### Main# Our Mod_Perl Content Handlersub handler {$r = shift; $CGI = new CGI();my %form_data = ();%form_data = $CGI-Vars; if ($form_data{'bbb'} eq 'true') {print_bbb();} elsif ($form_data{'aaa'} eq 'true') {print_aaa();} else {print "No Form Data";}return Apache2::Const::OK;} # End of Subsub print_aaa { print 'a href=""Click for BBB/a';}sub print_bbb { print 'a href=""Click for AAA/a';}##1;
RE: Previous Pages/Requests appearing
Sorry, should have said I was running MP2 under RH Apache/2.0.54 (Unix) mod_perl/2.0.0 Perl/v5.8.0 configured From: cfaust-dougot [mailto:[EMAIL PROTECTED]Sent: Mon 5/30/2005 10:30 AMTo: modperl@perl.apache.orgSubject: Previous Pages/Requests appearing Folks, I am having problems with previous pages/requests showing up on refreshes and/or the clicking on links not going to the proper page etc. etc. Its a new server and I didn't think it was the code so I commented out allmod_perl scripts and added the simple script below. I also got the same problem with the script, even though I had "?aaa=true", the page wouldn't change to what was defined by the "print_aaa" sub, switching to "?bbb=true" would result in no change either. What is strange is all I would need to do is wait 4 or 5 seconds and then go back and the very first request would always do the proper thing, of course "perl-status" showed a new process (perl-status never showed more then 1 process during the testing). Any idea? Thanks -Chris # Test Script ## package MP2ShareTest; use strict;use CGI;use vars qw($r $CGI); ### Main# Our Mod_Perl Content Handlersub handler {$r = shift; $CGI = new CGI();my %form_data = ();%form_data = $CGI-Vars; if ($form_data{'bbb'} eq 'true') {print_bbb();} elsif ($form_data{'aaa'} eq 'true') {print_aaa();} else {print "No Form Data";}return Apache2::Const::OK;} # End of Subsub print_aaa { print 'a href=""Click for BBB/a';}sub print_bbb { print 'a href=""Click for AAA/a';}##1;
RE: Is mod_perl installed
Title: Re: Is mod_perl installed Thanks Perrin, that makes more sense. Although I agree the RPM is ancient, I've been telling them that the real problem is they installed from RPM and now think nothing could possibly be wrong as the RPM installed without an error :).. -Chris From: Perrin Harkins [mailto:[EMAIL PROTECTED]Sent: Thu 5/19/2005 5:06 PMTo: modperl@perl.apache.orgSubject: Re: Is mod_perl installed On Thursday 19 May 2005 2:49 pm, cfaust-dougot wrote: The box is RH enterprise and Apache and MP2 were installed via RPMWell, you know that's going to be a problem, right? That RPM is ancient andthat version of mod_perl is no longer supported. So I guess my question is, can it be said with 100% certainty that the "mod_perl 1.99" should show up in the error log (or those other documented methods) if its installed and configured properly?It's always possible to change things in the source, but it seems veryunlikely they would have done this for the error log message. More likely itis installed but not configured to actually be loaded when the server startsup.- Perrin
Is mod_perl installed
Hey Stas, I know this has been asked a ton of time and I have read everything on the site to check if MP is installed - my problem now is I have a client who has told me over and over again that mod_perl is installed - every method documented on the site says it is not (string doesn't appear in the error log, via telnet to apache or via the lwp-request method, it also doesn't appear via httpd -l. All method above report only "Apache/2.0.46 (Red Hat) configured" The box is RH enterprise and Apache and MP2 were installed via RPM - the client called RH (to prove me wrong)and RH told him if you installed MP2 via the RH RPM then that MP2 line shouldn't appear anyplace... I find that really hard to believe BEFORE I wasn't able find anything documented about it.. Is that true? So I guess my question is, can it be said with 100% certainty that the "mod_perl 1.99" should show up in the error log (or those other documented methods) if its installed and configured properly? Is there any other ways to prove its installed or not installed? Thanks -Chris
RE: Is mod_perl installed
Title: Re: Is mod_perl installed Hey Jay, Yes, all that is true.. the perl.conf is pulled into the httpd.conf and the first line is loading the mod_perl.so and the file does exist in the modules directory.. So by that your saying that mp2 is OK even though it doesn't appear any of those methods to check if its installed or not? I wouldn't think the existence of the conf and so file would be enough to say everything was correct. Thanks -Chris From: Jay Scherrer [mailto:[EMAIL PROTECTED]Sent: Thu 5/19/2005 5:17 PMTo: cfaust-dougotCc: mod_perlSubject: Re: Is mod_perl installed Cfaust,What does your httpd.conf file say after the modules listing?If it says something like:##load configfiles from the config directory "/etc/httpd.conf.d"#Include conf.d/*.conf#Then check there for your: perl.conf file.Within the perl.conf file you will find:LoadModule perl_module modules/mod_perl.soThen look for the perl_module in /etc/httpd/modules.This is standard placement for Redhat Linux RPMs.I have found that I can edit this perl.conf to customize my modPerl anddirectories and script aliasesOn Thu, 2005-05-19 at 14:49 -0400, cfaust-dougot wrote: Hey Stas, I know this has been asked a ton of time and I have read everything on the site to check if MP is installed - my problem now is I have a client who has told me over and over again that mod_perl is installed - every method documented on the site says it is not (string doesn't appear in the error log, via telnet to apache or via the lwp-request method, it also doesn't appear via httpd -l. All method above report only "Apache/2.0.46 (Red Hat) configured" The box is RH enterprise and Apache and MP2 were installed via RPM - the client called RH (to prove me wrong) and RH told him if you installed MP2 via the RH RPM then that MP2 line shouldn't appear anyplace... I find that really hard to believe BEFORE I wasn't able find anything documented about it.. Is that true? So I guess my question is, can it be said with 100% certainty that the "mod_perl 1.99" should show up in the error log (or those other documented methods) if its installed and configured properly? Is there any other ways to prove its installed or not installed? Thanks -Chris
RE: Is mod_perl installed
Title: Re: Is mod_perl installed Thanks Stas, as always - you da man!!! -Chris From: Stas Bekman [mailto:[EMAIL PROTECTED]Sent: Thu 5/19/2005 7:18 PMTo: cfaust-dougotCc: [EMAIL PROTECTED]; mod_perlSubject: Re: Is mod_perl installed cfaust-dougot wrote: Hey Jay, Yes, all that is true.. the perl.conf is pulled into the httpd.conf and the first line is loading the mod_perl.so and the file does exist in the modules directory.. So by that your saying that mp2 is OK even though it doesn't appear any of those methods to check if its installed or not? I wouldn't think the existence of the conf and so file would be enough to say everything was correct.If it quacks like a duck. if it walks like a duck. it must be a duck.If you don't see that mod_perl is running, that means that it doesn't.It might be installed, but if it's not enabled then it's not running.The easy way to check whether the .conf file is actually loaded is to addsome garbage in it. if it's loaded httpd will fail to start.--__Stas Bekman JAm_pH -- Just Another mod_perl Hackerhttp://stason.org/ mod_perl Guide --- http://perl.apache.orgmailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.comhttp://modperlbook.org http://apache.org http://ticketmaster.com
Code fix/suggestion after MP2 update
Folks, I hope my brain is just not functioning properly yet as its Saturday, but I'm having a tough time figuring out the best way to handle the needed changed of "Apache::*" to "Apache2::Const*" automatically so I don't have to edit anything with a script going up on 2 different servers with 2 the 2 different MP2 installs. The code that was effected for me was simple enough, all my handler'sare just: sub handler {$r = shift; my $request_type = anything if ($request_type eq 'Apache::REDIRECT') {$r-headers_out-set(Location = $back_url); #return Apache2::Const::REDIRECT; # or return Apache::REDIRECT;} else {#return Apache::OK; # or return Apache2::Const::OK;} } I thought it would be nice and easy to do it with a PerlSetVar in the conf file, so I would have something like in conf: PerlSetVar ApacheReturnRedirect Apache::REDIRECT PerlSet In handler if ($request_type eq 'Apache::REDIRECT') {$r-headers_out-set(Location = $back_url); return $r-dir_config-get('ApacheReturnRedirect');} else {return $r-dir_config-get('ApacheReturnOk');} But that didn't work, got an error of Argument "Apache::REDIRECT" isn't numeric, I also can't do it within any sort of "if" statement in the script itself as I will get the error of "Apache::* not allowed while script subs...". Any suggestions? Thanks In Advance! -Chris
RE: Code fix/suggestion after MP2 update
Title: Re: Code fix/suggestion after MP2 update cfaust-dougot wrote: Folks, I hope my brain is just not functioning properly yet as its Saturday, but I'm having a tough time figuring out the best way to handle the needed changed of "Apache::*" to "Apache2::Const*" automatically so I don't have to edit anything with a script going up on 2 different servers with 2 the 2 different MP2 installs. The code that was effected for me was simple enough, all my handler's are just: sub handler { $r = shift; my $request_type = anything if ($request_type eq 'Apache::REDIRECT') { $r-headers_out-set(Location = $back_url); #return Apache2::Const::REDIRECT; # or return Apache::REDIRECT; } else { #return Apache::OK; # or return Apache2::Const::OK; } } I thought it would be nice and easy to do it with a PerlSetVar in the conf file, so I would have something like in conf: PerlSetVar ApacheReturnRedirect Apache::REDIRECT PerlSet In handler if ($request_type eq 'Apache::REDIRECT') { $r-headers_out-set(Location = $back_url); return $r-dir_config-get('ApacheReturnRedirect'); } else { return $r-dir_config-get('ApacheReturnOk'); } But that didn't work, got an error of Argument "Apache::REDIRECT" isn't numeric, I also can't do it within any sort of "if" statement in the script itself as I will get the error of "Apache::* not allowed while script subs...". Any suggestions?That's funky :) But you can't do that. Since those constants are reallysubroutines. What you are returning are strings, so you will need to evalthose before using those. The best run the script that will adjust theconstants: http://people.apache.org/~geoff/fixme Thanks Stas, I was hoping to avoid any sort of preprocessing but if that's what it takes so you guys can keep producing lighting in a bottle, I'm not going to complain. -Chris
[MP2] - Failure on Make Install
Folks, have what I hope is a little problem during the install of mod_perl. 1. Problem Description: I just downloaded the current mod_perl from the site. mod_perl-2.0-current.tar.gz 4/18/2005 Configured and built as outlined in the docs - everything went fine, test showed all testes being successful (3 tests skipped). When I went to "Make Install", it ended with the following make[1]: Leaving directory `/home/xxx/mod_perl-2.0.0-RC5/xs'/usr/bin/perl -Iblib/lib -I/home/xxx/mod_perl-2.0.0-RC5/Apache-Test/lib -MModPerl::BuildMM -e ModPerl::BuildMM::glue_pod ModPerl-Registry/lib/ModPerl/RegistryLoader.pm /home/xxx/mod_perl-2.0.0-RC5/docs/api/ModPerl/RegistryLoader.pod blib/lib/ModPerl/RegistryLoader.pmUnrecognized switch: --section=3 (-h will show valid options).make: *** [glue_pods] Error 29 So I ran it with the -h[EMAIL PROTECTED] mod_perl-2.0.0-RC5]# /usr/bin/perl -Iblib/lib -I/home/x/mod_perl-2.0.0-RC5/Apache-Test/lib -MModPerl::BuildMM -e ModPerl::BuildMM::glue_pod ModPerl-Registry/lib/ModPerl/RegistryLoader.pm /home/x/mod_perl-2.0.0-RC5/docs/api/ModPerl/RegistryLoader.pod blib/lib/ModPerl/RegistryLoader.pm -hexpecting 3 arguments: pm, pod, dst at blib/lib/ModPerl/BuildMM.pm line 282. Any suggestions? RH Linux Apache 2.0.54 Thanks -Chris 2. Used Components and their Configuration: *** mod_perl version 1.999022 *** using /home/zerobrokerfees/mod_perl-2.0.0-RC5/lib/Apache2/BuildConfig.pm *** Makefile.PL options: MP_APR_LIB = aprext MP_APXS = /usr/local/apache2/bin/apxs MP_COMPAT_1X = 1 MP_GENERATE_XS = 1 MP_LIBNAME = mod_perl MP_USE_DSO = 1 *** /usr/local/apache2/bin/httpd -VServer version: Apache/2.0.54Server built: Apr 18 2005 12:19:15Server's Module Magic Number: 20020903:9Architecture: 32-bitServer compiled with-D APACHE_MPM_DIR="server/mpm/prefork"-D APR_HAS_SENDFILE-D APR_HAS_MMAP-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)-D APR_USE_SYSVSEM_SERIALIZE-D APR_USE_PTHREAD_SERIALIZE-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT-D APR_HAS_OTHER_CHILD-D AP_HAVE_RELIABLE_PIPED_LOGS-D HTTPD_ROOT="/usr/local/apache2"-D SUEXEC_BIN="/usr/local/apache2/bin/suexec"-D DEFAULT_PIDLOG="logs/httpd.pid"-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"-D DEFAULT_LOCKFILE="logs/accept.lock"-D DEFAULT_ERRORLOG="logs/error_log"-D AP_TYPES_CONFIG_FILE="conf/mime.types"-D SERVER_CONFIG_FILE="conf/httpd.conf" *** (apr|apu)-config linking info -L/usr/local/apache2/lib -lapr-0 -lrt -lm -lcrypt -lnsl -lpthread -ldl-L/usr/local/apache2/lib -laprutil-0 -lexpat *** /usr/bin/perl -VSummary of my perl5 (revision 5.0 version 8 subversion 0) configuration: Platform: osname=linux, osvers=2.4.21-14.elsmp, archname=i386-linux-thread-multi uname='linux twe' config_args='-des -Doptimize=-O2 -g -pipe -march=i386 -mcpu=i686 -Dmyhostname=localhost [EMAIL PROTECTED] -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux -Dvendorprefix=/usr -Dsiteprefix=/usr -Dotherlibdirs=/usr/lib/perl5/5.8.0 -Duseshrplib -Dusethreads -Duseithreads -Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef'useithreads=define usemultiplicity= useperlio= d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=un uselongdouble= usemymalloc=, bincompat5005=undef Compiler: cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm', optimize='', cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -I/usr/local/include -I/usr/include/gdbm' ccversion='', gccversion='3.2.3 20030502 (Red Hat Linux 3.2.3-42)', gccosandvers=''gccversion='3.2.3 200305' intsize=o, longsize=s, ptrsize=l, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long'k', ivsize=4'ivtype='long'known_extensi, nvtype='double', nvsize=, Off_t='', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='gcc'l', ldflags ='' libpth=/usr/local/lib /lib /usr/lib libs=-lnsl -lgdbm -ldb -ldl -lm -lpthread -lc -lcrypt -lutil perllibs= libc=/lib/libc-2.3.2.so, so=so, useshrplib=true, libperl=libper gnulibc_version='2.3.2' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so', d_dlsymun=undef, ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE' cccdlflags='-fPIC'ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5', lddlflags='s Unicode/Normalize XS/A' Characteristics of this binary (from libperl): Compile-time options: DEBUGGING MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL_IMPLICIT_CONTEXT Locally applied patches: MAINT18379 Built under linux Compiled at Oct 5 2004 13:02:53 %ENV:
RE: [MP2] - Failure on Make Install
Title: Re: [MP2] - Failure on Make Install Thanks Philip, I'll do that right now... -Chris From: Philip M. Gollucci [mailto:[EMAIL PROTECTED]Sent: Mon 4/18/2005 1:39 PMTo: cfaust-dougotCc: modperl@perl.apache.orgSubject: Re: [MP2] - Failure on Make Install cfaust-dougot wrote: *** Packages of interest status: Apache2 : - Apache2::Request: - CGI : 2.89 LWP : 5.65 mod_perl : 1.9909 mod_perl2 : -This isn't related to you make install error, but you'll want to upgradeCGI.pmto version 3.07 and apply the patches to get version 3.08 because onceyou fix the make install error this _will_ become an issue if you try touse CGI.pm under modperl2.http://marc.theaimsgroup.com/?l=apache-modperl-devm=111289411808089w=2HTH--END-Philip M. GollucciSenior Developer - Liquidity Services Inc.Phone: 202.558.6268 (Direct)E-Mail: [EMAIL PROTECTED]Web: http://www.liquidation.com
RE: [MP2] - Failure on Make Install
Title: Re: [MP2] - Failure on Make Install cfaust-dougot wrote: Folks, have what I hope is a little problem during the install of mod_perl. 1. Problem Description: I just downloaded the current mod_perl from the site. mod_perl-2.0-current.tar.gz 4/18/2005 Configured and built as outlined in the docs - everything went fine, test showed all testes being successful (3 tests skipped). When I went to "Make Install", it ended with the following make[1]: Leaving directory `/home/xxx/mod_perl-2.0.0-RC5/xs' /usr/bin/perl -Iblib/lib -I/home/xxx/mod_perl-2.0.0-RC5/Apache-Test/lib -MModPerl::BuildMM -e ModPerl::BuildMM::glue_pod ModPerl-Registry/lib/ModPerl/RegistryLoader.pm /home/xxx/mod_perl-2.0.0-RC5/docs/api/ModPerl/RegistryLoader.pod blib/lib/ModPerl/RegistryLoader.pm Unrecognized switch: --section=3 (-h will show valid options). make: *** [glue_pods] Error 29 So I ran it with the -h [EMAIL PROTECTED] mod_perl-2.0.0-RC5]# /usr/bin/perl -Iblib/lib -I/home/x/mod_perl-2.0.0-RC5/Apache-Test/lib -MModPerl::BuildMM -e ModPerl::BuildMM::glue_pod ModPerl-Registry/lib/ModPerl/RegistryLoader.pm /home/x/mod_perl-2.0.0-RC5/docs/api/ModPerl/RegistryLoader.pod blib/lib/ModPerl/RegistryLoader.pm -h expecting 3 arguments: pm, pod, dst at blib/lib/ModPerl/BuildMM.pm line 282. Any suggestions? Stas Said - The error is coming from pod2man, not the last command that you see:In Makefile you can see: $(FULLPERL) -I$(INST_LIB)-I/home/stas/apache.org/modperl-2.0/Apache-Test/lib -MModPerl::BuildMM -eModPerl::BuildMM::glue_pod xs/./Apache2/Const/Const.pmome/stas/apache.org/modperl-2.0/docs/api/Apache2/Const.podib/lib/Apache2/Const.pm $(NOECHO) $(POD2MAN) --section=3e/stas/apache.org/modperl-2.0/docs/api/Apache2/Const.podINST_MAN3DIR)/Apache2::Const.$(MAN3EXT)I can see that on my machine the second command is not even run, sincePOD2MAN is not defined. Please take a look at your Makefile, what's thevalue of POD2MAN? e.g.:grep POD2MAN Makefile | grep -v NOECHO Thanks for taking a look Stas, I'm not really sure I understand what you are saying, but below is what you asked for .. [EMAIL PROTECTED] mod_perl-2.0.0-RC5]# grep POD2MAN Makefile | grep -v NOECHOPOD2MAN_EXE = /usr/bin/pod2man --release mod_perl-2.0.0-RC5POD2MAN = $(PERL) -we '[EMAIL PROTECTED];for (keys %m){' \-e 'system(q[$(PERLRUN) $(POD2MAN_EXE) ].qq[$$_$$m{$$_}])==0 or warn "Couldn\047t install $$m{$$_}\n";' \ @$(POD2MAN) \ ___ Same section as your example from my Makefile $(FULLPERL) -I$(INST_LIB) -I/home/zerobrokerfees/mod_perl-2.0.0-RC5/Apache-Test/lib -MModPerl::BuildMM -e ModPerl::BuildMM::glue_pod xs/ModPerl/Const/Const.pm /home/zerobrokerfees/mod_perl-2.0.0-RC5/docs/api/ModPerl/Const.pod blib/lib/ModPerl/Const.pm $(NOECHO) $(POD2MAN) --section=3 /home/zerobrokerfees/mod_perl-2.0.0-RC5/docs/api/ModPerl/Const.pod $(INST_MAN3DIR)/ModPerl::Const.$(MAN3EXT) Thanks Again -Chris
RE: [MP2] - Failure on Make Install
Title: Re: [MP2] - Failure on Make Install cfaust-dougot wrote:Folks, have what I hope is a little problem during the install of mod_perl.1. Problem Description:I just downloaded the current mod_perl from the site.mod_perl-2.0-current.tar.gz 4/18/2005Configured and built as outlined in the docs - everything went fine, test showed all testes being successful (3 tests skipped).When I went to "Make Install", it ended with the followingmake[1]: Leaving directory `/home/xxx/mod_perl-2.0.0-RC5/xs'/usr/bin/perl -Iblib/lib -I/home/xxx/mod_perl-2.0.0-RC5/Apache-Test/lib -MModPerl::BuildMM -e ModPerl::BuildMM::glue_pod ModPerl-Registry/lib/ModPerl/RegistryLoader.pm /home/xxx/mod_perl-2.0.0-RC5/docs/api/ModPerl/RegistryLoader.pod blib/lib/ModPerl/RegistryLoader.pmUnrecognized switch: --section=3 (-h will show valid options).make: *** [glue_pods] Error 29So I ran it with the -h[EMAIL PROTECTED] mod_perl-2.0.0-RC5]# /usr/bin/perl -Iblib/lib -I/home/x/mod_perl-2.0.0-RC5/Apache-Test/lib -MModPerl::BuildMM -e ModPerl::BuildMM::glue_pod ModPerl-Registry/lib/ModPerl/RegistryLoader.pm /home/x/mod_perl-2.0.0-RC5/docs/api/ModPerl/RegistryLoader.pod blib/lib/ModPerl/RegistryLoader.pm -hexpecting 3 arguments: pm, pod, dst at blib/lib/ModPerl/BuildMM.pm line 282.Any suggestions? Stas Said -The error is coming from pod2man, not the last command that you see:In Makefile you can see: $(FULLPERL) -I$(INST_LIB)-I/home/stas/apache.org/modperl-2.0/Apache-Test/lib -MModPerl::BuildMM -eModPerl::BuildMM::glue_pod xs/./Apache2/Const/Const.pmome/stas/apache.org/modperl-2.0/docs/api/Apache2/Const.podib/lib/Apache2/Const.pm $(NOECHO) $(POD2MAN) --section=3e/stas/apache.org/modperl-2.0/docs/api/Apache2/Const.podINST_MAN3DIR)/Apache2::Const.$(MAN3EXT)I can see that on my machine the second command is not even run, sincePOD2MAN is not defined. Please take a look at your Makefile, what's thevalue of POD2MAN? e.g.:grep POD2MAN Makefile | grep -v NOECHO Thanks for taking a look Stas, I'm not really sure I understand what you are saying, but below is what you asked for .. [EMAIL PROTECTED] mod_perl-2.0.0-RC5]# grep POD2MAN Makefile | grep -v NOECHO POD2MAN_EXE = /usr/bin/pod2man --release mod_perl-2.0.0-RC5if you look at the Makefile manually, POD2MAN_EXE is all you have, or isthere some line continuation? (though I see no \) POD2MAN = $(PERL) -we '[EMAIL PROTECTED];for (keys %m){' \ -e 'system(q[$(PERLRUN) $(POD2MAN_EXE) ].qq[$$_$$m{$$_}])==0 or warn "Couldn\047t install $$m{$$_}\n";' \ @$(POD2MAN) \that's why it gets things messed up.Please try this patch:Index: lib/ModPerl/BuildMM.pm===--- lib/ModPerl/BuildMM.pm (revision 161771)+++ lib/ModPerl/BuildMM.pm (working copy)@@ -255,7 +255,7 @@ $man =~ s!/!::!g; push @target,- '$(NOECHO) $(POD2MAN) --section=3 ' .+ '$(NOECHO) $(POD2MAN_EXE) --section=3 ' . "$podpath \$(INST_MAN3DIR)/$man.\$(MAN3EXT)" } }It tried the patch and got the same error: /usr/bin/perl -Iblib/lib -I/home/zerobrokerfees/mod_perl-2.0.0-RC5/Apache-Test/lib -MModPerl::BuildMM -e ModPerl::BuildMM::glue_pod ModPerl-Registry/lib/ModPerl/RegistryLoader.pm /home/zerobrokerfees/mod_perl-2.0.0-RC5/docs/api/ModPerl/RegistryLoader.pod blib/lib/ModPerl/RegistryLoader.pmUnrecognized switch: --section=3 (-h will show valid options). The "/lib/ModPerl/BuildMM.pm section is now push @target, '$(NOECHO) $(POD2MAN_EXE) --section=3 ' . "$podpath \$(INST_MAN3DIR)/$man.\$(MAN3EXT)" } } Stupid question, do I need to build it all again? I just did "make install". Thanks -Chris
RE: [MP2] - Failure on Make Install
Title: Re: [MP2] - Failure on Make Install cfaust-dougot wrote:[...] It tried the patch and got the same error: /usr/bin/perl -Iblib/lib -I/home/zerobrokerfees/mod_perl-2.0.0-RC5/Apache-Test/lib -MModPerl::BuildMM -e ModPerl::BuildMM::glue_pod ModPerl-Registry/lib/ModPerl/RegistryLoader.pm /home/zerobrokerfees/mod_perl-2.0.0-RC5/docs/api/ModPerl/RegistryLoader.pod blib/lib/ModPerl/RegistryLoader.pm Unrecognized switch: --section=3 (-h will show valid options). The "/lib/ModPerl/BuildMM.pm section is now push @target, '$(NOECHO) $(POD2MAN_EXE) --section=3 ' . "$podpath \$(INST_MAN3DIR)/$man.\$(MAN3EXT)" } } Stupid question, do I need to build it all again? I just did "make install".Yes, you do.DOH, Sorry!!I did rebuild and everything has seemed to go fine for the install.. But I'm getting the following from Apache::Reload and all my scripts.. [Mon Apr 18 15:47:29 2005] [error] Bareword "Apache::OK" not allowed while "strict subs" in use at /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/Apache/Reload.pm line 151.\nCompilation failed in require at (eval 16) line 3.\n[Mon Apr 18 15:47:29 2005] [error] Can't load Perl module Apache::Reload for server zbweb1.zerobrokerfees.com:0, exiting... Do I need to be doing something different code wise with this latest version? Even if I comment out Apache:Reload I get the same problems with my scripts as I always return either "Apache::OK" or "Apache::REDIRECT" from my scripts hander sub. Thanks Stas -Chris
RE: [MP2] - Failure on Make Install
Title: Re: [MP2] - Failure on Make Install [...] It tried the patch and got the same error: /usr/bin/perl -Iblib/lib -I/home/zerobrokerfees/mod_perl-2.0.0-RC5/Apache-Test/lib -MModPerl::BuildMM -e ModPerl::BuildMM::glue_pod ModPerl-Registry/lib/ModPerl/RegistryLoader.pm /home/zerobrokerfees/mod_perl-2.0.0-RC5/docs/api/ModPerl/RegistryLoader.pod blib/lib/ModPerl/RegistryLoader.pm Unrecognized switch: --section=3 (-h will show valid options). The "/lib/ModPerl/BuildMM.pm section is now push @target, '$(NOECHO) $(POD2MAN_EXE) --section=3 ' . "$podpath \$(INST_MAN3DIR)/$man.\$(MAN3EXT)" } } Stupid question, do I need to build it all again? I just did "make install".Yes, you do.Stas, never mind my last note... I found it http://perl.apache.org/docs/2.0/rename.html#Changes, Right? Sorry, I should have looked harder before I replyed.. Thanks -Chris
RE: MP2 Won't Install
Title: Re: MP2 Won't Install That means only one thing: your httpd.conf is broken. Start with a helloworld config from the documentation, see it working and then proceed toensure that your own stuff is configured to run modperl. Awesome!!!Looks like that was the problem I don't know exactly what it was as I just took the stock apache httpd.conf and step by step made the changes that had to be made, brought the server up and it showed mod_perl installed and that other problem (previous requests showing up during multiple refreshes) is now gone as well. How did you know it was the conf? Because of that apache build error or because apache logged mod_perl in the error_log of t/logs? Either way, thanks again Stas for once again saving me hours upon hours of misery!!! -Chris
RE: MP2 - Make test Error - t/api/request_rec.t
Title: Re: MP2 - Make test Error - t/api/request_rec.t Hey Stas, Sorry, I have another question/problem. After building and installing MP2 and Apache with no problems at all, I'm running into that problem where if I refresh the page I may get what I want or I may get a previous page/request, even in single user mode. I'm having a hard time with this being a scoping issue or something else with my code as its the same code that has been running on mod_perl for over a year now on a different server, I didn't change a thing when I brought it over. Is there anything I could have done during the apache and/or mod_perl builds to do this? Thanks -Chris From: cfaust-dougot [mailto:[EMAIL PROTECTED]Sent: Mon 1/10/2005 1:33 PMTo: Stas BekmanCc: modperl@perl.apache.orgSubject: RE: MP2 - Make test Error - t/api/request_rec.t Thanks Stas, that did the trick, test and install both ran without a problem!! Thanks Again! -Chris From: Stas Bekman [mailto:[EMAIL PROTECTED]Sent: Mon 1/10/2005 11:17 AMTo: cfaust-dougotCc: modperl@perl.apache.orgSubject: Re: MP2 - Make test Error - t/api/request_rec.t Chris Faust wrote: Hi Stas, Moving to a new server and I'm rebuilding everything from scratch, I'm getting a single error during "make test" for "t/api/request_rec.t". Didn't find much info on it, saw a message from you to Ruslan Zakirov which had the error but the email was for a different problem. # testing : $r-hostname # expected: TAGTEAM-ES3 # received: tagteam-es3 not ok 14This patch should fix it, Chris:Index: t/response/TestAPI/request_rec.pm===--- t/response/TestAPI/request_rec.pm (revision 124805)+++ t/response/TestAPI/request_rec.pm (working copy)@@ -60,7 +60,7 @@ # HTTP 1.0 ok t_cmp $r-proto_num, 1000, 't-proto_num';- ok t_cmp $r-hostname, $r-get_server_name, '$r-hostname';+ ok t_cmp lc($r-hostname), lc($r-get_server_name), '$r-hostname'; { my $old_hostname = $r-hostname("other.hostname");--__Stas Bekman JAm_pH -- Just Another mod_perl Hackerhttp://stason.org/ mod_perl Guide --- http://perl.apache.orgmailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.comhttp://modperlbook.org http://apache.org http://ticketmaster.com
RE: MP2 - Make test Error - t/api/request_rec.t
Title: Re: MP2 - Make test Error - t/api/request_rec.t sorry, I have no idea. If you reduce your code to a simple few-lines script/handler and post it here, I'm sure someone will figure out what the problem is, and whether it's an issue with your code or a bug in mp2. Thanks Stas, I'll take all the help I can get... I've been trying to figure this out all day without any luck, I thought I could put to rest any problems with code once I went with a content handler and put everything in a subdirectory so I could be sure I don't have any messy global values. This code has been working on a previous server with no problems, we are moving to a new server and this is the result of the same code but after a new apache and mod_perl install. In short I can sit there and refresh the same page and over and over, sometimes I get the right page, other times I get other pages Thanks in Advance! -Chris Below are the basics: Index.pm: package MALDEN::scripts::Index;use Apache::Const -compile = qw(:common REDIRECT OK); use strict;use Mail::Sendmail;use XML::RSS;use POSIX qw(strftime);use vars qw($db $r $CGI $user_name $user_role); ### Main# Our Mod_Perl Content Handlersub handler {$r = shift; # Define our root HTML template path$ENV{'HTML_TEMPLATE_ROOT'} = "/websites/MALDEN/templates"; # Create a new global CGI object$CGI = new CGI(); # Create a global DB connection$db = TOOLS::PublicConnectDB-connect_to_db();# Authenticateauth_incoming_user(); # Determine what we want to do based on the request# Most functions will return "OK" after the "display page" subroutine# but for those that we have to redirect, the redirect directive and the URL will be returned my $back_url = "";my $request_type = "";($request_type,$back_url) = determine_proper_action();# Properly Exit the Handler from all subs within Determine Proper Actionif ($request_type eq 'Apache::REDIRECT') {$r-headers_out-set(Location = $back_url); return Apache::REDIRECT;} else {return Apache::OK;}} # End of Sub## And its defined in apache as VirtualHost :80 . PerlModule MALDEN::scripts::IndexLocation "/index" SetHandler perl-script PerlHandler MALDEN::scripts::Index/Location . /VirtualHost
RE: MP2 - Make test Error - t/api/request_rec.t
Title: Re: MP2 - Make test Error - t/api/request_rec.t You realize that this is not an a-few-lines-test-case. How can we analyzeor run it if it requires a database connection and non-existingauth_incoming_user and other functions. Please reduce it to the case thathas no external dependencies and so that it still fails. I bet while youare reducing that you will find the problematic code.Sorry, I know its unrunable as it is, I was just hoping that showing it was a package and everything was called with a subroutine that I could have eliminated any problems with global values or anything of that nature- I'll try to do something to produce the same results without all the overhead. -Chris