ANNOUNCE: Apache::AuthCookie 3.09
The uploaded file Apache-AuthCookie-3.09.tar.gz has entered CPAN as file: $CPAN/authors/id/M/MS/MSCHOUT/Apache-AuthCookie-3.09.tar.gz size: 34908 bytes md5: 8bfd8834d2b161f2e28c908c27eccf10 Please allow a few hours for the file to mirror across CPAN :). Apache::AuthCookie allows you to intercept a user's first unauthenticated access to a protected document. The user will be presented with a custom form where they can enter authentication credentials. The credentials are posted to the server where AuthCookie verifies them and returns a session key. The session key is returned to the user's browser as a cookie. As a cookie, the browser will pass the session key on every subsequent accesses. AuthCookie will verify the session key and re-authenticate the user. All you have to do is write a custom module that inherits from AuthCookie. See the POD documentation for more details. Changes since 3.08: - POD doc fixes. - MP2: remove _check_request_req() - this was only necessary when running under both MP1 and MP2. Package name change eliminates the need for this. - test suite converted to Test::More style test suites. - descriptive test descriptions added - make login() stash credentials in $r->pnotes("${AuthName}Creds") so that the login form can access the user-supplied credentials if the login fails. - bug fix: use of Apache2::URI::unescape_url() does not handle '+' to ' ' conversion. This caused problems for credentials that contain spaces. - MP2: remove mod_perl features from "use mod_perl2" line. This is no longer supported by mod_perl2. - MP2: _get_form_data() - switch to CGI.pm to handle form data (fixes several form data handling bugs) - In a subrequest, copy $r->prev->user to $r->user (or r->connection->user for MP1). - remove Apache2::AuthCookie::Util - no longer necessary - multi-valued form fields are now handled properly in POST -> GET conversion - MP2: require CGI.pm 3.12 or later
The famous 3221225477 exit status
Hi all, On my mp2 machine I see a lot of this exit status code generated. And when it does, my Apache2 stop serving for a while (I guess it's just restarting). Goggling this number seems to indicate that a lot of people are experiencing this problem, but nobody really seems to have a solution for it. It seems to be an issue on the Windows platform. Does anyone here have any suggestions on how this comes about, and how it can be resolved? Thanks.
Malformed header problem
Hi, I'm trying to run with mod_perl the following script: #!/usr/bin/perl print "\n"; print "\n\n"; print "\n"; print "\n"; print "\n"; print"\n"; print "\n"; print "HELLO\n"; print "\n"; print "\n"; IMHO that SHOULD work, but it doesn't: I receive from error.log: [Wed May 03 18:29:36 2006] [error] [client 192.168.1.1] malformed header from script. Bad header=
Re: the dreaded 'subroutine redefined'
Matthew wrote: None of my subroutines are prototyped. They all follow the format: sub () { } As Perrin/Randal said, thats a prototype of no arguments While I'm on it &foo is different from &foo() The first gets access to the global @_ (aka whatever function foo was called from, its @_ is handed to foo), the latter does not. Finally, as long as your sub foo {} comes before the call to it (i.e scripts), you generally don't write the sigil & -- i.e. &foo(), but merely foo() use Apache2::Reload; You should generally move this to your httpd.conf file and configure it PerlModule Apache2::Reload PerlInitHandler Apache2::Reload PerlSetVar ReloadAll Off PerlSetVar ReloadModules "confer::tester FOO::*" You can use PerlSetVar ReloadDebug On to get a list in error_log of what files Apache2:Reload is stating to see if they need to be reload. If you only care about one file, you should make this list be 1 file via the ReloadModules directive. This will lessen the performance impact as Johnathan pointed out. use vars qw($q $r $dbh $template $sql); just fyi, it takes more memory (bytes) to do this instead of our do to symbol table mumbo jumbo. Finally *sometimes* mod_perl doesn't like it when a function gets 'redefined' Though I agree with no warnings qw(redefine); If you're developing actively, you might notice some strangeness especially if you cause a syntax error and hope Apache2::Reload will reload correctly. Notice above, I said SOMETIMES. HTH Philip M. Gollucci ([EMAIL PROTECTED]) 323.219.4708 Consultant / http://p6m7g8.net/Resume/resume.shtml Senior Software Engineer - TicketMaster - http://ticketmaster.com 1024D/A79997FA F357 0FDD 2301 6296 690F 6A47 D55A 7172 A799 97F "It takes a minute to have a crush on someone, an hour to like someone, and a day to love someone, but it takes a lifetime to forget someone..."
Re: the dreaded 'subroutine redefined'
On May 3, 2006, at 4:59 PM, Matthew wrote: I had a feeling it was Apache::Reload. In the future, we shouldn't need this module as we won't be making daily changes to the code. Thanks a million. -Matthew Apache::Reload is simply amazing for development machines (to the point that I can't imagine ever turning it off on one ), but you really shouldn't run it on your production machines. There are a few operational caveats, and its a big performance hit. If you're getting this on a production box, you should consider stripping it out now and just doing a graceful restart when changes are made.
Re: the dreaded 'subroutine redefined'
I had a feeling it was Apache::Reload. In the future, we shouldn't need this module as we won't be making daily changes to the code. Thanks a million. -Matthew Perrin Harkins wrote: On Wed, 2006-05-03 at 16:48 -0400, Perrin Harkins wrote: On Tue, 2006-05-02 at 17:43 -0500, Matthew wrote: Hey gang, When I actually execute the code in web browser (http://www.mydomain.com/test/tester), I get this in my apache error_log: [Tue May 2 23:33:57 2006] v2.pm: Subroutine handler redefined at /home/me/public_html/confer//mypackage/tester.pm line 10. <..repeats for each subroutine in the file..> That's not a problem. This is just a warning telling you that Apache::Reload has reloaded your module and the sub was redefined. If it really bothers you, you can add a "no warnings (redefine)" to your version of Apache::Reload. Correction: Add "no warnings qw(redefine);" to your module. You shouldn't need to modify Apache::Reload. - Perrin
Re: the dreaded 'subroutine redefined'
On Wed, 2006-05-03 at 16:48 -0400, Perrin Harkins wrote: > On Tue, 2006-05-02 at 17:43 -0500, Matthew wrote: > > Hey gang, > > When I actually execute the code in web browser > > (http://www.mydomain.com/test/tester), I get this in my apache error_log: > > > > [Tue May 2 23:33:57 2006] v2.pm: Subroutine handler redefined at > > /home/me/public_html/confer//mypackage/tester.pm line 10. > > <..repeats for each subroutine in the file..> > > That's not a problem. This is just a warning telling you that > Apache::Reload has reloaded your module and the sub was redefined. If > it really bothers you, you can add a "no warnings (redefine)" to your > version of Apache::Reload. Correction: Add "no warnings qw(redefine);" to your module. You shouldn't need to modify Apache::Reload. - Perrin
Re: the dreaded 'subroutine redefined'
On Tue, 2006-05-02 at 17:43 -0500, Matthew wrote: > Hey gang, > When I actually execute the code in web browser > (http://www.mydomain.com/test/tester), I get this in my apache error_log: > > [Tue May 2 23:33:57 2006] v2.pm: Subroutine handler redefined at > /home/me/public_html/confer//mypackage/tester.pm line 10. > <..repeats for each subroutine in the file..> That's not a problem. This is just a warning telling you that Apache::Reload has reloaded your module and the sub was redefined. If it really bothers you, you can add a "no warnings (redefine)" to your version of Apache::Reload. - Perrin
Re: the dreaded 'subroutine redefined'
Nope. Didn't realize that () was prototyped. I should note that I pass variables to the functions like so: if($cmd eq "login") { &doLogin($q->param("username"), $q->param("password")); } sub doLogin() { my ($username, $password) = @_; if($username eq "you" && $password eq "me") { print "Success"; } else { print "Denied"; } } -Matthew Randal L. Schwartz wrote: "Matthew" == Matthew <[EMAIL PROTECTED]> writes: Matthew> None of my subroutines are prototyped. They all follow the format: Matthew> sub () { Matthew> Matthew> } You realize that's a prototype? :)
Re: the dreaded 'subroutine redefined'
> "Matthew" == Matthew <[EMAIL PROTECTED]> writes: Matthew> None of my subroutines are prototyped. They all follow the format: Matthew> sub () { Matthew> Matthew> } You realize that's a prototype? :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: the dreaded 'subroutine redefined'
None of my subroutines are prototyped. They all follow the format: sub () { } Here are the first few lines of tester.pm and the code for the handler() function. -- package confer::tester; use strict; use warnings; use Apache2::Reload; use vars qw($q $r $dbh $template $sql); sub handler { $r = shift; $q = CGI->new(); # Instance the database connection and wrapper # messageDie as the fuction if something fails $dbh = DBI->connect("DBI:mysql:database=conf;host=:/tmp/mysql.sock;", "tester", "testerpass", {'RaiseError' => 1}); $dbh->{HandleError} = sub { &messageDie( "A database error has occured.", shift, shift) }; # We will always print out HTML $r->content_type("text/html"); # Instance the template object $template = new HTML::Template(filename => 'background.tpl', path => [ '/home/me/public_html/confer/' ], die_on_bad_params => 0, stack_debug => 0, debug => 0); # What are we going to do? my $cmd = (defined($q->param("_cmd")) ? $q->param("_cmd") : "logintype"); if($cmd eq "logintype") { &printLogin(); elsif($cmd eq "stats") { &printStats(); } else { &messageDie("How the frack did you get here?"); } return Apache2::Const::OK; } Thanks, Matthew Philip M. Gollucci wrote: PerlModule Apache2::Reload PerlInitHandler Apache2::Reload PerlSetVar ReloadAll Off PerlRequire /home/me/public_html/confer/startup.pl SetHandler perl-script PerlResponseHandler mypackage::tester Can you show some of the file's sub foo { lines ? I've noticed Exporter doesn't always play nice if you protoype your functions sub foo ($@;\%) { Also, whether or not your preload your module in startup.pl or httpd.conf is merely a choice. You can tweak a couple things about the way PerlModule works via PerlOptions http://perl.apache.org/docs/2.0/user/config/config.html#C_AutoLoad_ HTH
Re: the dreaded 'subroutine redefined'
PerlModule Apache2::Reload PerlInitHandler Apache2::Reload PerlSetVar ReloadAll Off PerlRequire /home/me/public_html/confer/startup.pl SetHandler perl-script PerlResponseHandler mypackage::tester Can you show some of the file's sub foo { lines ? I've noticed Exporter doesn't always play nice if you protoype your functions sub foo ($@;\%) { Also, whether or not your preload your module in startup.pl or httpd.conf is merely a choice. You can tweak a couple things about the way PerlModule works via PerlOptions http://perl.apache.org/docs/2.0/user/config/config.html#C_AutoLoad_ HTH -- Philip M. Gollucci ([EMAIL PROTECTED]) 323.219.4708 Consultant / http://p6m7g8.net/Resume/resume.shtml Senior Software Engineer - TicketMaster - http://ticketmaster.com 1024D/A79997FA F357 0FDD 2301 6296 690F 6A47 D55A 7172 A799 97F "It takes a minute to have a crush on someone, an hour to like someone, and a day to love someone, but it takes a lifetime to forget someone..."