cvs commit: modperl-2.0 Changes
stas2003/01/21 23:02:14 Modified:.Changes Log: log the recent changes Revision ChangesPath 1.109 +5 -0 modperl-2.0/Changes Index: Changes === RCS file: /home/cvs/modperl-2.0/Changes,v retrieving revision 1.108 retrieving revision 1.109 diff -u -r1.108 -r1.109 --- Changes 22 Jan 2003 06:12:42 - 1.108 +++ Changes 22 Jan 2003 07:02:14 - 1.109 @@ -10,6 +10,11 @@ =item 1.99_09-dev +Apache::Test: support two new shortcuts for skip functionality: + - have_threads: checks whether both Apache and Perl support threads + - under_construction: to print a consistent/clear skip reason +[Stas] + OPEN, CLOSE and FILENO implementation for Apache::RequestRec [Stas] Apache::Test: Support blocks in .pm
cvs commit: modperl-2.0/t/error push_handlers.t
stas2003/01/21 23:00:29 Modified:t/error push_handlers.t Log: use the new under_construction test to print a descriptive skip reason Revision ChangesPath 1.3 +1 -1 modperl-2.0/t/error/push_handlers.t Index: push_handlers.t === RCS file: /home/cvs/modperl-2.0/t/error/push_handlers.t,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- push_handlers.t 21 Jan 2003 06:30:23 - 1.2 +++ push_handlers.t 22 Jan 2003 07:00:29 - 1.3 @@ -7,7 +7,7 @@ # XXX: the misuse of push_handlers exercised by this test is different # at least on FreeBSD, so it fails, skip for now. -plan tests => 1, have { "ignore" => sub { 0 } }; +plan tests => 1, under_construction; my $location = "/TestError::push_handlers"; my $expected = "ok";
cvs commit: modperl-2.0/t/response/TestAPR threadmutex.pm
stas2003/01/21 22:54:03 Modified:t/response/TestAPR threadmutex.pm Log: we really want to skip this test when threads are disabled. If the threads are enabled and the module is not there, require() will kill test which is a goodness Revision ChangesPath 1.4 +1 -1 modperl-2.0/t/response/TestAPR/threadmutex.pm Index: threadmutex.pm === RCS file: /home/cvs/modperl-2.0/t/response/TestAPR/threadmutex.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- threadmutex.pm21 Jan 2003 06:54:22 - 1.3 +++ threadmutex.pm22 Jan 2003 06:54:03 - 1.4 @@ -12,7 +12,7 @@ sub handler { my $r = shift; -plan $r, tests => 3, have 'APR::ThreadMutex'; +plan $r, tests => 3, have_threads; require APR::ThreadMutex;
cvs commit: modperl-2.0/xs/tables/current/ModPerl FunctionTable.pm
stas2003/01/21 22:12:43 Modified:.Changes t/response/TestModperl request_rec_tie_api.pm todo api.txt xs/Apache/RequestIO Apache__RequestIO.h xs/maps modperl_functions.map xs/tables/current/ModPerl FunctionTable.pm Log: OPEN and CLOSE tiehandle API + tests Revision ChangesPath 1.108 +1 -1 modperl-2.0/Changes Index: Changes === RCS file: /home/cvs/modperl-2.0/Changes,v retrieving revision 1.107 retrieving revision 1.108 diff -u -r1.107 -r1.108 --- Changes 22 Jan 2003 03:19:43 - 1.107 +++ Changes 22 Jan 2003 06:12:42 - 1.108 @@ -10,7 +10,7 @@ =item 1.99_09-dev -Add $r->FILENO implementation [Stas] +OPEN, CLOSE and FILENO implementation for Apache::RequestRec [Stas] Apache::Test: Support blocks in .pm files, so we can have a full manual control over generated config 1.2 +30 -2 modperl-2.0/t/response/TestModperl/request_rec_tie_api.pm Index: request_rec_tie_api.pm === RCS file: /home/cvs/modperl-2.0/t/response/TestModperl/request_rec_tie_api.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- request_rec_tie_api.pm22 Jan 2003 03:19:43 - 1.1 +++ request_rec_tie_api.pm22 Jan 2003 06:12:43 - 1.2 @@ -7,15 +7,43 @@ use Apache::Test; use Apache::TestUtil; +use Apache::TestConfig; + +use File::Spec::Functions qw(catfile catdir); use Apache::Const -compile => 'OK'; sub handler { my $r = shift; -plan $r, tests => 1; +plan $r, tests => 3; + +ok fileno STDOUT; + +{ +my $vars = Apache::Test::config()->{vars}; +my $target_dir = catdir $vars->{serverroot}, 'logs'; +my $file = catfile $target_dir, "stdout"; + +# test OPEN +my $received = open STDOUT, ">", $file or die "Can't open $file: $!"; +ok t_cmp(1, $received, "OPEN"); + +# test CLOSE, which is a noop +ok $r->CLOSE; +close $file; + +# restore the tie +tie *STDOUT, $r; + +# flush things that went into the file as STDOUT +open my $fh, $file or die "Can't open $file: $!"; +local $\; +print <$fh>; -ok t_cmp(fileno(STDOUT), $r->FILENO(), "FILENO"); +# cleanup +unlink $file; +} return Apache::OK; } 1.31 +2 -1 modperl-2.0/todo/api.txt Index: api.txt === RCS file: /home/cvs/modperl-2.0/todo/api.txt,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- api.txt 22 Jan 2003 03:19:43 - 1.30 +++ api.txt 22 Jan 2003 06:12:43 - 1.31 @@ -3,8 +3,9 @@ -- tied filehandle interface: - -CLOSE, OPEN, EOF, TELL, SEEK + -EOF, TELL, SEEK -READLINE - proper implementation (see comment in Apache::compat) + need to attempt to fix that interface so it'll work with IPC::Open* family $r->finfo: need apr_finfo_t <-> struct stat conversion (might already be there, 1.32 +24 -0 modperl-2.0/xs/Apache/RequestIO/Apache__RequestIO.h Index: Apache__RequestIO.h === RCS file: /home/cvs/modperl-2.0/xs/Apache/RequestIO/Apache__RequestIO.h,v retrieving revision 1.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- Apache__RequestIO.h 22 Jan 2003 03:19:43 - 1.31 +++ Apache__RequestIO.h 22 Jan 2003 06:12:43 - 1.32 @@ -14,6 +14,8 @@ #define mpxs_Apache__RequestRec_PRINTF mpxs_ap_rprintf #define mpxs_Apache__RequestRec_BINMODE(r) \ r ? SVYES : SVNO /* noop */ +#define mpxs_Apache__RequestRec_CLOSE(r) \ +r ? SVYES : SVNO /* noop */ #define mpxs_Apache__RequestRec_UNTIE(r, refcnt) \ (r && refcnt) ? SVYES : SVNO /* noop */ @@ -234,6 +236,28 @@ } return &PL_sv_undef; +} + +static MP_INLINE +int mpxs_Apache__RequestRec_OPEN(pTHX_ SV *self, SV *arg1, SV *arg2) +{ +char *name; +STRLEN len; +SV *arg; +dHANDLE("STDOUT"); + +modperl_io_handle_untie(aTHX_ handle); /* untie *STDOUT */ + +if (arg2 && self) { +arg = newSVsv(arg1); +sv_catsv(arg, arg2); +} +else { +arg = arg1; +} + +name = SvPV(arg, len); +return do_open(handle, name, len, FALSE, O_RDONLY, 0, Nullfp); } static MP_INLINE 1.50 +2 -0 modperl-2.0/xs/maps/modperl_functions.map Index: modperl_functions.map ===
cvs commit: modperl-2.0/xs/tables/current/ModPerl FunctionTable.pm
stas2003/01/21 19:19:43 Modified:.Changes src/modules/perl modperl_io.c modperl_io.h t/modperl .cvsignore todo api.txt xs/Apache/RequestIO Apache__RequestIO.h xs/maps modperl_functions.map xs/tables/current/ModPerl FunctionTable.pm Added: t/response/TestModperl request_rec_tie_api.pm Log: - expose useful macros from modperl_io.c via modperl_io.h - add $r->FILENO implementation - add a test Revision ChangesPath 1.107 +2 -0 modperl-2.0/Changes Index: Changes === RCS file: /home/cvs/modperl-2.0/Changes,v retrieving revision 1.106 retrieving revision 1.107 diff -u -r1.106 -r1.107 --- Changes 20 Jan 2003 07:54:52 - 1.106 +++ Changes 22 Jan 2003 03:19:43 - 1.107 @@ -10,6 +10,8 @@ =item 1.99_09-dev +Add $r->FILENO implementation [Stas] + Apache::Test: Support blocks in .pm files, so we can have a full manual control over generated config sections. These sections are fully parsed and variables are 1.1 modperl-2.0/t/response/TestModperl/request_rec_tie_api.pm Index: request_rec_tie_api.pm === package TestModperl::request_rec_tie_api; use strict; use warnings FATAL => 'all'; use Apache::RequestIO (); use Apache::Test; use Apache::TestUtil; use Apache::Const -compile => 'OK'; sub handler { my $r = shift; plan $r, tests => 1; ok t_cmp(fileno(STDOUT), $r->FILENO(), "FILENO"); return Apache::OK; } 1; 1.9 +0 -13 modperl-2.0/src/modules/perl/modperl_io.c Index: modperl_io.c === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_io.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- modperl_io.c 24 Mar 2002 02:41:29 - 1.8 +++ modperl_io.c 22 Jan 2003 03:19:43 - 1.9 @@ -1,18 +1,5 @@ #include "mod_perl.h" -/* - * bleedperl change #11639 switch tied handle magic - * from living in the gv to the GvIOp(gv), so we have to deal - * with both to support 5.6.x - */ -#if ((PERL_REVISION == 5) && (PERL_VERSION >= 7)) -# define TIEHANDLE_SV(handle) (SV*)GvIOp((SV*)handle) -#else -# define TIEHANDLE_SV(handle) (SV*)handle -#endif - -#define dHANDLE(name) GV *handle = gv_fetchpv(name, TRUE, SVt_PVIO) - #define TIEHANDLE(handle,r) \ modperl_io_handle_tie(aTHX_ handle, "Apache::RequestRec", (void *)r) 1.2 +13 -0 modperl-2.0/src/modules/perl/modperl_io.h Index: modperl_io.h === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_io.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- modperl_io.h 5 May 2001 22:06:41 - 1.1 +++ modperl_io.h 22 Jan 2003 03:19:43 - 1.2 @@ -1,6 +1,19 @@ #ifndef MODPERL_IO_H #define MODPERL_IO_H +/* + * bleedperl change #11639 switch tied handle magic + * from living in the gv to the GvIOp(gv), so we have to deal + * with both to support 5.6.x + */ +#if ((PERL_REVISION == 5) && (PERL_VERSION >= 7)) +# define TIEHANDLE_SV(handle) (SV*)GvIOp((SV*)handle) +#else +# define TIEHANDLE_SV(handle) (SV*)handle +#endif + +#define dHANDLE(name) GV *handle = gv_fetchpv(name, TRUE, SVt_PVIO) + #define IoFLUSH_off(gv) \ IoFLAGS(GvIOp((gv))) &= ~IOf_FLUSH 1.11 +1 -0 modperl-2.0/t/modperl/.cvsignore Index: .cvsignore === RCS file: /home/cvs/modperl-2.0/t/modperl/.cvsignore,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- .cvsignore22 Oct 2002 15:13:22 - 1.10 +++ .cvsignore22 Jan 2003 03:19:43 - 1.11 @@ -10,3 +10,4 @@ methodobj.t method.t setauth.t +request_rec_tie_api.t 1.30 +1 -1 modperl-2.0/todo/api.txt Index: api.txt === RCS file: /home/cvs/modperl-2.0/todo/api.txt,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- api.txt 6 Dec 2002 16:19:36 - 1.29 +++ api.txt 22 Jan 2003 03:19:43 - 1.30 @@ -3,7 +3,7 @@ -- tied filehandle interface: - -CLOSE, OPEN, EOF, TELL, SEEK, FILENO + -CLOSE, OPEN, EOF, TELL, SEEK -READLINE - proper implementation (see comment in Apache::compat) $r->finfo: 1.31 +7 -0 modperl-2.0/xs/Apache/RequestIO/Apache__RequestIO.h