stas 2003/08/20 16:53:16
Modified: t/response/TestAPR perlio.pm xs/APR/PerlIO apr_perlio.c . Changes Log: APR::PerlIO now accepts the pool object instead of a request/server objects, so it can be used anywhere, including outside mod_perl Revision Changes Path 1.21 +8 -8 modperl-2.0/t/response/TestAPR/perlio.pm Index: perlio.pm =================================================================== RCS file: /home/cvs/modperl-2.0/t/response/TestAPR/perlio.pm,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- perlio.pm 29 Jul 2003 15:38:36 -0000 1.20 +++ perlio.pm 20 Aug 2003 23:53:16 -0000 1.21 @@ -48,7 +48,7 @@ my $file = catfile $dir, "test"; t_debug "open file $file for writing"; my $foo = "bar"; - open my $fh, ">:APR", $file, $r + open my $fh, ">:APR", $file, $r->pool or die "Cannot open $file for writing: $!"; ok ref($fh) eq 'GLOB'; @@ -65,7 +65,7 @@ # non-existent file my $file = "/this/file/does/not/exist"; - if (open my $fh, "<:APR", $file, $r) { + if (open my $fh, "<:APR", $file, $r->pool) { t_debug "must not be able to open $file!"; ok 0; close $fh; @@ -79,7 +79,7 @@ # seek/tell() tests unless (LARGE_FILES_CONFLICT) { - open my $fh, "<:APR", $file, $r + open my $fh, "<:APR", $file, $r->pool or die "Cannot open $file for reading: $!"; # read the whole file so we can test the buffer flushed @@ -116,7 +116,7 @@ # read() tests { - open my $fh, "<:APR", $file, $r + open my $fh, "<:APR", $file, $r->pool or die "Cannot open $file for reading: $!"; # basic open test @@ -150,7 +150,7 @@ # eof() tests { - open my $fh, "<:APR", $file, $r + open my $fh, "<:APR", $file, $r->pool or die "Cannot open $file for reading: $!"; ok t_cmp(0, @@ -170,7 +170,7 @@ # dup() test { - open my $fh, "<:APR", $file, $r + open my $fh, "<:APR", $file, $r->pool or die "Cannot open $file for reading: $!"; open my $dup_fh, "<&:APR", $fh @@ -188,9 +188,9 @@ # unbuffered write { - open my $wfh, ">:APR", $file, $r + open my $wfh, ">:APR", $file, $r->pool or die "Cannot open $file for writing: $!"; - open my $rfh, "<:APR", $file, $r + open my $rfh, "<:APR", $file, $r->pool or die "Cannot open $file for reading: $!"; my $expected = "This is an un buffering write test"; 1.29 +10 -3 modperl-2.0/xs/APR/PerlIO/apr_perlio.c Index: apr_perlio.c =================================================================== RCS file: /home/cvs/modperl-2.0/xs/APR/PerlIO/apr_perlio.c,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- apr_perlio.c 29 Jul 2003 09:28:19 -0000 1.28 +++ apr_perlio.c 20 Aug 2003 23:53:16 -0000 1.29 @@ -89,10 +89,17 @@ st = PerlIOSelf(f, PerlIOAPR); + /* XXX: can't reuse a wrapper mp_xs_sv2_APR__Pool */ + /* XXX: should probably add checks on pool validity in all other callbacks */ sv = args[narg-1]; - /* XXX: modperl_sv2pool cannot be used outside of httpd */ - st->pool = modperl_sv2pool(aTHX_ sv); - + if (SvROK(sv) && (SvTYPE(SvRV(sv)) == SVt_PVMG)) { + st->pool = (apr_pool_t *)SvIV((SV*)SvRV(sv)); + } + else { + Perl_croak(aTHX_ "argument is not a blessed reference " + "(expecting an APR::Pool derived object)"); + } + rc = apr_file_open(&st->file, path, apr_flag, APR_OS_DEFAULT, st->pool); #ifdef PERLIO_APR_DEBUG 1.210 +3 -0 modperl-2.0/Changes Index: Changes =================================================================== RCS file: /home/cvs/modperl-2.0/Changes,v retrieving revision 1.209 retrieving revision 1.210 diff -u -r1.209 -r1.210 --- Changes 20 Aug 2003 23:20:14 -0000 1.209 +++ Changes 20 Aug 2003 23:53:16 -0000 1.210 @@ -12,6 +12,9 @@ =item 1.99_10-dev +APR::PerlIO now accepts the pool object instead of a request/server +objects, so it can be used anywhere, including outside mod_perl [Stas] + when perl is built with perlio enabled (5.8+) the new PerlIO Apache layer is used, so now one can push layers onto STDIN, STDOUT handles e.g. binmode(STDOUT, ':utf8'); [Stas]