apache-dispatch-devel Mailing List for Apache::Dispatch (Page 3)
Brought to you by:
geoffrey_young,
phred_moyer
You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
(4) |
Apr
(33) |
May
(10) |
Jun
(22) |
Jul
(3) |
Aug
(15) |
Sep
(3) |
Oct
(3) |
Nov
|
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
(5) |
Sep
|
Oct
|
Nov
|
Dec
(9) |
| 2008 |
Jan
(6) |
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
(11) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
(12) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2010 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Fred M. <fr...@re...> - 2007-07-20 18:01:54
|
I released 10_02 last night with this change. http://search.cpan.org/~phred/Apache-Dispatch-0.10_02/ I'm going to scrap the existing Makefile.PL voodoo which doesn't work so well and steal the one from Apache::SizeLimit for 10_03. Tuits are starting to free up and I'll be hacking on this and Apache::Reload in parallel. phr...@us... wrote: > Revision: 55 > http://svn.sourceforge.net/apache-dispatch/?rev=55&view=rev > Author: phred_moyer > Date: 2007-07-19 23:41:37 -0700 (Thu, 19 Jul 2007) > > Log Message: > ----------- > Add a test for <Location /> and fix the handling for that case. Although > we do not advertise this feature, I need it and probably so will others. > > Modified Paths: > -------------- > trunk/Changes > trunk/lib/Apache/Dispatch/Util.pm > trunk/t/01plain.t > trunk/t/conf/extra.last.conf.in > > Modified: trunk/Changes > =================================================================== > --- trunk/Changes 2006-10-24 05:23:15 UTC (rev 54) > +++ trunk/Changes 2007-07-20 06:41:37 UTC (rev 55) > @@ -1,5 +1,8 @@ > Revision history for Perl extension Apache::Dispatch > > +0.10_02 07.19.2007 > + - fix the unadvertised feature which allows handling <Location /> > + > 0.10_01 10.23.2006 > - move common methods to Apache::Dispatch::Util and adjust @ISA for > Apache*::Dispatch modules to use common methods via inheritance - fred > > Modified: trunk/lib/Apache/Dispatch/Util.pm > =================================================================== > --- trunk/lib/Apache/Dispatch/Util.pm 2006-10-24 05:23:15 UTC (rev 54) > +++ trunk/lib/Apache/Dispatch/Util.pm 2007-07-20 06:41:37 UTC (rev 55) > @@ -350,8 +350,8 @@ > else { > > # <Location /> > - $prefix .= "::"; > - $times = $class_and_method =~ s/^/$prefix/e; > + $times = 1; > + $class_and_method = $prefix; > } > > unless ($times) { > > Modified: trunk/t/01plain.t > =================================================================== > --- trunk/t/01plain.t 2006-10-24 05:23:15 UTC (rev 54) > +++ trunk/t/01plain.t 2007-07-20 06:41:37 UTC (rev 55) > @@ -4,7 +4,7 @@ > use Apache::Test qw(ok plan :withtestmore ); > use Apache::TestRequest qw(GET GET_OK); > > -plan tests => 4, need_lwp; > +plan tests => 5, need_lwp; > > # Test Apache2::Foo->dispatch_index > my $uri = '/plain'; > @@ -24,3 +24,6 @@ > $uri = '/plain/bar/baz'; > ok GET_OK $uri; > > +# Test root location special case > +$uri = '/'; > +ok GET_OK $uri > > Modified: trunk/t/conf/extra.last.conf.in > =================================================================== > --- trunk/t/conf/extra.last.conf.in 2006-10-24 05:23:15 UTC (rev 54) > +++ trunk/t/conf/extra.last.conf.in 2007-07-20 06:41:37 UTC (rev 55) > @@ -6,6 +6,21 @@ > PerlModule Apache::Dispatch > </IfDefine> > > + <Location /> > + SetHandler perl-script > + DispatchRequire On > + DispatchDebug 2 > + DispatchUpperCase On > + <IfDefine APACHE2> > + DispatchPrefix Apache2::Foo > + PerlResponseHandler Apache2::Dispatch > + </IfDefine> > + <IfDefine APACHE1> > + PerlHandler Apache::Dispatch > + DispatchPrefix Apache::Foo > + </IfDefine> > + </Location> > + > <Location /plain> > SetHandler perl-script > DispatchRequire On > > > This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Apache-dispatch-devel mailing list > Apa...@li... > https://lists.sourceforge.net/lists/listinfo/apache-dispatch-devel |
|
From: <phr...@us...> - 2007-07-20 06:41:40
|
Revision: 55
http://svn.sourceforge.net/apache-dispatch/?rev=55&view=rev
Author: phred_moyer
Date: 2007-07-19 23:41:37 -0700 (Thu, 19 Jul 2007)
Log Message:
-----------
Add a test for <Location /> and fix the handling for that case. Although
we do not advertise this feature, I need it and probably so will others.
Modified Paths:
--------------
trunk/Changes
trunk/lib/Apache/Dispatch/Util.pm
trunk/t/01plain.t
trunk/t/conf/extra.last.conf.in
Modified: trunk/Changes
===================================================================
--- trunk/Changes 2006-10-24 05:23:15 UTC (rev 54)
+++ trunk/Changes 2007-07-20 06:41:37 UTC (rev 55)
@@ -1,5 +1,8 @@
Revision history for Perl extension Apache::Dispatch
+0.10_02 07.19.2007
+ - fix the unadvertised feature which allows handling <Location />
+
0.10_01 10.23.2006
- move common methods to Apache::Dispatch::Util and adjust @ISA for
Apache*::Dispatch modules to use common methods via inheritance - fred
Modified: trunk/lib/Apache/Dispatch/Util.pm
===================================================================
--- trunk/lib/Apache/Dispatch/Util.pm 2006-10-24 05:23:15 UTC (rev 54)
+++ trunk/lib/Apache/Dispatch/Util.pm 2007-07-20 06:41:37 UTC (rev 55)
@@ -350,8 +350,8 @@
else {
# <Location />
- $prefix .= "::";
- $times = $class_and_method =~ s/^/$prefix/e;
+ $times = 1;
+ $class_and_method = $prefix;
}
unless ($times) {
Modified: trunk/t/01plain.t
===================================================================
--- trunk/t/01plain.t 2006-10-24 05:23:15 UTC (rev 54)
+++ trunk/t/01plain.t 2007-07-20 06:41:37 UTC (rev 55)
@@ -4,7 +4,7 @@
use Apache::Test qw(ok plan :withtestmore );
use Apache::TestRequest qw(GET GET_OK);
-plan tests => 4, need_lwp;
+plan tests => 5, need_lwp;
# Test Apache2::Foo->dispatch_index
my $uri = '/plain';
@@ -24,3 +24,6 @@
$uri = '/plain/bar/baz';
ok GET_OK $uri;
+# Test root location special case
+$uri = '/';
+ok GET_OK $uri
Modified: trunk/t/conf/extra.last.conf.in
===================================================================
--- trunk/t/conf/extra.last.conf.in 2006-10-24 05:23:15 UTC (rev 54)
+++ trunk/t/conf/extra.last.conf.in 2007-07-20 06:41:37 UTC (rev 55)
@@ -6,6 +6,21 @@
PerlModule Apache::Dispatch
</IfDefine>
+ <Location />
+ SetHandler perl-script
+ DispatchRequire On
+ DispatchDebug 2
+ DispatchUpperCase On
+ <IfDefine APACHE2>
+ DispatchPrefix Apache2::Foo
+ PerlResponseHandler Apache2::Dispatch
+ </IfDefine>
+ <IfDefine APACHE1>
+ PerlHandler Apache::Dispatch
+ DispatchPrefix Apache::Foo
+ </IfDefine>
+ </Location>
+
<Location /plain>
SetHandler perl-script
DispatchRequire On
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: Fred M. <fr...@re...> - 2006-10-24 18:40:13
|
On Tue, 24 Oct 2006, Geoffrey Young wrote: > >> Ready 0.10_01 release > > +1 The 0.10_01 release is out, and should have propagated to your nearest CPAN mirror by the time you read this, or shortly after. Thanks for all the help on this Geoff. |
|
From: Geoffrey Y. <ge...@mo...> - 2006-10-24 18:24:43
|
> Ready 0.10_01 release +1 --Geoff |
|
From: <phr...@us...> - 2006-10-24 05:23:18
|
Revision: 54
http://svn.sourceforge.net/apache-dispatch/?rev=54&view=rev
Author: phred_moyer
Date: 2006-10-23 22:23:15 -0700 (Mon, 23 Oct 2006)
Log Message:
-----------
Fixed a bug with the Makefile.PL where mp1 was specified, but mp2 was
installed.
Ready 0.10_01 release
Modified Paths:
--------------
trunk/Changes
trunk/Makefile.PL
trunk/lib/Apache/Dispatch.pm
trunk/lib/Apache2/Dispatch.pm
Modified: trunk/Changes
===================================================================
--- trunk/Changes 2006-09-02 23:51:12 UTC (rev 53)
+++ trunk/Changes 2006-10-24 05:23:15 UTC (rev 54)
@@ -1,6 +1,6 @@
Revision history for Perl extension Apache::Dispatch
-0.10 06.07.2006
+0.10_01 10.23.2006
- move common methods to Apache::Dispatch::Util and adjust @ISA for
Apache*::Dispatch modules to use common methods via inheritance - fred
- deprecated $Apache::Dispatch::DEBUG directive per dev notes in favor
Modified: trunk/Makefile.PL
===================================================================
--- trunk/Makefile.PL 2006-09-02 23:51:12 UTC (rev 53)
+++ trunk/Makefile.PL 2006-10-24 05:23:15 UTC (rev 54)
@@ -71,7 +71,7 @@
my %prereq = ();
-my %makefile_params = ( 'VERSION' => '0.10', );
+my %makefile_params = ( 'VERSION' => '0.10_01', );
if ( $mp_wanted == 2 ) { # mod_perl2 specific makefile
$prereq{'mod_perl2'} = 1.99023; # this covers the naming change
@@ -237,7 +237,7 @@
elsif ( $wanted == 1 ) {
eval { require mod_perl };
no warnings qw(uninitialized);
- if ( $mod_perl::VERSION > 1.99 || $@ ) {
+ if ( $@ ) {
die "You don't seem to have mod_perl 1.0 installed, see INSTALL\n";
}
else {
Modified: trunk/lib/Apache/Dispatch.pm
===================================================================
--- trunk/lib/Apache/Dispatch.pm 2006-09-02 23:51:12 UTC (rev 53)
+++ trunk/lib/Apache/Dispatch.pm 2006-10-24 05:23:15 UTC (rev 54)
@@ -11,7 +11,7 @@
use strict;
use warnings;
-our $VERSION = '0.10';
+our $VERSION = '0.10_01';
use mod_perl 1.2401;
use Apache::Constants qw(OK DECLINED SERVER_ERROR);
Modified: trunk/lib/Apache2/Dispatch.pm
===================================================================
--- trunk/lib/Apache2/Dispatch.pm 2006-09-02 23:51:12 UTC (rev 53)
+++ trunk/lib/Apache2/Dispatch.pm 2006-10-24 05:23:15 UTC (rev 54)
@@ -9,7 +9,7 @@
use strict;
use warnings;
-$Apache2::Dispatch::VERSION = '0.10';
+$Apache2::Dispatch::VERSION = '0.10_01';
use mod_perl2 1.99023;
use Apache2::Const -compile => qw(OK DECLINED SERVER_ERROR);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: Fred M. <fr...@re...> - 2006-09-02 23:53:51
|
Should play nicely now with -httpd options. The solution I took is a bit verbose but it seems to work well. One interesting thing I noticed was that the use constant HAS_APACHE_TEST snippet was not happy on OS X so I changed it to use a variable instead like Apache::SizeLimit. Hmmm... Geoff if you have time take this one for a spin, I think this is the one :) I'll bug Philip also, maybe he can try a build for us. On Sat, 2 Sep 2006, phr...@us... wrote: > Revision: 52 > http://svn.sourceforge.net/apache-dispatch/?rev=52&view=rev > Author: phred_moyer > Date: 2006-09-02 16:44:15 -0700 (Sat, 02 Sep 2006) > > Log Message: > ----------- > More build changes based on Geoff's test results, Philip's feeback, > and testing on OS X. The Makefile.PL is a bit klunky but it seems to cover > all the bases right now. I've updated the INSTALL also. > > Modified Paths: > -------------- > trunk/INSTALL > trunk/Makefile.PL > > Modified: trunk/INSTALL > =================================================================== > --- trunk/INSTALL 2006-08-12 20:47:13 UTC (rev 51) > +++ trunk/INSTALL 2006-09-02 23:44:15 UTC (rev 52) > @@ -1,11 +1,17 @@ > -Install and guess which version of mod_perl you use, defaulting to mp2 if both > -exist. > +------------------------------------------------------------------------------ > +Install Apache::Dispatch for mod_perl 1. > > -perl Makefile.PL > +perl Makefile.PL -httpd /path/to/my/httpd > make && make test && make install > > ------------------------------------------------------------------------------ > +Install Apache2::Dispatch for mod_perl 2. > > +perl Makefile.PL -httpd /path/to/my/httpd -apxs /path/to/my/apxs > +make && make test && make install > + > +------------------------------------------------------------------------------ > + > Install Apache2::Dispatch explicitly for mod_perl2. > > perl Makefile.PL MOD_PERL=2 > > Modified: trunk/Makefile.PL > =================================================================== > --- trunk/Makefile.PL 2006-08-12 20:47:13 UTC (rev 51) > +++ trunk/Makefile.PL 2006-09-02 23:44:15 UTC (rev 52) > @@ -9,7 +9,7 @@ > use Apache::Dispatch::Util; > use ExtUtils::MakeMaker; > > -use constant HAS_APACHE_TEST => eval { > +my $HAS_APACHE_TEST = eval { > require Apache::Test; > require Apache::TestMM; > > @@ -17,20 +17,22 @@ > Apache::TestMM::filter_args(); > > my %args = @Apache::TestMM::Argv; > - > - die 'suitable httpd required' > - unless ( $args{apxs} > + return 0 > + unless ( > + ( > + Apache::TestConfig->can('custom_config_path') > + and -f Apache::TestConfig->custom_config_path() > + ) > + or $args{apxs} > or $args{httpd} > or $ENV{APACHE_TEST_HTTPD} > - or $ENV{APACHE_TEST_APXS} ); > + or $ENV{APACHE_TEST_APXS} > + ); > > Apache::TestMM::generate_script('t/TEST'); > - > - return Apache::TestMM->test; > + return 1; > }; > > -warn $@ if $@; > - > sub MY::test { > > eval { require Test::More } or return <<EOF; > @@ -40,7 +42,7 @@ > \t\@echo > EOF > > - return HAS_APACHE_TEST if HAS_APACHE_TEST; > + return $HAS_APACHE_TEST if $HAS_APACHE_TEST; > > return <<EOF > test:: > @@ -53,7 +55,7 @@ > > sub MY::clean { > > - if (HAS_APACHE_TEST) { > + if ($HAS_APACHE_TEST) { > require Apache::TestMM; > > return Apache::TestMM::clean(@_); > @@ -79,7 +81,7 @@ > WriteMakefile(%makefile_params); > } > > -elsif ( $mp_wanted != 2 ) { # mod_perl1 specific makefile > +elsif ( $mp_wanted == 1 ) { # mod_perl1 specific makefile > eval { > require Apache::ExtUtils; > require Apache::src; > @@ -123,6 +125,47 @@ > > sub get_mp_ver { > > + my $at_ver; > + my %at_args; > + if ($HAS_APACHE_TEST) { > + %at_args = @Apache::TestMM::Argv; > + } elsif ( @ARGV ) { > + %at_args = @ARGV; > + $at_args{'httpd'} = $at_args{'-httpd'}; > + $at_args{'apxs'} = $at_args{'-apxs'}; > + } > + > + if ( $at_args{'apxs'} && $at_args{'httpd'} ) { > + > + # probably mp2 > + ($at_ver) = `$at_args{'httpd'} -v` =~ m!Apache\/(\d{1})!; > + if ( $at_ver == 1 ) { > + die <<EOF; > +Sorry dynamic builds are not supported for mod_perl 1 > +EOF > + } elsif (!$at_ver) { > + die <<EOF; > +Couldn't determine an apache version from your -httpd argument > +EOF > + } > + } > + elsif ( $at_args{'httpd'} ) { > + > + # probably mp1 > + ($at_ver) = `$at_args{'httpd'} -v` =~ m!Apache\/(\d{1})!; > + if ( $at_ver == 2 ) { # static build for mp2 not supported > + die <<EOF; > +You specified -httpd, and httpd version is 2, but static > +builds in mp2 are not yet supported. Please see INSTALL > +or specify a -apxs /path/to/apxs option. > +EOF > + } > + unless ( $at_ver == 1 ) { > + die <<EOF; > +Couldn't determine an apache version from your -httpd argument > +EOF > + } > + } > my $flag = 0; > my @args = (); > > @@ -147,35 +190,61 @@ > enviroment variable MOD_PERL=$env > Makefile.PL option MOD_PERL=$flag > EOF > -} > + } > > -my $wanted = 2; ## default to wanting mp2 > -$wanted = 1 if $env == 1 || $flag == 1; > + my $wanted; > + $wanted = 2 if $env == 2 || $flag == 2 || $at_ver == 2; > + $wanted = 1 if $env == 1 || $flag == 1 || $at_ver == 1; > > -my $mp_ver; > + unless ($wanted) { > > -if ( $wanted == 2 ) { > - eval { require mod_perl2 }; > - my $req_ver = 1.999022; > - if ( $mod_perl2::VERSION < $req_ver || $@ ) { > - die > -"mod_perl2 required version is $req_ver, you have $mod_perl2::VERSION. Please upgrade to continue."; > + # if still unknown try to require mod_perl.pm > + eval { require mod_perl2 }; > + if ($@) { > + > + # if we don't have mp1, check for mp2 > + eval { require mod_perl } if ($@); > + unless ($@) { > + $wanted = 1; > + } > + } > + else { > + $wanted = 2; > + } > } > - else { > - $mp_ver = $mod_perl2::VERSION; > + > + if ( !$wanted ) { > + die "can't determine your mod_perl version, see INSTALL\n"; > } > -} > -else { > - eval { require mod_perl }; > - no warnings qw(uninitialized); > - if ( $mod_perl::VERSION > 1.99 || $@ ) { > - die "You don't seem to have mod_perl 1.0 installed"; > + elsif ( !( $wanted == 1 || $wanted == 2 ) ) { > + die "don't know anything about mod_perl generation: $wanted\n" > + . "currently supporting only generations 1 and 2"; > } > - else { > - $mp_ver = $mod_perl::VERSION; > + > + my $mp_ver; > + > + if ( $wanted == 2 ) { > + eval { require mod_perl2 }; > + my $req_ver = 1.999022; > + if ( $mod_perl2::VERSION < $req_ver || $@ ) { > + die > +"mod_perl2 required version is $req_ver, you have $mod_perl2::VERSION. Please upgrade to continue."; > + } > + else { > + $mp_ver = $mod_perl2::VERSION; > + } > } > -} > + elsif ( $wanted == 1 ) { > + eval { require mod_perl }; > + no warnings qw(uninitialized); > + if ( $mod_perl::VERSION > 1.99 || $@ ) { > + die "You don't seem to have mod_perl 1.0 installed, see INSTALL\n"; > + } > + else { > + $mp_ver = $mod_perl::VERSION; > + } > + } > > -return ( $wanted, $mp_ver ); > + return ( $wanted, $mp_ver ); > } > > > > This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Apache-dispatch-devel mailing list > Apa...@li... > https://lists.sourceforge.net/lists/listinfo/apache-dispatch-devel > |
|
From: <phr...@us...> - 2006-09-02 23:51:13
|
Revision: 53
http://svn.sourceforge.net/apache-dispatch/?rev=53&view=rev
Author: phred_moyer
Date: 2006-09-02 16:51:12 -0700 (Sat, 02 Sep 2006)
Log Message:
-----------
Update copyright and maintainer information.
Modified Paths:
--------------
trunk/README
trunk/lib/Apache/Dispatch.pm
trunk/lib/Apache2/Dispatch.pm
Modified: trunk/README
===================================================================
--- trunk/README 2006-09-02 23:44:15 UTC (rev 52)
+++ trunk/README 2006-09-02 23:51:12 UTC (rev 53)
@@ -301,6 +301,10 @@
perl(1), mod_perl(1), Apache(3), Apache::Filter(3), Apache::Reload(3),
Apache::StatINC(3)
+MAINTAINER
+
+Fred Moyer <ph...@ap...>
+
AUTHOR
Geoffrey Young <ge...@cp...>
Modified: trunk/lib/Apache/Dispatch.pm
===================================================================
--- trunk/lib/Apache/Dispatch.pm 2006-09-02 23:44:15 UTC (rev 52)
+++ trunk/lib/Apache/Dispatch.pm 2006-09-02 23:51:12 UTC (rev 53)
@@ -627,13 +627,17 @@
perl(1), mod_perl(1), Apache(3), Apache::Filter(3), Apache::Reload(3),
Apache::StatINC(3)
+=head1 MAINTAINER
+
+Fred Moyer <ph...@ap...>
+
=head1 AUTHOR
Geoffrey Young <ge...@cp...>
=head1 COPYRIGHT
-Copyright 2001 Geoffrey Young - all rights reserved.
+Copyright 2001-2006 Geoffrey Young - all rights reserved.
This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
Modified: trunk/lib/Apache2/Dispatch.pm
===================================================================
--- trunk/lib/Apache2/Dispatch.pm 2006-09-02 23:44:15 UTC (rev 52)
+++ trunk/lib/Apache2/Dispatch.pm 2006-09-02 23:51:12 UTC (rev 53)
@@ -518,13 +518,17 @@
perl(1), mod_perl(1), Apache(3), Apache::Filter(3), Apache::Reload(3),
Apache::StatINC(3)
+=head1 MAINTAINER
+
+Fred Moyer <ph...@ap...>
+
=head1 AUTHOR
Geoffrey Young <ge...@cp...>
=head1 COPYRIGHT
-Copyright 2001 Geoffrey Young - all rights reserved.
+Copyright 2001-2006 Geoffrey Young - all rights reserved.
This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <phr...@us...> - 2006-09-02 23:44:18
|
Revision: 52
http://svn.sourceforge.net/apache-dispatch/?rev=52&view=rev
Author: phred_moyer
Date: 2006-09-02 16:44:15 -0700 (Sat, 02 Sep 2006)
Log Message:
-----------
More build changes based on Geoff's test results, Philip's feeback,
and testing on OS X. The Makefile.PL is a bit klunky but it seems to cover
all the bases right now. I've updated the INSTALL also.
Modified Paths:
--------------
trunk/INSTALL
trunk/Makefile.PL
Modified: trunk/INSTALL
===================================================================
--- trunk/INSTALL 2006-08-12 20:47:13 UTC (rev 51)
+++ trunk/INSTALL 2006-09-02 23:44:15 UTC (rev 52)
@@ -1,11 +1,17 @@
-Install and guess which version of mod_perl you use, defaulting to mp2 if both
-exist.
+------------------------------------------------------------------------------
+Install Apache::Dispatch for mod_perl 1.
-perl Makefile.PL
+perl Makefile.PL -httpd /path/to/my/httpd
make && make test && make install
------------------------------------------------------------------------------
+Install Apache2::Dispatch for mod_perl 2.
+perl Makefile.PL -httpd /path/to/my/httpd -apxs /path/to/my/apxs
+make && make test && make install
+
+------------------------------------------------------------------------------
+
Install Apache2::Dispatch explicitly for mod_perl2.
perl Makefile.PL MOD_PERL=2
Modified: trunk/Makefile.PL
===================================================================
--- trunk/Makefile.PL 2006-08-12 20:47:13 UTC (rev 51)
+++ trunk/Makefile.PL 2006-09-02 23:44:15 UTC (rev 52)
@@ -9,7 +9,7 @@
use Apache::Dispatch::Util;
use ExtUtils::MakeMaker;
-use constant HAS_APACHE_TEST => eval {
+my $HAS_APACHE_TEST = eval {
require Apache::Test;
require Apache::TestMM;
@@ -17,20 +17,22 @@
Apache::TestMM::filter_args();
my %args = @Apache::TestMM::Argv;
-
- die 'suitable httpd required'
- unless ( $args{apxs}
+ return 0
+ unless (
+ (
+ Apache::TestConfig->can('custom_config_path')
+ and -f Apache::TestConfig->custom_config_path()
+ )
+ or $args{apxs}
or $args{httpd}
or $ENV{APACHE_TEST_HTTPD}
- or $ENV{APACHE_TEST_APXS} );
+ or $ENV{APACHE_TEST_APXS}
+ );
Apache::TestMM::generate_script('t/TEST');
-
- return Apache::TestMM->test;
+ return 1;
};
-warn $@ if $@;
-
sub MY::test {
eval { require Test::More } or return <<EOF;
@@ -40,7 +42,7 @@
\t\@echo
EOF
- return HAS_APACHE_TEST if HAS_APACHE_TEST;
+ return $HAS_APACHE_TEST if $HAS_APACHE_TEST;
return <<EOF
test::
@@ -53,7 +55,7 @@
sub MY::clean {
- if (HAS_APACHE_TEST) {
+ if ($HAS_APACHE_TEST) {
require Apache::TestMM;
return Apache::TestMM::clean(@_);
@@ -79,7 +81,7 @@
WriteMakefile(%makefile_params);
}
-elsif ( $mp_wanted != 2 ) { # mod_perl1 specific makefile
+elsif ( $mp_wanted == 1 ) { # mod_perl1 specific makefile
eval {
require Apache::ExtUtils;
require Apache::src;
@@ -123,6 +125,47 @@
sub get_mp_ver {
+ my $at_ver;
+ my %at_args;
+ if ($HAS_APACHE_TEST) {
+ %at_args = @Apache::TestMM::Argv;
+ } elsif ( @ARGV ) {
+ %at_args = @ARGV;
+ $at_args{'httpd'} = $at_args{'-httpd'};
+ $at_args{'apxs'} = $at_args{'-apxs'};
+ }
+
+ if ( $at_args{'apxs'} && $at_args{'httpd'} ) {
+
+ # probably mp2
+ ($at_ver) = `$at_args{'httpd'} -v` =~ m!Apache\/(\d{1})!;
+ if ( $at_ver == 1 ) {
+ die <<EOF;
+Sorry dynamic builds are not supported for mod_perl 1
+EOF
+ } elsif (!$at_ver) {
+ die <<EOF;
+Couldn't determine an apache version from your -httpd argument
+EOF
+ }
+ }
+ elsif ( $at_args{'httpd'} ) {
+
+ # probably mp1
+ ($at_ver) = `$at_args{'httpd'} -v` =~ m!Apache\/(\d{1})!;
+ if ( $at_ver == 2 ) { # static build for mp2 not supported
+ die <<EOF;
+You specified -httpd, and httpd version is 2, but static
+builds in mp2 are not yet supported. Please see INSTALL
+or specify a -apxs /path/to/apxs option.
+EOF
+ }
+ unless ( $at_ver == 1 ) {
+ die <<EOF;
+Couldn't determine an apache version from your -httpd argument
+EOF
+ }
+ }
my $flag = 0;
my @args = ();
@@ -147,35 +190,61 @@
enviroment variable MOD_PERL=$env
Makefile.PL option MOD_PERL=$flag
EOF
-}
+ }
-my $wanted = 2; ## default to wanting mp2
-$wanted = 1 if $env == 1 || $flag == 1;
+ my $wanted;
+ $wanted = 2 if $env == 2 || $flag == 2 || $at_ver == 2;
+ $wanted = 1 if $env == 1 || $flag == 1 || $at_ver == 1;
-my $mp_ver;
+ unless ($wanted) {
-if ( $wanted == 2 ) {
- eval { require mod_perl2 };
- my $req_ver = 1.999022;
- if ( $mod_perl2::VERSION < $req_ver || $@ ) {
- die
-"mod_perl2 required version is $req_ver, you have $mod_perl2::VERSION. Please upgrade to continue.";
+ # if still unknown try to require mod_perl.pm
+ eval { require mod_perl2 };
+ if ($@) {
+
+ # if we don't have mp1, check for mp2
+ eval { require mod_perl } if ($@);
+ unless ($@) {
+ $wanted = 1;
+ }
+ }
+ else {
+ $wanted = 2;
+ }
}
- else {
- $mp_ver = $mod_perl2::VERSION;
+
+ if ( !$wanted ) {
+ die "can't determine your mod_perl version, see INSTALL\n";
}
-}
-else {
- eval { require mod_perl };
- no warnings qw(uninitialized);
- if ( $mod_perl::VERSION > 1.99 || $@ ) {
- die "You don't seem to have mod_perl 1.0 installed";
+ elsif ( !( $wanted == 1 || $wanted == 2 ) ) {
+ die "don't know anything about mod_perl generation: $wanted\n"
+ . "currently supporting only generations 1 and 2";
}
- else {
- $mp_ver = $mod_perl::VERSION;
+
+ my $mp_ver;
+
+ if ( $wanted == 2 ) {
+ eval { require mod_perl2 };
+ my $req_ver = 1.999022;
+ if ( $mod_perl2::VERSION < $req_ver || $@ ) {
+ die
+"mod_perl2 required version is $req_ver, you have $mod_perl2::VERSION. Please upgrade to continue.";
+ }
+ else {
+ $mp_ver = $mod_perl2::VERSION;
+ }
}
-}
+ elsif ( $wanted == 1 ) {
+ eval { require mod_perl };
+ no warnings qw(uninitialized);
+ if ( $mod_perl::VERSION > 1.99 || $@ ) {
+ die "You don't seem to have mod_perl 1.0 installed, see INSTALL\n";
+ }
+ else {
+ $mp_ver = $mod_perl::VERSION;
+ }
+ }
-return ( $wanted, $mp_ver );
+ return ( $wanted, $mp_ver );
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: Fred M. <fr...@ta...> - 2006-08-30 15:24:24
|
On Wed, 30 Aug 2006, Geoffrey Young wrote: >> I've tried an install here on a different system and it barked a bit about >> couldn't finding Apache::Test but then built properly. I built >> Apache::SizeLimit trunk in the same conditions and it refused to build >> because it couldn't find a mod_perl enabled Apache. > > hmm, that's odd. I'll spin it up again and report back to Philip. >> Any thoughts on these test results? > > they seem ok :) > > when I gave it a runthrough I met this problem when testing against mp1 > > [geoff@spinnaker Apache-Dispatch-svn]$ perl Makefile.PL -httpd > /usr/local/apache/bin/httpd && make && make test Ah good stuff. I tried something like this on my powerbook at work and encountered a different error because my stock httpd was not mod_perl enabled, but then I wondered 'how many people will this really affect', and I think you've answered that. > [ info] generating script t/TEST > Using mod_perl/2.000003 .... > waiting 60 seconds for server to start: .Syntax error on line 18 of > /src/Apache-Dispatch-svn/t/conf/extra.last.conf: > Can't locate loadable object for module Apache::Dispatch in @INC > > so, the problem is that I didn't use MOD_PERL=1 in my build args. which > I kinda remembered about, but I'm pretty sure a random user would be > very confused by the message - the mp2 line above was my only clue after > staring at the error for a few minues. I agree, it's not informative. I guess what I'm still wondering is since a random user would most likely install from CPAN, what is their setup going to be like? Will they have a mod_perl enabled Apache in their path? My guess is the random user will not, but instead it's built somewhere else - could be wrong though. An expert user like you will use the -httpd option so it sounds like we want to make sure to hit both those use cases. > so you might want to think about that a bit. but other than that I > think sufficient work has gone into this that you should feel to release > whenever the moment strikes you. as long as you keep the current CPAN > version available in case things go awry, there's no real reason to hold > off I'd think. and, you should be rewarded for all your hard work :) I'll hit this again this week and see if I can fix the error you ran into. There's a lot of possible build cases here, it seems like this is a common situation for mp1/mp2 Apache::* modules but there is no common build solution that fits all yet. Thanks for your help testing this Geoff, I appreciate it :) |
|
From: Geoffrey Y. <ge...@mo...> - 2006-08-30 14:15:29
|
> I've tried an install here on a different system and it barked a bit about > couldn't finding Apache::Test but then built properly. I built > Apache::SizeLimit trunk in the same conditions and it refused to build > because it couldn't find a mod_perl enabled Apache. hmm, that's odd. > > Any thoughts on these test results? they seem ok :) when I gave it a runthrough I met this problem when testing against mp1 [geoff@spinnaker Apache-Dispatch-svn]$ perl Makefile.PL -httpd /usr/local/apache/bin/httpd && make && make test [ info] generating script t/TEST Using mod_perl/2.000003 ... t/TEST -bugreport -verbose=0 /usr/local/apache/bin/httpd -d /src/Apache-Dispatch-svn/t -f /src/Apache-Dispatch-svn/t/conf/httpd.conf -D APACHE1 -D PERL_USEITHREADS using Apache/1.3.36 waiting 60 seconds for server to start: .Syntax error on line 18 of /src/Apache-Dispatch-svn/t/conf/extra.last.conf: Can't locate loadable object for module Apache::Dispatch in @INC so, the problem is that I didn't use MOD_PERL=1 in my build args. which I kinda remembered about, but I'm pretty sure a random user would be very confused by the message - the mp2 line above was my only clue after staring at the error for a few minues. so you might want to think about that a bit. but other than that I think sufficient work has gone into this that you should feel to release whenever the moment strikes you. as long as you keep the current CPAN version available in case things go awry, there's no real reason to hold off I'd think. and, you should be rewarded for all your hard work :) --Geoff |
|
From: Fred M. <fr...@re...> - 2006-08-29 05:29:02
|
On Sat, 12 Aug 2006, Fred Moyer wrote:
>> anyway, I hope this helps clear things up a bit. I'm happy to work on
>
> I just made all these changes with revision 51. This revision makes
> things a lot cleaner, and I've got a better understanding of Apache::Test
> now. I ran the following [1] test scenarios by removing the appropriate
> dependencies, all tests are passing, let me know what you think Geoff.
I've tried an install here on a different system and it barked a bit about
couldn't finding Apache::Test but then built properly. I built
Apache::SizeLimit trunk in the same conditions and it refused to build
because it couldn't find a mod_perl enabled Apache.
Any thoughts on these test results? Admittedly it's not perfect but it
builds and installs ok for me on two different systems, and tests just
fine if you have the $ENV{APACHE_TEST_HTTPD} and friends configured
properly.
> [1]
> ---------------------------
> No mod_perl.c
>
> mp1 =>
> t/all....skipped
> all skipped: cannot find module 'mod_perl.c'
>
> mp2 =>
> t/all....skipped
> all skipped: cannot find module 'mod_perl.c'
>
> ---------
> No Apache::Test
>
> mp1 => sorry, cannot run tests without a properly
> configured Apache-Test environment
>
> mp2 => sorry, cannot run tests without a properly
> configured Apache-Test environment
> --------------
> Apache::Test 1.28, No Apache::Filter
>
> mp1 =>
> t/01plain.....ok
> t/02extras....ok
> t/03filter....skipped
> all skipped: You need Apache::Filter to run this test
> t/04oo........ok
> All tests successful, 1 test skipped.
>
> mp2 =>
> t/01plain.....ok
> t/02extras....ok
> t/03filter....skipped
> all skipped: Filtering not yet implemented in Apache2::Dispatch
> t/04oo........ok
>
> -------------------
> Apache::Test 1.28, Apache::Filter 1.024 installed
>
> mp1 =>
> t/01plain.....ok
> t/02extras....ok
> t/03filter....ok
> t/04oo........ok
> All tests successful.
>
> mp2 =>
> t/01plain.....ok
> t/02extras....ok
> t/03filter....skipped
> all skipped: Filtering not yet implemented in Apache2::Dispatch
> t/04oo........ok
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Apache-dispatch-devel mailing list
> Apa...@li...
> https://lists.sourceforge.net/lists/listinfo/apache-dispatch-devel
>
|
|
From: Fred M. <fr...@ta...> - 2006-08-12 21:12:02
|
> substitute these for
>
> use Apache::Test qw(:withtestmore);
I did this but I had to
use Apache::Test qw(ok plan :withtestmore );
or it complained when it got to
plan tests => 4, need_lwp;
because it didn't recognize plan unless it was explicitly imported. This
is with Apache::Test 1.28, Test::More 0.62, all tests passing.
> anyway, I hope this helps clear things up a bit. I'm happy to work on
I just made all these changes with revision 51. This revision makes
things a lot cleaner, and I've got a better understanding of Apache::Test
now. I ran the following [1] test scenarios by removing the appropriate
dependencies, all tests are passing, let me know what you think Geoff.
[1]
---------------------------
No mod_perl.c
mp1 =>
t/all....skipped
all skipped: cannot find module 'mod_perl.c'
mp2 =>
t/all....skipped
all skipped: cannot find module 'mod_perl.c'
---------
No Apache::Test
mp1 => sorry, cannot run tests without a properly
configured Apache-Test environment
mp2 => sorry, cannot run tests without a properly
configured Apache-Test environment
--------------
Apache::Test 1.28, No Apache::Filter
mp1 =>
t/01plain.....ok
t/02extras....ok
t/03filter....skipped
all skipped: You need Apache::Filter to run this test
t/04oo........ok
All tests successful, 1 test skipped.
mp2 =>
t/01plain.....ok
t/02extras....ok
t/03filter....skipped
all skipped: Filtering not yet implemented in Apache2::Dispatch
t/04oo........ok
-------------------
Apache::Test 1.28, Apache::Filter 1.024 installed
mp1 =>
t/01plain.....ok
t/02extras....ok
t/03filter....ok
t/04oo........ok
All tests successful.
mp2 =>
t/01plain.....ok
t/02extras....ok
t/03filter....skipped
all skipped: Filtering not yet implemented in Apache2::Dispatch
t/04oo........ok
|
|
From: <phr...@us...> - 2006-08-12 20:47:18
|
Revision: 51 Author: phred_moyer Date: 2006-08-12 13:47:13 -0700 (Sat, 12 Aug 2006) ViewCVS: http://svn.sourceforge.net/apache-dispatch/?rev=51&view=rev Log Message: ----------- Fix missing 'require Apache::Filter' in Apache::Dispatch Add t/all.t to skip all tests if mod_perl is not installed Remove file Apache::Dispatch::TestConfig in favor of better solution Import Test::More methods via use 'Apache::Test qw(ok plan :withtestmore );' Use skip_reason instead of skip_all in t/03filter.t Add IfModule conditional to test conf in case mod_perl is not installed Modified Paths: -------------- trunk/MANIFEST trunk/Makefile.PL trunk/lib/Apache/Dispatch.pm trunk/t/01plain.t trunk/t/02extras.t trunk/t/03filter.t trunk/t/04oo.t trunk/t/conf/extra.last.conf.in Added Paths: ----------- trunk/t/all.t Removed Paths: ------------- trunk/lib/Apache/Dispatch/TestConfig.pm Modified: trunk/MANIFEST =================================================================== --- trunk/MANIFEST 2006-08-02 04:47:49 UTC (rev 50) +++ trunk/MANIFEST 2006-08-12 20:47:13 UTC (rev 51) @@ -8,7 +8,6 @@ set_pureperl.PL lib/Apache/Dispatch.pm lib/Apache/Dispatch/Util.pm -lib/Apache/Dispatch/TestConfig.pm lib/Apache2/Dispatch.pm t/lib/Apache/Bar.pm t/lib/Apache/Foo.pm @@ -17,6 +16,7 @@ t/lib/Apache/Foo/Filter.pm t/lib/Apache2/Foo.pm t/lib/Apache2/Foo/Bar.pm +t/all.t t/01plain.t t/02extras.t t/03filter.t Modified: trunk/Makefile.PL =================================================================== --- trunk/Makefile.PL 2006-08-02 04:47:49 UTC (rev 50) +++ trunk/Makefile.PL 2006-08-12 20:47:13 UTC (rev 51) @@ -33,25 +33,22 @@ sub MY::test { - my $test = shift->MM::test(@_); - eval { require Test::More } or return <<EOF; test:: +\t\@echo \t\@echo sorry, cannot run tests without Test::More +\t\@echo EOF return HAS_APACHE_TEST if HAS_APACHE_TEST; - if ( eval { require Devel::Cover } ) { - $test .= <<EOF; -testcover :: - cover -delete - HARNESS_PERL_SWITCHES=-MDevel::Cover make test - cover + return <<EOF +test:: +\t\@echo +\t\@echo sorry, cannot run tests without a properly +\t\@echo configured Apache-Test environment +\t\@echo EOF - } - - return $test; } sub MY::clean { @@ -70,7 +67,7 @@ print STDERR "Using mod_perl/$mp_ver\n\n"; -my %prereq = ( 'Apache::Test' => "1.23" ); +my %prereq = (); my %makefile_params = ( 'VERSION' => '0.10', ); @@ -150,35 +147,35 @@ enviroment variable MOD_PERL=$env Makefile.PL option MOD_PERL=$flag EOF - } +} - my $wanted = 2; ## default to wanting mp2 - $wanted = 1 if $env == 1 || $flag == 1; +my $wanted = 2; ## default to wanting mp2 +$wanted = 1 if $env == 1 || $flag == 1; - my $mp_ver; +my $mp_ver; - if ( $wanted == 2 ) { - eval { require mod_perl2 }; - my $req_ver = 1.999022; - if ( $mod_perl2::VERSION < $req_ver || $@ ) { - die +if ( $wanted == 2 ) { + eval { require mod_perl2 }; + my $req_ver = 1.999022; + if ( $mod_perl2::VERSION < $req_ver || $@ ) { + die "mod_perl2 required version is $req_ver, you have $mod_perl2::VERSION. Please upgrade to continue."; - } - else { - $mp_ver = $mod_perl2::VERSION; - } } else { - eval { require mod_perl }; - no warnings qw(uninitialized); - if ( $mod_perl::VERSION > 1.99 || $@ ) { - die "You don't seem to have mod_perl 1.0 installed"; - } - else { - $mp_ver = $mod_perl::VERSION; - } + $mp_ver = $mod_perl2::VERSION; } +} +else { + eval { require mod_perl }; + no warnings qw(uninitialized); + if ( $mod_perl::VERSION > 1.99 || $@ ) { + die "You don't seem to have mod_perl 1.0 installed"; + } + else { + $mp_ver = $mod_perl::VERSION; + } +} - return ( $wanted, $mp_ver ); +return ( $wanted, $mp_ver ); } Deleted: trunk/lib/Apache/Dispatch/TestConfig.pm =================================================================== --- trunk/lib/Apache/Dispatch/TestConfig.pm 2006-08-02 04:47:49 UTC (rev 50) +++ trunk/lib/Apache/Dispatch/TestConfig.pm 2006-08-12 20:47:13 UTC (rev 51) @@ -1,19 +0,0 @@ -package Apache::Dispatch::TestConfig; - -use strict; -use warnings FATAL => 'all'; - -our $HAS_APACHE_TEST = eval { - require Apache::Test; - Apache::Test->import(qw(have_lwp)); - - Apache::TestRequest->import(qw(GET_BODY_ASSERT)); - - require Apache::TestUtil; - Apache::TestUtil->import(qw(t_write_perl_script)); - - require Apache::TestServer; - return Apache::TestServer->new->{config}->{vars}->{httpd}; -}; - -1; \ No newline at end of file Modified: trunk/lib/Apache/Dispatch.pm =================================================================== --- trunk/lib/Apache/Dispatch.pm 2006-08-02 04:47:49 UTC (rev 50) +++ trunk/lib/Apache/Dispatch.pm 2006-08-12 20:47:13 UTC (rev 51) @@ -98,7 +98,8 @@ # in case we used DispatchFilter directive instead, make sure # that other filters in the chain recognize us... $r->dir_config->set(Filter => 'On'); - + + require Apache::Filter; $r = $r->filter_register; $log = $r->server->log; } Modified: trunk/t/01plain.t =================================================================== --- trunk/t/01plain.t 2006-08-02 04:47:49 UTC (rev 50) +++ trunk/t/01plain.t 2006-08-12 20:47:13 UTC (rev 51) @@ -1,17 +1,11 @@ use strict; use warnings FATAL => 'all'; -use Apache::Dispatch::TestConfig; -use Test::More; +use Apache::Test qw(ok plan :withtestmore ); +use Apache::TestRequest qw(GET GET_OK); -plan skip_all => 'Apache::Test not configured' - unless $Apache::Dispatch::TestConfig::HAS_APACHE_TEST; +plan tests => 4, need_lwp; -plan skip_all => 'test library dependencies not met' - unless eval { have_lwp() }; - -plan tests => 4; - # Test Apache2::Foo->dispatch_index my $uri = '/plain'; ok GET_OK $uri; Modified: trunk/t/02extras.t =================================================================== --- trunk/t/02extras.t 2006-08-02 04:47:49 UTC (rev 50) +++ trunk/t/02extras.t 2006-08-12 20:47:13 UTC (rev 51) @@ -1,17 +1,11 @@ use strict; use warnings FATAL => 'all'; -use Apache::Dispatch::TestConfig; -use Test::More; +use Apache::Test qw(ok plan :withtestmore ); +use Apache::TestRequest qw(GET); -plan skip_all => 'Apache::Test not configured' - unless $Apache::Dispatch::TestConfig::HAS_APACHE_TEST; +plan tests => 5, need_lwp; -plan skip_all => 'test library dependencies not met' - unless eval { have_lwp() }; - -plan tests => 5; - my $uri = '/extras'; my $res = GET $uri; ok $res->code == 200; Modified: trunk/t/03filter.t =================================================================== --- trunk/t/03filter.t 2006-08-02 04:47:49 UTC (rev 50) +++ trunk/t/03filter.t 2006-08-12 20:47:13 UTC (rev 51) @@ -1,30 +1,31 @@ use strict; use warnings FATAL => 'all'; -use Apache::Dispatch::TestConfig; -use Test::More; +use Apache::Test qw(ok plan :withtestmore ); +use Apache::TestRequest qw(GET); -plan skip_all => 'Apache::Test not configured' - unless $Apache::Dispatch::TestConfig::HAS_APACHE_TEST; - -plan skip_all => 'test library dependencies not met' - unless eval { have_lwp() }; - -# figure out what version we have - I don't like this method but it works +# figure out what version of apache we have we have my $httpd = Apache::Test::vars('httpd'); my $version = `$httpd -v`; -if ($version =~ m/Apache\/2/) { - plan skip_all => "Filtering not yet implemented in Apache2::Dispatch"; +if ( $version =~ m/Apache\/2/ ) { + plan + tests => 2, + skip_reason("Filtering not yet implemented in Apache2::Dispatch"); } else { - plan tests => 2; + if ( eval { require Apache::Filter } ) { + plan tests => 2, need_lwp; + } + else { + plan + tests => 2, + skip_reason("You need Apache::Filter to run this test"); + } } my $url = '/filtered/foo'; -eval { require Apache::Filter }; - my $res = GET $url; -ok($res->is_success); -ok($res->content =~ m/dispatchfoo/i); +ok( $res->is_success ); +ok( $res->content =~ m/dispatchfoo/i ); Modified: trunk/t/04oo.t =================================================================== --- trunk/t/04oo.t 2006-08-02 04:47:49 UTC (rev 50) +++ trunk/t/04oo.t 2006-08-12 20:47:13 UTC (rev 51) @@ -1,17 +1,11 @@ use strict; use warnings FATAL => 'all'; -use Apache::Dispatch::TestConfig; -use Test::More; +use Apache::Test qw(ok plan :withtestmore ); +use Apache::TestRequest qw(GET); -plan skip_all => 'Apache::Test not configured' - unless $Apache::Dispatch::TestConfig::HAS_APACHE_TEST; +plan tests => 2, need_lwp; -plan skip_all => 'test library dependencies not met' - unless eval { have_lwp() }; - -plan tests => 2; - my $url = '/oo/baz'; my $res = GET $url; Added: trunk/t/all.t =================================================================== --- trunk/t/all.t (rev 0) +++ trunk/t/all.t 2006-08-12 20:47:13 UTC (rev 51) @@ -0,0 +1,7 @@ +use strict; +use warnings FATAL => 'all'; + +use Apache::Test; +plan tests => 1, need_module('mod_perl.c'); + +ok(1); \ No newline at end of file Property changes on: trunk/t/all.t ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/t/conf/extra.last.conf.in =================================================================== --- trunk/t/conf/extra.last.conf.in 2006-08-02 04:47:49 UTC (rev 50) +++ trunk/t/conf/extra.last.conf.in 2006-08-12 20:47:13 UTC (rev 51) @@ -1,89 +1,89 @@ -<IfDefine APACHE2> - PerlLoadModule Apache2::Dispatch -</IfDefine> -<IfDefine APACHE1> - PerlModule Apache::Dispatch -</IfDefine> - -<Location /plain> - SetHandler perl-script - DispatchRequire On - DispatchDebug 2 - DispatchUpperCase On +<IfModule mod_perl.c> <IfDefine APACHE2> - DispatchPrefix Apache2::Foo - PerlResponseHandler Apache2::Dispatch + PerlLoadModule Apache2::Dispatch </IfDefine> <IfDefine APACHE1> - PerlHandler Apache::Dispatch - DispatchPrefix Apache::Foo + PerlModule Apache::Dispatch </IfDefine> -</Location> -<Location /filtered> - SetHandler perl-script - DispatchFilter On - DispatchRequire On - DispatchDebug 2 - <IfDefine APACHE2> - DispatchPrefix Apache2::Foo - PerlResponseHandler Apache2::Dispatch Apache2::Foo::Filter - </IfDefine> - <IfDefine APACHE1> - PerlModule Apache::Filter - DispatchPrefix Apache::Foo - PerlHandler Apache::Dispatch Apache::Foo::Filter - </IfDefine> -</Location> + <Location /plain> + SetHandler perl-script + DispatchRequire On + DispatchDebug 2 + DispatchUpperCase On + <IfDefine APACHE2> + DispatchPrefix Apache2::Foo + PerlResponseHandler Apache2::Dispatch + </IfDefine> + <IfDefine APACHE1> + PerlHandler Apache::Dispatch + DispatchPrefix Apache::Foo + </IfDefine> + </Location> -<Location /extras> - SetHandler perl-script - DispatchRequire On - DispatchExtras Pre Post Error - DispatchDebug 2 - <IfDefine APACHE2> - DispatchPrefix Apache2::Foo - PerlResponseHandler Apache2::Dispatch - </IfDefine> - <IfDefine APACHE1> - DispatchPrefix Apache::Foo - PerlHandler Apache::Dispatch - </IfDefine> -</Location> + <Location /filtered> + SetHandler perl-script + DispatchFilter On + DispatchRequire On + DispatchDebug 2 + <IfDefine APACHE2> + DispatchPrefix Apache2::Foo + PerlResponseHandler Apache2::Dispatch Apache2::Foo::Filter + </IfDefine> + <IfDefine APACHE1> + DispatchPrefix Apache::Foo + PerlHandler Apache::Dispatch Apache::Foo::Filter + </IfDefine> + </Location> -<Location /oo> - SetHandler perl-script - DispatchRequire On - DispatchAUTOLOAD On - DispatchDebug 2 - <IfDefine APACHE2> - DispatchPrefix Apache2::Foo - DispatchISA Apache2::Foo::Bar - PerlResponseHandler Apache2::Dispatch - </IfDefine> - <IfDefine APACHE1> - DispatchPrefix Apache::Foo - PerlModule Apache::Foo::Bar - DispatchISA Apache::Foo::Bar - PerlHandler Apache::Dispatch - </IfDefine> + <Location /extras> + SetHandler perl-script + DispatchRequire On + DispatchExtras Pre Post Error + DispatchDebug 2 + <IfDefine APACHE2> + DispatchPrefix Apache2::Foo + PerlResponseHandler Apache2::Dispatch + </IfDefine> + <IfDefine APACHE1> + DispatchPrefix Apache::Foo + PerlHandler Apache::Dispatch + </IfDefine> + </Location> + + <Location /oo> + SetHandler perl-script + DispatchRequire On + DispatchAUTOLOAD On + DispatchDebug 2 + <IfDefine APACHE2> + DispatchPrefix Apache2::Foo + DispatchISA Apache2::Foo::Bar + PerlResponseHandler Apache2::Dispatch + </IfDefine> + <IfDefine APACHE1> + DispatchPrefix Apache::Foo + PerlModule Apache::Foo::Bar + DispatchISA Apache::Foo::Bar + PerlHandler Apache::Dispatch + </IfDefine> -</Location> + </Location> -<Location /newloc> - SetHandler perl-script - DispatchLocation /BLARG - DispatchRequire On - DispatchDebug 2 + <Location /newloc> + SetHandler perl-script + DispatchLocation /BLARG + DispatchRequire On + DispatchDebug 2 + + <IfDefine APACHE2> + DispatchPrefix Apache2::Foo + PerlResponseHandler Apache::Dispatch + </IfDefine> + <IfDefine APACHE1> + DispatchPrefix Foo + PerlHandler Apache::Dispatch + </IfDefine> - <IfDefine APACHE2> - DispatchPrefix Apache2::Foo - PerlResponseHandler Apache::Dispatch - </IfDefine> - <IfDefine APACHE1> - DispatchPrefix Foo - PerlHandler Apache::Dispatch - </IfDefine> - -</Location> - + </Location> +</IfModule> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: Fred M. <fr...@ta...> - 2006-08-09 15:01:33
|
On Wed, 9 Aug 2006, Geoffrey Young wrote: > Fred Moyer wrote: > > I think I see a few things that could be contributing. first of all, > the results of the Makefile.PL are odd when A-T isn't present - it spits > out "sorry, can't run tests" _and_ runs the tests. we need to decide > what we'll be requiring :) > > WS::CDN has both apache and non-apache tests, so I wanted to run _some_ > of the tests no matter what, but configure and run the apache tests if > A-T was properly set up. we probably only want to run tests if > > o A-T is configured > o apache has mod_perl configured > > to that end I think we need a patch like the one attached. Got it - my bad, I left the A::T dependency line in there. > make sure that our enabled httpd has mod_perl available to it - if it > doesn't then we can't run our tests at all. but to find out httpd needs > to be fully configured, which doesn't happen until we actually run 'make > test'. the solution to this little problem is all.t, a special test > file with magical properties. yum :) > > so, all.t would look something like this > > http://search.cpan.org/src/GEOFF/Apache-SSLLookup-2.00_04/t/live/all.t I was wondering what that did before, but if I had read the testing docs on perl.apache.org all the way through I would probably know :) > you _also_ need to protect all of extra.last.conf.in in <IfModule> > statements such that if we have httpd without mod_perl httpd still > starts, so we can then run all.t, which will then skip over our tests. > apache will then shut down. yeah, I know, but it's just the way things > work. Not a problem - I actually hit a bug in libapreq because of this and submitted a patch so I grok the importance. > the simple import form (:) is fine for *.t clients (like this one) while > the action form (-) is a requirement for *.pm server side tests because > it adds (yet more) magic. > anyway, I hope this helps clear things up a bit. I'm happy to work on > and commit things, but I didn't want to step on your work. don't worry about stepping on my work, looks like I've stepped on it in a few places :) It looks like I haven't done my A::T homework thoroughly enough here. I'll take another pass at this after reading the testing page all the way through, but feel free to commit here if so desired. |
|
From: Geoffrey Y. <ge...@mo...> - 2006-08-09 13:50:13
|
Fred Moyer wrote: >>>just this one last nit. >> >>hmph, sounds like import() is up to something funky. >> >>maybe just fully qualify Apache::TestRequest::GET_OK($url) in the code? >> > > > Indeed. Same thing happens with a fully qualified call. Should I cc this to the Apache::Test list? I don't think so quite yet... I think I see a few things that could be contributing. first of all, the results of the Makefile.PL are odd when A-T isn't present - it spits out "sorry, can't run tests" _and_ runs the tests. we need to decide what we'll be requiring :) WS::CDN has both apache and non-apache tests, so I wanted to run _some_ of the tests no matter what, but configure and run the apache tests if A-T was properly set up. we probably only want to run tests if o A-T is configured o apache has mod_perl configured to that end I think we need a patch like the one attached. so, ok, that solves the first point above - we've made sure that we aren't running tests unless A-T is present and we know which httpd binary to use. and we've enforced Test::More is present, which is helpful because... now we have a few more problems to handle gracefully. first, we need to make sure that our enabled httpd has mod_perl available to it - if it doesn't then we can't run our tests at all. but to find out httpd needs to be fully configured, which doesn't happen until we actually run 'make test'. the solution to this little problem is all.t, a special test file with magical properties. yum :) so, all.t would look something like this http://search.cpan.org/src/GEOFF/Apache-SSLLookup-2.00_04/t/live/all.t except we would be checking for plan tests => 1, need_module('mod_perl.c'); so the call to vars() isn't required. this prevents us from trying to run tests if mod_perl isn't installed. but we're not finished yet. you see, just because we won't run the tests doesn't mean that httpd won't start up... and when it does and doesn't find mod_perl then httpd.conf will blow up because extra.last.conf.in contains directives it can't parse. so... you _also_ need to protect all of extra.last.conf.in in <IfModule> statements such that if we have httpd without mod_perl httpd still starts, so we can then run all.t, which will then skip over our tests. apache will then shut down. yeah, I know, but it's just the way things work. so, putting all that in place means you don't actually need to protect individual test files like you're doing below. but I think the problem you originally reported would be fixed like this: > ---------------------------- > use strict; > use warnings FATAL => 'all';a > > use Test::More; take this out. > > require Apache::Test; > Apache::Test->import(qw(have_lwp)); substitute these for use Apache::Test qw(:withtestmore); which use()s Test::More for you and does the magic required for both to coexist. note the difference between :withtestmore and -withtestmore the simple import form (:) is fine for *.t clients (like this one) while the action form (-) is a requirement for *.pm server side tests because it adds (yet more) magic. anyway, I hope this helps clear things up a bit. I'm happy to work on and commit things, but I didn't want to step on your work. --Geoff |
|
From: Fred M. <fr...@ta...> - 2006-08-09 04:42:36
|
>> just this one last nit.
>
> hmph, sounds like import() is up to something funky.
>
> maybe just fully qualify Apache::TestRequest::GET_OK($url) in the code?
>
Indeed. Same thing happens with a fully qualified call. Should I cc this to the Apache::Test list?
----------------------------
use strict;
use warnings FATAL => 'all';a
use Test::More;
require Apache::Test;
Apache::Test->import(qw(have_lwp));
require Apache::TestRequest;
Apache::TestRequest->import(qw(GET_OK));
plan skip_all => 'test library dependencies not met'
unless eval { have_lwp() };
plan tests => 1;
my $uri = '/plain';
#ok Apache::TestRequest::GET_OK $uri;
ok GET_OK $uri;
-----------------------------
waiting 60 seconds for server to start: .
waiting 60 seconds for server to start: ok (waited 0 secs)
server localhost:8529 started
t/01get_ok_outside_eval....1..1
Can't call method "GET_OK" without a package or object reference at t/01get_ok_outside_eval.t line 18.
-----------------------------------
|
|
From: Geoffrey Y. <ge...@mo...> - 2006-08-07 18:53:00
|
>> require Apache::TestRequest; >> >> ? > > > I can do that part, but the Apache::TestRequest->import(qw(GET_OK)) > still results in the "can't call method GET_OK without package or object > name" error, which I don't get when I 'use Apache::TestRequest' > directly. I'll wrap that up into a reproducible case and post it > tonight. I'm really close on having this just do the right thing. I've > got a test environment also that I can test mp1 and mp2 with and without > Apache::Test and Apache::Filter so I think all the bases are covered - > just this one last nit. hmph, sounds like import() is up to something funky. maybe just fully qualify Apache::TestRequest::GET_OK($url) in the code? --Geoff |
|
From: Fred M. <fr...@ta...> - 2006-08-07 18:33:37
|
>On Mon, 7 Aug 2006, Geoffrey Young wrote: > Fred Moyer wrote: >> On Tue, 1 Aug 2006, Fred Moyer wrote: >> only seems to work if I 'use Apache::TestRequest'. But that makes it hard >> to load the package conditionally like WS::CDN does. > > require Apache::TestRequest; > > ? I can do that part, but the Apache::TestRequest->import(qw(GET_OK)) still results in the "can't call method GET_OK without package or object name" error, which I don't get when I 'use Apache::TestRequest' directly. I'll wrap that up into a reproducible case and post it tonight. I'm really close on having this just do the right thing. I've got a test environment also that I can test mp1 and mp2 with and without Apache::Test and Apache::Filter so I think all the bases are covered - just this one last nit. > >> >> I could get rid of the GET_OK call for now - I banged my head on this for >> a couple hours and have a deeper understanding of Apache::Test but still >> no guess as how to require Apache::TestRequest and import GET_OK. I'll >> try to wrap up a skeleton snippet which reproduces this issue and submit >> it to the Apache::Test list. >> >> > >> >>> All tests passing for me on mp1 and mp2. I put a new dist up at http://www.redhotpenguin.com/Apache-Dispatch-0.10.tar.gz > > I'll try to give that a whirl "soonish" :) > > --Geoff > |
|
From: Geoffrey Y. <ge...@mo...> - 2006-08-07 18:28:14
|
Fred Moyer wrote: > On Tue, 1 Aug 2006, Fred Moyer wrote: > > >>I think that I've got the last bug fixed, it's skipping the tests properly when Apache::Test is not installed. > > > Drats - I found a bug last night. This incarnation skips the tests just > fine, but doesn't run them. It comes down to when I call GET_OK, but I > didn't 'use Apache::TestRequest' in the test script, I used the eval ... > code snippet borrowed from WebService::CaptchaDotNet, so I get the error > "can't call method GET_OK without package name". I called > Apache::TestRequest->import(qw(GET_OK)) in my eval call, but the import > only seems to work if I 'use Apache::TestRequest'. But that makes it hard > to load the package conditionally like WS::CDN does. require Apache::TestRequest; ? > > I could get rid of the GET_OK call for now - I banged my head on this for > a couple hours and have a deeper understanding of Apache::Test but still > no guess as how to require Apache::TestRequest and import GET_OK. I'll > try to wrap up a skeleton snippet which reproduces this issue and submit > it to the Apache::Test list. > > > > >>All tests passing for me on mp1 and mp2. I put a new dist up at http://www.redhotpenguin.com/Apache-Dispatch-0.10.tar.gz I'll try to give that a whirl "soonish" :) --Geoff |
|
From: Fred M. <fr...@ta...> - 2006-08-07 18:24:24
|
On Tue, 1 Aug 2006, Fred Moyer wrote: > I think that I've got the last bug fixed, it's skipping the tests properly when Apache::Test is not installed. Drats - I found a bug last night. This incarnation skips the tests just fine, but doesn't run them. It comes down to when I call GET_OK, but I didn't 'use Apache::TestRequest' in the test script, I used the eval ... code snippet borrowed from WebService::CaptchaDotNet, so I get the error "can't call method GET_OK without package name". I called Apache::TestRequest->import(qw(GET_OK)) in my eval call, but the import only seems to work if I 'use Apache::TestRequest'. But that makes it hard to load the package conditionally like WS::CDN does. I could get rid of the GET_OK call for now - I banged my head on this for a couple hours and have a deeper understanding of Apache::Test but still no guess as how to require Apache::TestRequest and import GET_OK. I'll try to wrap up a skeleton snippet which reproduces this issue and submit it to the Apache::Test list. > > > All tests passing for me on mp1 and mp2. I put a new dist up at http://www.redhotpenguin.com/Apache-Dispatch-0.10.tar.gz > > fred@harpua ~/dev/apache-dispatch/trunk $ perl -MApache::Test -e 0 > Can't locate Apache/Test.pm in @INC (@INC contains: /home/fred/dev/perl/lib/5.8.6/i686-linux /home/fred/dev/perl/lib/5.8.6 /home/fred/dev/perl/lib/site_perl/5.8.6/i686-linux /home/fred/dev/perl/lib/site_perl/5.8.6 /home/fred/dev/perl/lib/site_perl .). > BEGIN failed--compilation aborted. > > fred@harpua ~/dev/apache-dispatch/trunk $ perl Makefile.PL > Using mod_perl/2.000003 > > Warning: prerequisite Apache::Test 1.23 not found. > Writing Makefile for Apache2::Dispatch > fred@harpua ~/dev/apache-dispatch/trunk $ make > Manifying blib/man3/Apache2::Dispatch.3 > Manifying blib/man3/Apache::Dispatch.3 > Manifying blib/man3/Apache::Dispatch::Util.3 > /home/fred/dev/perl/bin/perl "-Iblib/arch" "-Iblib/lib" set_pureperl.PL set_pureperl > fred@harpua ~/dev/apache-dispatch/trunk $ make test > Skip blib/lib/Apache2/Dispatch.pm (unchanged) > Skip blib/lib/Apache/Dispatch.pm (unchanged) > Skip blib/lib/Apache/Dispatch/Util.pm (unchanged) > Skip blib/lib/Apache/Dispatch/TestConfig.pm (unchanged) > PERL_DL_NONLAZY=1 /home/fred/dev/perl/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t > t/01plain.....skipped > all skipped: Apache::Test not configured > t/02extras....skipped > all skipped: Apache::Test not configured > t/03filter....skipped > all skipped: Apache::Test not configured > t/04oo........skipped > all skipped: Apache::Test not configured > All tests successful, 4 tests skipped. > Files=4, Tests=0, 0 wallclock secs ( 0.11 cusr + 0.01 csys = 0.12 CPU) > PERL_DL_NONLAZY=1 /home/fred/dev/perl/bin/perl "-Iblib/lib" "-Iblib/arch" test.plyou must have Apache-Test to run the test suite... > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Apache-dispatch-devel mailing list > Apa...@li... > https://lists.sourceforge.net/lists/listinfo/apache-dispatch-devel > |
|
From: Fred M. <fr...@ta...> - 2006-08-02 04:52:52
|
I think that I've got the last bug fixed, it's skipping the tests properly when Apache::Test is not installed. All tests passing for me on mp1 and mp2. I put a new dist up at http://www.redhotpenguin.com/Apache-Dispatch-0.10.tar.gz fred@harpua ~/dev/apache-dispatch/trunk $ perl -MApache::Test -e 0 Can't locate Apache/Test.pm in @INC (@INC contains: /home/fred/dev/perl/lib/5.8.6/i686-linux /home/fred/dev/perl/lib/5.8.6 /home/fred/dev/perl/lib/site_perl/5.8.6/i686-linux /home/fred/dev/perl/lib/site_perl/5.8.6 /home/fred/dev/perl/lib/site_perl .). BEGIN failed--compilation aborted. fred@harpua ~/dev/apache-dispatch/trunk $ perl Makefile.PL Using mod_perl/2.000003 Warning: prerequisite Apache::Test 1.23 not found. Writing Makefile for Apache2::Dispatch fred@harpua ~/dev/apache-dispatch/trunk $ make Manifying blib/man3/Apache2::Dispatch.3 Manifying blib/man3/Apache::Dispatch.3 Manifying blib/man3/Apache::Dispatch::Util.3 /home/fred/dev/perl/bin/perl "-Iblib/arch" "-Iblib/lib" set_pureperl.PL set_pureperl fred@harpua ~/dev/apache-dispatch/trunk $ make test Skip blib/lib/Apache2/Dispatch.pm (unchanged) Skip blib/lib/Apache/Dispatch.pm (unchanged) Skip blib/lib/Apache/Dispatch/Util.pm (unchanged) Skip blib/lib/Apache/Dispatch/TestConfig.pm (unchanged) PERL_DL_NONLAZY=1 /home/fred/dev/perl/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/01plain.....skipped all skipped: Apache::Test not configured t/02extras....skipped all skipped: Apache::Test not configured t/03filter....skipped all skipped: Apache::Test not configured t/04oo........skipped all skipped: Apache::Test not configured All tests successful, 4 tests skipped. Files=4, Tests=0, 0 wallclock secs ( 0.11 cusr + 0.01 csys = 0.12 CPU) PERL_DL_NONLAZY=1 /home/fred/dev/perl/bin/perl "-Iblib/lib" "-Iblib/arch" test.plyou must have Apache-Test to run the test suite... |
|
From: <phr...@us...> - 2006-08-02 04:47:53
|
Revision: 50 Author: phred_moyer Date: 2006-08-01 21:47:49 -0700 (Tue, 01 Aug 2006) ViewCVS: http://svn.sourceforge.net/apache-dispatch/?rev=50&view=rev Log Message: ----------- - Test style adaptation from WebService::CaptchasDotNet - Added a use lib 'lib' pragma to the Makefile.PL so it can find Apache::Dispatch::Util locally - Updated tests so that they successfully skip if Apache::Test is not installed - Added package Apache::Dispatch::TestConfig to hold common eval code for tests Modified Paths: -------------- trunk/MANIFEST trunk/Makefile.PL trunk/t/01plain.t trunk/t/02extras.t trunk/t/03filter.t trunk/t/04oo.t Added Paths: ----------- trunk/lib/Apache/Dispatch/TestConfig.pm Modified: trunk/MANIFEST =================================================================== --- trunk/MANIFEST 2006-08-02 03:33:26 UTC (rev 49) +++ trunk/MANIFEST 2006-08-02 04:47:49 UTC (rev 50) @@ -8,6 +8,7 @@ set_pureperl.PL lib/Apache/Dispatch.pm lib/Apache/Dispatch/Util.pm +lib/Apache/Dispatch/TestConfig.pm lib/Apache2/Dispatch.pm t/lib/Apache/Bar.pm t/lib/Apache/Foo.pm @@ -22,3 +23,4 @@ t/04oo.t t/conf/extra.last.conf.in t/TEST.PL +META.yml Module meta-data (added by MakeMaker) Modified: trunk/Makefile.PL =================================================================== --- trunk/Makefile.PL 2006-08-02 03:33:26 UTC (rev 49) +++ trunk/Makefile.PL 2006-08-02 04:47:49 UTC (rev 50) @@ -4,6 +4,11 @@ use strict; +use lib 'lib'; + +use Apache::Dispatch::Util; +use ExtUtils::MakeMaker; + use constant HAS_APACHE_TEST => eval { require Apache::Test; require Apache::TestMM; @@ -14,10 +19,10 @@ my %args = @Apache::TestMM::Argv; die 'suitable httpd required' - unless ( $args{apxs} - or $args{httpd} - or $ENV{APACHE_TEST_HTTPD} - or $ENV{APACHE_TEST_APXS}); + unless ( $args{apxs} + or $args{httpd} + or $ENV{APACHE_TEST_HTTPD} + or $ENV{APACHE_TEST_APXS} ); Apache::TestMM::generate_script('t/TEST'); @@ -37,7 +42,7 @@ return HAS_APACHE_TEST if HAS_APACHE_TEST; - if (eval { require Devel::Cover }) { + if ( eval { require Devel::Cover } ) { $test .= <<EOF; testcover :: cover -delete @@ -61,24 +66,23 @@ } ## which mp version ( 1.2x or 2.0.x) -my ($mp_wanted, $mp_ver) = &get_mp_ver(); +my ( $mp_wanted, $mp_ver ) = &get_mp_ver(); print STDERR "Using mod_perl/$mp_ver\n\n"; -my %prereq = ('Apache::Test' => "1.23"); +my %prereq = ( 'Apache::Test' => "1.23" ); -my %makefile_params = ('VERSION' => '0.10',); +my %makefile_params = ( 'VERSION' => '0.10', ); -if ($mp_wanted == 2) { # mod_perl2 specific makefile +if ( $mp_wanted == 2 ) { # mod_perl2 specific makefile $prereq{'mod_perl2'} = 1.99023; # this covers the naming change $makefile_params{'NAME'} = 'Apache2::Dispatch'; $makefile_params{'PREREQ_PM'} = \%prereq; - require ModPerl::MM; - ModPerl::MM::WriteMakefile(%makefile_params); + WriteMakefile(%makefile_params); } -elsif ($mp_wanted != 2) { # mod_perl1 specific makefile +elsif ( $mp_wanted != 2 ) { # mod_perl1 specific makefile eval { require Apache::ExtUtils; require Apache::src; @@ -87,11 +91,11 @@ # Build directives using xs or PerlSetVar my $pureperl; - if ($@ || $ENV{DISPATCH_PUREPERL}) { + if ( $@ || $ENV{DISPATCH_PUREPERL} ) { print "Building without Custom Apache Directives, use 'PerlSetVar' for configuration.\n\n"; - $makefile_params{'PL_FILES'} = {'set_pureperl.PL' => '1'}; + $makefile_params{'PL_FILES'} = { 'set_pureperl.PL' => '1' }; $makefile_params{'C'} = []; } @@ -99,25 +103,23 @@ print "Building with Custom Apache Directives ('DispatchPrefix'). You will need a C compiler and Apache/mod_perl sources.\n\n"; - $makefile_params{'PL_FILES'} = {'set_pureperl.PL' => '0'}; - $makefile_params{'clean'} = {FILES => '*.xs*'}; + $makefile_params{'PL_FILES'} = { 'set_pureperl.PL' => '0' }; + $makefile_params{'clean'} = { FILES => '*.xs*' }; import Apache::ExtUtils qw(command_table); - require Apache::Dispatch::Util; my @directives = Apache::Dispatch::Util->directives(); - command_table(\@directives); + command_table( \@directives ); my $inc = Apache::src->new->inc; die "Can't find mod_perl header files installed" unless $inc; $makefile_params{'INC'} = $inc; } - $makefile_params{'PREREQ_PM'} = {mod_perl => 1.2401}; - require ExtUtils::MakeMaker; - ExtUtils::MakeMaker::WriteMakefile( - NAME => __PACKAGE__, - PREREQ_PM => \%prereq, - %makefile_params, - ); + $makefile_params{'PREREQ_PM'} = { mod_perl => 1.2401 }; + WriteMakefile( + NAME => __PACKAGE__, + PREREQ_PM => \%prereq, + %makefile_params, + ); } # The next sub inspired by Apache::Peek 1.05 @@ -127,8 +129,8 @@ my $flag = 0; my @args = (); - while (my $arg = shift @ARGV) { - if ($arg =~ /^MOD_PERL=([12])$/) { + while ( my $arg = shift @ARGV ) { + if ( $arg =~ /^MOD_PERL=([12])$/ ) { $flag = $1; } else { @@ -141,7 +143,7 @@ my $env = exists $ENV{MOD_PERL} ? $ENV{MOD_PERL} : 0; # check for contradicting requirements - if ($env && $flag && $flag != $env) { + if ( $env && $flag && $flag != $env ) { die <<EOF; Can\'t decide which mod_perl version should be used, since you have supplied contradicting requirements: @@ -155,10 +157,10 @@ my $mp_ver; - if ($wanted == 2) { + if ( $wanted == 2 ) { eval { require mod_perl2 }; my $req_ver = 1.999022; - if ($mod_perl2::VERSION < $req_ver || $@) { + if ( $mod_perl2::VERSION < $req_ver || $@ ) { die "mod_perl2 required version is $req_ver, you have $mod_perl2::VERSION. Please upgrade to continue."; } @@ -169,7 +171,7 @@ else { eval { require mod_perl }; no warnings qw(uninitialized); - if ($mod_perl::VERSION > 1.99 || $@) { + if ( $mod_perl::VERSION > 1.99 || $@ ) { die "You don't seem to have mod_perl 1.0 installed"; } else { @@ -177,6 +179,6 @@ } } - return ($wanted, $mp_ver); + return ( $wanted, $mp_ver ); } Added: trunk/lib/Apache/Dispatch/TestConfig.pm =================================================================== --- trunk/lib/Apache/Dispatch/TestConfig.pm (rev 0) +++ trunk/lib/Apache/Dispatch/TestConfig.pm 2006-08-02 04:47:49 UTC (rev 50) @@ -0,0 +1,19 @@ +package Apache::Dispatch::TestConfig; + +use strict; +use warnings FATAL => 'all'; + +our $HAS_APACHE_TEST = eval { + require Apache::Test; + Apache::Test->import(qw(have_lwp)); + + Apache::TestRequest->import(qw(GET_BODY_ASSERT)); + + require Apache::TestUtil; + Apache::TestUtil->import(qw(t_write_perl_script)); + + require Apache::TestServer; + return Apache::TestServer->new->{config}->{vars}->{httpd}; +}; + +1; \ No newline at end of file Property changes on: trunk/lib/Apache/Dispatch/TestConfig.pm ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/t/01plain.t =================================================================== --- trunk/t/01plain.t 2006-08-02 03:33:26 UTC (rev 49) +++ trunk/t/01plain.t 2006-08-02 04:47:49 UTC (rev 50) @@ -1,11 +1,17 @@ use strict; use warnings FATAL => 'all'; -use Apache::Test; -use Apache::TestRequest; +use Apache::Dispatch::TestConfig; +use Test::More; -plan tests => 4, \&need_lwp; +plan skip_all => 'Apache::Test not configured' + unless $Apache::Dispatch::TestConfig::HAS_APACHE_TEST; +plan skip_all => 'test library dependencies not met' + unless eval { have_lwp() }; + +plan tests => 4; + # Test Apache2::Foo->dispatch_index my $uri = '/plain'; ok GET_OK $uri; @@ -14,7 +20,7 @@ $uri = '/plain/foo'; ok GET_OK $uri; -# Test non-usage of Apache2::Foo::Bar->dispatch_index since +# Test non-usage of Apache2::Foo::Bar->dispatch_index since # Apache2::Foo->dispatch_bar does not exist $uri = '/plain/bar'; my $res = GET $uri; Modified: trunk/t/02extras.t =================================================================== --- trunk/t/02extras.t 2006-08-02 03:33:26 UTC (rev 49) +++ trunk/t/02extras.t 2006-08-02 04:47:49 UTC (rev 50) @@ -1,11 +1,17 @@ use strict; use warnings FATAL => 'all'; -use Apache::Test; -use Apache::TestRequest; +use Apache::Dispatch::TestConfig; +use Test::More; -plan tests => 5;#, \&need_lwp; +plan skip_all => 'Apache::Test not configured' + unless $Apache::Dispatch::TestConfig::HAS_APACHE_TEST; +plan skip_all => 'test library dependencies not met' + unless eval { have_lwp() }; + +plan tests => 5; + my $uri = '/extras'; my $res = GET $uri; ok $res->code == 200; Modified: trunk/t/03filter.t =================================================================== --- trunk/t/03filter.t 2006-08-02 03:33:26 UTC (rev 49) +++ trunk/t/03filter.t 2006-08-02 04:47:49 UTC (rev 50) @@ -1,9 +1,15 @@ use strict; use warnings FATAL => 'all'; -use Apache::Test qw(-withtestmore); -use Apache::TestRequest; +use Apache::Dispatch::TestConfig; +use Test::More; +plan skip_all => 'Apache::Test not configured' + unless $Apache::Dispatch::TestConfig::HAS_APACHE_TEST; + +plan skip_all => 'test library dependencies not met' + unless eval { have_lwp() }; + # figure out what version we have - I don't like this method but it works my $httpd = Apache::Test::vars('httpd'); my $version = `$httpd -v`; @@ -12,7 +18,7 @@ plan skip_all => "Filtering not yet implemented in Apache2::Dispatch"; } else { - plan tests => 2, \&need_lwp; + plan tests => 2; } my $url = '/filtered/foo'; Modified: trunk/t/04oo.t =================================================================== --- trunk/t/04oo.t 2006-08-02 03:33:26 UTC (rev 49) +++ trunk/t/04oo.t 2006-08-02 04:47:49 UTC (rev 50) @@ -1,11 +1,17 @@ use strict; use warnings FATAL => 'all'; -use Apache::Test qw(-withtestmore); -use Apache::TestRequest; +use Apache::Dispatch::TestConfig; +use Test::More; -plan tests => 2, \&need_lwp; +plan skip_all => 'Apache::Test not configured' + unless $Apache::Dispatch::TestConfig::HAS_APACHE_TEST; +plan skip_all => 'test library dependencies not met' + unless eval { have_lwp() }; + +plan tests => 2; + my $url = '/oo/baz'; my $res = GET $url; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <phr...@us...> - 2006-08-02 03:33:30
|
Revision: 49 Author: phred_moyer Date: 2006-08-01 20:33:26 -0700 (Tue, 01 Aug 2006) ViewCVS: http://svn.sourceforge.net/apache-dispatch/?rev=49&view=rev Log Message: ----------- Egads, these showed up on my dev box as committed but they aren't in the sourceforge repository, and show up missing from the MANIFEST on checkout. Added Paths: ----------- trunk/t/lib/Apache/Foo/ trunk/t/lib/Apache/Foo/Bar.pm trunk/t/lib/Apache/Foo/Filter.pm trunk/t/lib/Apache/Foo/Foo.pm Added: trunk/t/lib/Apache/Foo/Bar.pm =================================================================== --- trunk/t/lib/Apache/Foo/Bar.pm (rev 0) +++ trunk/t/lib/Apache/Foo/Bar.pm 2006-08-02 03:33:26 UTC (rev 49) @@ -0,0 +1,47 @@ +package Apache::Foo::Bar; + +use strict; +use warnings; + +use Apache::Constants qw( OK SERVER_ERROR ); + +sub dispatch_baz { + my $class = shift; + my $r = Apache->request; + $r->log->debug("$class->dispatch_baz()"); + $Apache::Foo::Bar::output = "pid $$"; + $r->send_http_header('text/plain'); + $r->print("$class->dispatch_baz()"); + return OK; +} + +sub post_dispatch { + my $class = shift; + my $r = shift; + $r->log->debug("$class->post_dispatch()"); + # delay printing headers until all processing is done + $r->send_http_header('text/plain'); + $r->print($Apache::Foo::Bar::output); +} + +1; + +__END__ + +here is a sample httpd.conf entry + + PerlModule Apache::Dispatch + PerlModule Foo + + <Location /Test> + SetHandler perl-script + PerlHandler Apache::Dispatch + DispatchPrefix Foo + DispatchExtras Pre Post Error + </Location> + +once you install it, you should be able to go to +http://localhost/Test/Foo/foo +or +http://localhost/Test/Foo/Bar/foo +etc, and get some results Property changes on: trunk/t/lib/Apache/Foo/Bar.pm ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/t/lib/Apache/Foo/Filter.pm =================================================================== --- trunk/t/lib/Apache/Foo/Filter.pm (rev 0) +++ trunk/t/lib/Apache/Foo/Filter.pm 2006-08-02 03:33:26 UTC (rev 49) @@ -0,0 +1,26 @@ +package Apache::Foo::Filter; + +use strict; +use warnings FATAL => 'all'; + +sub handler { + my $r = shift; + + $r->log->debug("Filtering response"); + $r->send_http_header(); + + $r = $r->filter_register; + + my $fh = $r->filter_input; + + while (<$fh>) { + $r->log->debug("Filtering data $_"); + # remove the underscores + s/_//g; + $r->log->debug("Filtered data $_"); + + print; + } +} + +1; \ No newline at end of file Property changes on: trunk/t/lib/Apache/Foo/Filter.pm ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/t/lib/Apache/Foo/Foo.pm =================================================================== --- trunk/t/lib/Apache/Foo/Foo.pm (rev 0) +++ trunk/t/lib/Apache/Foo/Foo.pm 2006-08-02 03:33:26 UTC (rev 49) @@ -0,0 +1,102 @@ +package Foo::Foo; + +use Apache::Constants qw( OK SERVER_ERROR ); +use strict; + +our $AUTOLOAD; + +# declare the methods you want AUTOLOAD to capture by name +# that is, AUTOLOAD will still be called, but $AUTOLOAD +# will only be populated for methods you declare here +# +# read the camel book (3rd ed) pp326-329 before treading here... + +sub dispatch_baz; + +$Foo::Foo::output = undef; + +sub dispatch_foo { + my $self = shift; + my $r = shift; + $r->send_http_header('text/plain'); + $r->print("Foo->dispatch_foo()"); + print STDERR "Foo->dispatch_foo()\n"; + return OK; +} + +sub dispatch_bar { + # test returning not OK + print STDERR "Foo->dispatch_bar()\n"; + return SERVER_ERROR; +} + +sub pre_dispatch { + # test pre_dispatch call + print STDERR "Foo->pre_dispatch()\n"; +} + +sub post_dispatch { + # test post_dispatch call + print STDERR "Foo->post_dispatch()\n"; +} + +sub error_dispatch { + # test error_dispatch call + my $self = shift; + my $r = shift; + $r->send_http_header('text/plain'); + $r->print("Yikes! Foo->dispatch_error()"); + print STDERR "Yikes! Foo->dispatch_error()\n"; + # you can return whatever you want... + return OK; +} + +sub dispatch_index { + # test calls to /index or / + my $self = shift; + my $r = shift; + $r->send_http_header('text/plain'); + $r->print("Foo->dispatch_index()"); + print STDERR "Foo->dispatch_index()\n"; + return OK; +} + +sub AUTOLOAD { + my $self = shift; + my $r = shift; + + our $AUTOLOAD; + + # this might be a good use for Damian Conway's Switch.pm + return if $AUTOLOAD =~ m/::DESTROY$/; + + print STDERR "asked for $AUTOLOAD\n"; + + if $AUTOLOAD =~ m/dispatch_baz/ { + $r->print("method $AUTOLOAD was declared!"); + return OK; + } + + $r->send_http_header('text/plain'); + $r->print("sorry - method $AUTOLOAD not found"); + return OK; +} +1; + +__END__ + +here is a sample httpd.conf entry + + PerlModule Apache::Dispatch + PerlModule Foo + + <Location /Test> + SetHandler perl-script + PerlHandler Apache::Dispatch + DispatchPrefix Foo + DispatchExtras Pre Post Error + </Location> + +once you install it, you should be able to go to +http://localhost/Test/Foo/foo +and get some results Property changes on: trunk/t/lib/Apache/Foo/Foo.pm ___________________________________________________________________ Name: svn:executable + * Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: Geoffrey Y. <ge...@mo...> - 2006-07-23 00:47:41
|
Fred Moyer wrote: >>and it balked. no problem, the Makefile.PL just needs some tweaking. >> >>and, as it turns out, I spent the morning doing the same for >>Apache-SizeLimit. so, I'd suggest looking at the following files >> >> Makefile.PL >> t/apache/all.t > > > This looks very similar to the CaptchasDotNet code, with the exception > of generate_script which uses Apache::TestRunPerl instead. that's fine. TestRunPerl assumes mod_perl and does mod_perl-specific things, whereas TestMM assumes just vanilla apache. > > In t/apache/all.t, does this line mean 'need apache', > or 'need apache 1.xx'? > > $ok &= need_apache(1); the latter - it's saying 1.3.X is ok but 2.0.X is not. > > >>so, unless you want a ton of bugreports, or you want CPAN.pm to fail, >>you need to take some extra steps. see also WebService-CaptchasDotNot >>(another one of my modules) that similarly tweaks stuff. > > > I've modified the Makefile.PL to use the MY:: overrides. Interesting > that WebService-CaptchasDotNet uses Apache::TestRun->generate_script > which didn't work for me, I had to use Apache::TestMM::generate_script. > I checked this in late last night and the subversion email didn't go > out, looks like SF was doing some maintenance. > > http://svn.sourceforge.net/viewcvs.cgi/apache-dispatch/trunk/Makefile.PL?r1=40&r2=48 > > >>not to add extra work, but if you have the tuits. really, it's all a >>matter of how nice you want to be to your users. > > > No problem, reclaiming some more tuits, so if this still looks like it > needs tweaks let me know - happy to do them :) > > http://www.redhotpenguin.com/Apache-Dispatch-0.10.tar.gz I'll check it out this week at oscon as I have time. --Geoff |
|
From: Fred M. <fr...@ta...> - 2006-07-22 17:42:50
|
> and it balked. no problem, the Makefile.PL just needs some tweaking. > > and, as it turns out, I spent the morning doing the same for > Apache-SizeLimit. so, I'd suggest looking at the following files > > Makefile.PL > t/apache/all.t This looks very similar to the CaptchasDotNet code, with the exception of generate_script which uses Apache::TestRunPerl instead. In t/apache/all.t, does this line mean 'need apache', or 'need apache 1.xx'? $ok &= need_apache(1); > so, unless you want a ton of bugreports, or you want CPAN.pm to fail, > you need to take some extra steps. see also WebService-CaptchasDotNot > (another one of my modules) that similarly tweaks stuff. I've modified the Makefile.PL to use the MY:: overrides. Interesting that WebService-CaptchasDotNet uses Apache::TestRun->generate_script which didn't work for me, I had to use Apache::TestMM::generate_script. I checked this in late last night and the subversion email didn't go out, looks like SF was doing some maintenance. http://svn.sourceforge.net/viewcvs.cgi/apache-dispatch/trunk/Makefile.PL?r1=40&r2=48 > not to add extra work, but if you have the tuits. really, it's all a > matter of how nice you want to be to your users. No problem, reclaiming some more tuits, so if this still looks like it needs tweaks let me know - happy to do them :) http://www.redhotpenguin.com/Apache-Dispatch-0.10.tar.gz |