Re: flood docs -- take 2

2003-06-30 Thread Aaron Bannert
On Sunday, June 29, 2003, at 06:18  PM, Jacek Prucia wrote:
Please have another look at:
http://cvs.apache.org/~jacekp/manual/
This is actually what I'm going to commit tommorow. It has bugs, empty 
places,
but at least mentions every element/attribute available (at least I 
hope so).
Looks like it is a good starting point.
From the parts I looked at, it looks great. :)
while preparing documentation I was stuck with one simple thing: What 
is HTTP
Server project policy with CHANGES file? Is it:

a) hand edited by separate cvs commits (changed the code? edit 
CHANGES!)
b) autogenerated from cvs log

Some of my useful commits (auth support, baseurl) aren't in CHANGES. 
Gotta fix
that before release.
We hand edit the CHANGES file, so go ahead and add anything you feel
the user should know about. (Big awesome doc additions like this 
definitely
belong in there.)

-aaron


Re: [patch] have_apache_mpm()

2003-06-30 Thread Geoffrey Young

looks good, but what happens when 1.3 is used? Shouldn't it always 
return preforked?
doh!
here's a better patch.
--Geoff

Index: Test.pm
===
RCS file: 
/home/cvspublic/httpd-test/perl-framework/Apache-Test/lib/Apache/Test.pm,v
retrieving revision 1.63
diff -u -r1.63 Test.pm
--- Test.pm 19 Jun 2003 00:45:31 -  1.63
+++ Test.pm 30 Jun 2003 13:46:35 -
@@ -15,7 +15,7 @@
  have_cgi have_access have_auth have_module have_apache
  have_min_apache_version have_apache_version have_perl 
  have_min_perl_version have_min_module_version
- have_threads under_construction);
+ have_threads under_construction have_apache_mpm);
 $VERSION = '1.04';
 
 %SubTests = ();
@@ -274,6 +274,22 @@
 push @SkipReasons,
   apache version $wanted or higher is required, .
