> So this: > > thing = (char*)((ST(1) == &sv_undef) ? NULL : pstrdup(p, SvPV(ST(1),na))) > > Probably intends to read: > > thing = (char*)((SvOK(ST(1))) ? pstrdup(p, SvPV(ST(1),na) : NULL) >
cool! I integrated your new get_set_PVp logic and it worked just fine. nice work, and thanks. below is a set of patches that adds tests for both $r->args(undef); (which uses get_set_PVp via a one-hop from Perl-land) as well as $r->the_request(undef); (which uses get_set_PVp directly and which worked ok already). all tests pass for me with current CVS + bleedperl. I had to fiddle with some other parts of api.pl/api.t too, since the uri now has a query string in it. if api.pl isn't the right place for these, let me know. --Geoff Index: Changes =================================================================== RCS file: /home/cvs/modperl/Changes,v retrieving revision 1.645 diff -u -r1.645 Changes --- Changes 23 May 2002 04:21:06 -0000 1.645 +++ Changes 29 May 2002 14:04:55 -0000 @@ -10,6 +10,10 @@ =item 1.26_01-dev +fix get_set_PVp() to properly set NULL values when passing in undef +thanks to Lyle Brooks for the spot +[Stephen Clouse <[EMAIL PROTECTED]>] + Apache::Registry errors are now saved in $r->notes('error-notes') [Jesse Erlbaum <[EMAIL PROTECTED]>] Index: src/modules/perl/mod_perl_xs.h =================================================================== RCS file: /home/cvs/modperl/src/modules/perl/mod_perl_xs.h,v retrieving revision 1.6 diff -u -r1.6 mod_perl_xs.h --- src/modules/perl/mod_perl_xs.h 2 Mar 2000 23:23:10 -0000 1.6 +++ src/modules/perl/mod_perl_xs.h 29 May 2002 14:04:55 -0000 @@ -3,7 +3,7 @@ #define get_set_PVp(thing,p) \ RETVAL = (char*)thing; \ if(items > 1) \ - thing = (char*)((ST(1) == &sv_undef) ? NULL : pstrdup(p, SvPV(ST(1),na))) + thing = (char*)(SvOK(ST(1)) ? pstrdup(p, SvPV(ST(1),na)) : NULL) #define get_set_PV(thing) \ get_set_PVp(thing,r->pool) Index: t/internal/api.t =================================================================== RCS file: /home/cvs/modperl/t/internal/api.t,v retrieving revision 1.1 diff -u -r1.1 api.t --- t/internal/api.t 6 Dec 1997 17:57:12 -0000 1.1 +++ t/internal/api.t 29 May 2002 14:04:55 -0000 @@ -1,3 +1,3 @@ use Apache::test; -print fetch "http://$net::httpserver$net::perldir/api.pl"; +print fetch "http://$net::httpserver$net::perldir/api.pl?arg1=one&arg2=two"; Index: t/net/perl/api.pl =================================================================== RCS file: /home/cvs/modperl/t/net/perl/api.pl,v retrieving revision 1.48 diff -u -r1.48 api.pl --- t/net/perl/api.pl 24 Mar 2002 18:22:56 -0000 1.48 +++ t/net/perl/api.pl 29 May 2002 14:04:55 -0000 @@ -16,7 +16,7 @@ my $is_xs = ($r->uri =~ /_xs/); -my $tests = 75; +my $tests = 81; my $is_win32 = WIN32; $tests += 4 unless $is_win32; my $test_get_set = Apache->can('set_handlers') && ($tests += 4); @@ -73,9 +73,16 @@ } my $the_request = $r->the_request; -$r->the_request(join ' ', map { $r->$_() } qw(method uri protocol)); +my $request_string = $r->method . ' ' . + $r->uri . '?' . + $r->args . ' ' . + $r->protocol; +$r->the_request($request_string); test ++$i, $the_request eq $r->the_request; printf "old=$the_request, new=%s\n", $r->the_request; +$r->the_request(undef); +test ++$i, not $r->the_request; +test ++$i, not defined $r->the_request; my $doc_root = $r->document_root; $r->document_root('/tmp'); @@ -103,6 +110,14 @@ test ++$i, $r->status_line; test ++$i, $r->method eq "GET"; #test ++$i, $r->method_number + +# args +test ++$i, $r->args eq 'arg1=one&arg2=two'; +$r->args('foo=bar'); +test ++$i, $r->args eq 'foo=bar'; +$r->args(undef); +test ++$i, not $r->args; +test ++$i, not defined $r->args; $r->subprocess_env(SetKey => 'value'); test ++$i, $r->subprocess_env('SetKey') eq 'value'; --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]