this is version $current;
+return 0;
+}
+else {
+return 1;
+}
+}
+
+sub have_apache_mpm {
+my $wanted = shift;
+my $cfg = Apache::Test::config();
+my $current = $cfg-{server}-{mpm};
+
+if ($current ne $wanted) {
+push @SkipReasons,
+  apache mpm $wanted is required, .
+   this is the $current mpm;
 return 0;
 }
 else {
Index: TestConfigParse.pm
===
RCS file: 
/home/cvspublic/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfigParse.pm,v
retrieving revision 1.33
diff -u -r1.33 TestConfigParse.pm
--- TestConfigParse.pm  27 Apr 2003 22:52:28 -  1.33
+++ TestConfigParse.pm  30 Jun 2003 13:46:36 -
@@ -309,6 +309,10 @@
 if (my $mpm_dir = $self-{httpd_defines}-{APACHE_MPM_DIR}) {
 $self-{mpm} = basename $mpm_dir;
 }
+else {
+# Apache 1.3
+$self-{mpm} = 'prefork';
+}
 }
 
 sub httpd_version {
@@ -339,6 +343,10 @@
 close $v;
 
 return $version;
+}
+
+sub httpd_mpm {
+return shift-{mpm};
 }
 
 1;
Index: TestServer.pm
===
RCS file: 
/home/cvspublic/httpd-test/perl-framework/Apache-Test/lib/Apache/TestServer.pm,v
retrieving revision 1.62
diff -u -r1.62 TestServer.pm
--- TestServer.pm   21 May 2003 04:02:14 -  1.62
+++ TestServer.pm   30 Jun 2003 13:46:36 -
@@ -38,6 +38,7 @@
 $self-{port_counter} = $self-{config}-{vars}-{port};
 
 $self-{version} = $self-{config}-httpd_version || '';
+$self-{mpm} = $self-{config}-httpd_mpm || '';
 ($self-{rev}) = $self-{version} =~ m:^Apache/(\d)\.:;
 $self-{rev} ||= 2;
 


Makefile.PL Questions

2003-06-30 Thread David Wheeler
Hi All,
I got a bug report for the latest release of 
MasonX::ApacheHandler::WithCallbacks, which uses Apache::Test for its 
testing. My question is this: I use Apache::TestMM and 
Apache::TestRunPerl in my Makefile.PL to set up the test suite. 
However, many users may not have Apache::Test installed when they go to 
install my module. CPAN.pm will of course catch this (Apache::Test is 
in the list of prereqs), but it first tries to run Makefile.PL, 
triggering this error:

  Can't locate Apache/TestMM.pm in @INC
I can avoid this by checking to see if Apache::Test loads and only 
using it if it does. But then, how would I set up the tests to run 
after CPAN.pm has installed Apache::Test? Does it run Makefile.PL again?

TIA,
David
--
David Wheeler AIM: dwTheory
[EMAIL PROTECTED]  ICQ: 15726394
http://kineticode.com/ Yahoo!: dew7e
   Jabber: [EMAIL PROTECTED]
Kineticode. Setting knowledge in motion.[sm]


Re: Makefile.PL Questions

2003-06-30 Thread Geoffrey Young

I can avoid this by checking to see if Apache::Test loads and only using 
it if it does. But then, how would I set up the tests to run after 
CPAN.pm has installed Apache::Test? Does it run Makefile.PL again?
I don't ever use CPAN.pm, so I don't know if the way I have been going about 
it actually works or not, but my standard 1.0 Makefile.PL (which was linked 
to in the perl.com article) looks something like

sub MY::test {
  eval {
require Apache::Test;
require Apache::TestMM;
require Apache::TestRunPerl;
Apache::TestMM-import(qw(test clean));
Apache::TestMM::filter_args();
Apache::TestRunPerl-generate_script();
return Apache::TestMM-test;
  }
  or return EOF;
test::
[EMAIL PROTECTED] This test suite requires Apache-Test,
[EMAIL PROTECTED] which is available from the mod_perl 2.0
[EMAIL PROTECTED] sources, CPAN, or the httpd-test distribution.
EOF
}
this makes 'make test' echo the error string or run the tests, depending on 
whether A::T is installed.  in either case, 'make test' is successful (I hope :)

HTH
--Geoff


Re: Makefile.PL Questions

2003-06-30 Thread David Wheeler
On Monday, June 30, 2003, at 11:26  AM, Geoffrey Young wrote:
I don't ever use CPAN.pm, so I don't know if the way I have been going 
about it actually works or not, but my standard 1.0 Makefile.PL (which 
was linked to in the perl.com article) looks something like

sub MY::test {
  eval {
require Apache::Test;
require Apache::TestMM;
require Apache::TestRunPerl;
Apache::TestMM-import(qw(test clean));
Apache::TestMM::filter_args();
Apache::TestRunPerl-generate_script();
return Apache::TestMM-test;
  }
  or return EOF;
test::
[EMAIL PROTECTED] This test suite requires Apache-Test,
[EMAIL PROTECTED] which is available from the mod_perl 2.0
[EMAIL PROTECTED] sources, CPAN, or the httpd-test distribution.
EOF
}
this makes 'make test' echo the error string or run the tests, 
depending on whether A::T is installed.  in either case, 'make test' 
is successful (I hope :)
That seems like a good idea. I just did some experimentation on my own, 
and discovered that both CPAN.pm and CPANPLUS run Makefile.PL twice -- 
once before satisfying dependences, and once after satisfying 
dependencies. So it works well structure the Makefile.PL like this:

if (eval {require Apache::Test}) {
require Apache::TestMM;
require Apache::TestRunPerl;
Apache::TestMM-import(qw(test clean));
Apache::TestMM::filter_args();
Apache::TestRunPerl-generate_script();
} else {
print Skipping test setup.\n;
}
But I agree that it's smart to go one step further and install the 
default `make test` as you describe. I'll have to try that.

Thanks,
David
--
David Wheeler AIM: dwTheory
[EMAIL PROTECTED]  ICQ: 15726394
http://kineticode.com/ Yahoo!: dew7e
   Jabber: [EMAIL PROTECTED]
Kineticode. Setting knowledge in motion.[sm]


Re: Makefile.PL Questions

2003-06-30 Thread David Wheeler
On Monday, June 30, 2003, at 11:26  AM, Geoffrey Young wrote:
this makes 'make test' echo the error string or run the tests, 
depending on whether A::T is installed.  in either case, 'make test' 
is successful (I hope :)
Looks like it would be. I decided to use a different approach. Since 
some of the tests in my test suite don't require Apache::Test, I simply 
added this code to those that do require it:

BEGIN{
if (eval {require Apache::Test}) {
Apache::Test-import(qw(have_lwp plan));
require Apache::TestRequest;
Apache::TestRequest-import(qw(GET POST));
plan tests = 43, have_lwp;
} else {
plan skip_all = 'Apache::Test required to run tests.';
}
}
So the test suite still runs in Test::Harness, but all the tests are 
skipped.

Hope this can help others.
Regards,
David
--
David Wheeler AIM: dwTheory
[EMAIL PROTECTED]  ICQ: 15726394
http://kineticode.com/ Yahoo!: dew7e
   Jabber: [EMAIL PROTECTED]
Kineticode. Setting knowledge in motion.[sm]


Re: Makefile.PL Questions

2003-06-30 Thread David Wheeler
On Monday, June 30, 2003, at 12:11  PM, David Wheeler wrote:
BEGIN{
if (eval {require Apache::Test}) {
Apache::Test-import(qw(have_lwp plan));
require Apache::TestRequest;
Apache::TestRequest-import(qw(GET POST));
plan tests = 43, have_lwp;
} else {
plan skip_all = 'Apache::Test required to run tests.';
}
}
Actually, to make it cooperate with Test::More, I had to do this:
BEGIN {
if (eval {require Apache::Test}) {
if (Apache::Test::have_lwp()) {
require Apache::TestRequest;
Apache::TestRequest-import(qw(GET POST));
plan tests = 43;
} else {
plan skip_all = 'libwww-perl is not installed';
}
} else {
plan skip_all = 'Apache::Test required to run tests';
}
}
Thanks,
David
--
David Wheeler AIM: dwTheory
[EMAIL PROTECTED]  ICQ: 15726394
http://kineticode.com/ Yahoo!: dew7e
   Jabber: [EMAIL PROTECTED]
Kineticode. Setting knowledge in motion.[sm]