cvs commit: modperl-2.0/src/modules/perl modperl_filter.h mod_perl.c modperl_filter.c

2003-01-11 Thread stas
stas2003/01/11 18:15:59

  Modified:xs/tables/current/ModPerl FunctionTable.pm
   src/modules/perl modperl_filter.h mod_perl.c
modperl_filter.c
  Log:
  improve the code readability by s/filter_register/filter_add/g because the
  filters are actually inserted, not just registered
  
  Revision  ChangesPath
  1.91  +4 -4  modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm
  
  Index: FunctionTable.pm
  ===
  RCS file: /home/cvs/modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm,v
  retrieving revision 1.90
  retrieving revision 1.91
  diff -u -r1.90 -r1.91
  --- FunctionTable.pm  11 Jan 2003 00:02:16 -  1.90
  +++ FunctionTable.pm  12 Jan 2003 02:15:58 -  1.91
  @@ -2322,7 +2322,7 @@
 },
 {
   'return_type' = 'void',
  -'name' = 'modperl_input_filter_register_connection',
  +'name' = 'modperl_input_filter_add_connection',
   'args' = [
 {
   'type' = 'conn_rec *',
  @@ -2332,7 +2332,7 @@
 },
 {
   'return_type' = 'void',
  -'name' = 'modperl_input_filter_register_request',
  +'name' = 'modperl_input_filter_add_request',
   'args' = [
 {
   'type' = 'request_rec *',
  @@ -3177,7 +3177,7 @@
 },
 {
   'return_type' = 'void',
  -'name' = 'modperl_output_filter_register_connection',
  +'name' = 'modperl_output_filter_add_connection',
   'args' = [
 {
   'type' = 'conn_rec *',
  @@ -3187,7 +3187,7 @@
 },
 {
   'return_type' = 'void',
  -'name' = 'modperl_output_filter_register_request',
  +'name' = 'modperl_output_filter_add_request',
   'args' = [
 {
   'type' = 'request_rec *',
  
  
  
  1.15  +4 -4  modperl-2.0/src/modules/perl/modperl_filter.h
  
  Index: modperl_filter.h
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.h,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- modperl_filter.h  30 May 2002 02:33:48 -  1.14
  +++ modperl_filter.h  12 Jan 2003 02:15:58 -  1.15
  @@ -37,9 +37,9 @@
   apr_status_t modperl_output_filter_handler(ap_filter_t *f,
  apr_bucket_brigade *bb);
   
  -void modperl_output_filter_register_connection(conn_rec *c);
  +void modperl_output_filter_add_connection(conn_rec *c);
   
  -void modperl_output_filter_register_request(request_rec *r);
  +void modperl_output_filter_add_request(request_rec *r);
   
   MP_INLINE apr_status_t modperl_output_filter_flush(modperl_filter_t *filter);
   
  @@ -61,8 +61,8 @@
 apr_read_type_e block,
 apr_off_t readbytes);
   
  -void modperl_input_filter_register_connection(conn_rec *c);
  +void modperl_input_filter_add_connection(conn_rec *c);
   
  -void modperl_input_filter_register_request(request_rec *r);
  +void modperl_input_filter_add_request(request_rec *r);
   
   #endif /* MODPERL_FILTER_H */
  
  
  
  1.146 +4 -4  modperl-2.0/src/modules/perl/mod_perl.c
  
  Index: mod_perl.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.c,v
  retrieving revision 1.145
  retrieving revision 1.146
  diff -u -r1.145 -r1.146
  --- mod_perl.c12 Dec 2002 10:05:07 -  1.145
  +++ mod_perl.c12 Jan 2003 02:15:58 -  1.146
  @@ -481,8 +481,8 @@
   
   static int modperl_hook_pre_connection(conn_rec *c, void *csd)
   {
  -modperl_input_filter_register_connection(c);
  -modperl_output_filter_register_connection(c);
  +modperl_input_filter_add_connection(c);
  +modperl_output_filter_add_connection(c);
   return OK;
   }
   
  @@ -595,10 +595,10 @@
   ap_hook_handler(modperl_response_handler_cgi,
   NULL, NULL, APR_HOOK_MIDDLE);
   
  -ap_hook_insert_filter(modperl_output_filter_register_request,
  +ap_hook_insert_filter(modperl_output_filter_add_request,
 NULL, NULL, APR_HOOK_LAST);
   
  -ap_hook_insert_filter(modperl_input_filter_register_request,
  +ap_hook_insert_filter(modperl_input_filter_add_request,
 NULL, NULL, APR_HOOK_LAST);
   
   ap_register_output_filter(MP_FILTER_REQUEST_OUTPUT_NAME,
  
  
  
  1.41  +38 -38modperl-2.0/src/modules/perl/modperl_filter.c
  
  Index: modperl_filter.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.c,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- modperl_filter.c  25 Nov 2002 22:47:39 -  1.40
  +++ modperl_filter.c  12 Jan 2003 02:15:58 -  1.41
  @@ -443,11 

cvs commit: modperl-2.0/xs/tables/current/ModPerl FunctionTable.pm

2003-01-11 Thread stas
stas2003/01/11 18:33:28

  Modified:xs/Apache/Filter Apache__Filter.h
   xs/maps  modperl_functions.map
   xs/tables/current/ModPerl FunctionTable.pm
  Log:
  add $filter-seen_eos flag for the streaming interface
  
  Revision  ChangesPath
  1.21  +8 -0  modperl-2.0/xs/Apache/Filter/Apache__Filter.h
  
  Index: Apache__Filter.h
  ===
  RCS file: /home/cvs/modperl-2.0/xs/Apache/Filter/Apache__Filter.h,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- Apache__Filter.h  12 Jan 2003 02:31:54 -  1.20
  +++ Apache__Filter.h  12 Jan 2003 02:33:27 -  1.21
  @@ -125,3 +125,11 @@
   
   return ctx-data ? SvREFCNT_inc(ctx-data) : PL_sv_undef;
   }
  +
  +static MP_INLINE SV *mpxs_Apache__Filter_seen_eos(pTHX_ I32 items,
  +  SV **MARK, SV **SP)
  +{
  +modperl_filter_t *modperl_filter;
  +mpxs_usage_va_1(modperl_filter, $filter-seen_eos());
  +return modperl_filter-seen_eos ? PL_sv_yes : PL_sv_no;
  +}
  
  
  
  1.48  +1 -0  modperl-2.0/xs/maps/modperl_functions.map
  
  Index: modperl_functions.map
  ===
  RCS file: /home/cvs/modperl-2.0/xs/maps/modperl_functions.map,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- modperl_functions.map 12 Jan 2003 02:31:54 -  1.47
  +++ modperl_functions.map 12 Jan 2003 02:33:27 -  1.48
  @@ -74,6 +74,7 @@
   
mpxs_Apache__Filter_print | | ...
mpxs_Apache__Filter_read  | | ...
  + mpxs_Apache__Filter_seen_eos | | ...
mpxs_Apache__Filter_ctx   | | filter, data=Nullsv
   
SV *:DEFINE_TIEHANDLE | | SV *:stashsv, SV *:sv=Nullsv
  
  
  
  1.93  +26 -0 modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm
  
  Index: FunctionTable.pm
  ===
  RCS file: /home/cvs/modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm,v
  retrieving revision 1.92
  retrieving revision 1.93
  diff -u -r1.92 -r1.93
  --- FunctionTable.pm  12 Jan 2003 02:31:55 -  1.92
  +++ FunctionTable.pm  12 Jan 2003 02:33:28 -  1.93
  @@ -4892,6 +4892,32 @@
   ]
 },
 {
  +'return_type' = 'SV *',
  +'name' = 'mpxs_Apache__Filter_seen_eos',
  +'attr' = [
  +  'static',
  +  '__inline__'
  +],
  +'args' = [
  +  {
  +'type' = 'PerlInterpreter *',
  +'name' = 'my_perl'
  +  },
  +  {
  +'type' = 'I32',
  +'name' = 'items'
  +  },
  +  {
  +'type' = 'SV **',
  +'name' = 'mark'
  +  },
  +  {
  +'type' = 'SV **',
  +'name' = 'sp'
  +  }
  +]
  +  },
  +  {
   'return_type' = 'void',
   'name' = 'mpxs_Apache__Log_BOOT',
   'attr' = [
  
  
  



cvs commit: modperl-2.0/t/filter/TestFilter reverse.pm

2003-01-11 Thread stas
stas2003/01/11 18:37:11

  Modified:t/filter/TestFilter reverse.pm
  Log:
  send the signature only when eos has been seen (the filter can be invoked
  many times during the same request)
  
  Revision  ChangesPath
  1.5   +4 -1  modperl-2.0/t/filter/TestFilter/reverse.pm
  
  Index: reverse.pm
  ===
  RCS file: /home/cvs/modperl-2.0/t/filter/TestFilter/reverse.pm,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- reverse.pm25 Nov 2002 22:46:29 -  1.4
  +++ reverse.pm12 Jan 2003 02:37:11 -  1.5
  @@ -18,7 +18,10 @@
   $filter-print(\n);
   }
   }
  -$filter-print(Reversed by mod_perl 2.0\n);
  +
  +if ($filter-seen_eos) {
  +$filter-print(Reversed by mod_perl 2.0\n);
  +}
   
   return Apache::OK;
   }
  
  
  



cvs commit: modperl-2.0/t/filter/TestFilter buckets.pm

2003-01-11 Thread stas
stas2003/01/11 20:00:42

  Modified:t/filter/TestFilter buckets.pm
  Log:
  make sure that the body of the filter is executed only once
  
  Revision  ChangesPath
  1.8   +22 -17modperl-2.0/t/filter/TestFilter/buckets.pm
  
  Index: buckets.pm
  ===
  RCS file: /home/cvs/modperl-2.0/t/filter/TestFilter/buckets.pm,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- buckets.pm11 Sep 2002 00:50:31 -  1.7
  +++ buckets.pm12 Jan 2003 04:00:42 -  1.8
  @@ -19,31 +19,36 @@
   sub handler {
   my($filter, $bb) = @_;
   
  -Apache::TestToString-start;
  +unless ($filter-ctx) {
   
  -plan tests = 4;
  +Apache::TestToString-start;
   
  -my $ba = $filter-r-connection-bucket_alloc;
  +plan tests = 4;
   
  -#should only have 1 bucket from the response() below
  -for (my $bucket = $bb-first; $bucket; $bucket = $bb-next($bucket)) {
  -ok $bucket-type-name;
  -ok $bucket-length == 2;
  -$bucket-read(my $data);
  -ok $data eq 'ok';
  -}
  +my $ba = $filter-r-connection-bucket_alloc;
  +
  +#should only have 1 bucket from the response() below
  +for (my $bucket = $bb-first; $bucket; $bucket = $bb-next($bucket)) {
  +ok $bucket-type-name;
  +ok $bucket-length == 2;
  +$bucket-read(my $data);
  +ok (defined $data and $data eq 'ok');
  +}
   
  -my $tests = Apache::TestToString-finish;
  +my $tests = Apache::TestToString-finish;
   
  -my $brigade = APR::Brigade-new($filter-r-pool, $ba);
  -my $bucket = APR::Bucket-new($tests);
  +my $brigade = APR::Brigade-new($filter-r-pool, $ba);
  +my $bucket = APR::Bucket-new($tests);
   
  -$brigade-insert_tail($bucket);
  +$brigade-insert_tail($bucket);
   
  -my $ok = $brigade-first-type-name =~ /mod_perl/ ? 4 : 0;
  -$brigade-insert_tail(APR::Bucket-new(ok $ok\n));
  +my $ok = $brigade-first-type-name =~ /mod_perl/ ? 4 : 0;
  +$brigade-insert_tail(APR::Bucket-new(ok $ok\n));
   
  -$filter-next-pass_brigade($brigade);
  +$filter-next-pass_brigade($brigade);
  +
  +$filter-ctx(1); # flag that we have run this already
  +}
   
   Apache::OK;
   }
  
  
  



RE: [ANNOUNCE] Apache::DBI 0.90_02

2003-01-11 Thread Beau E. Cox
WOW!

I had heard moving A:DBI to 2 was going to be very difficult!
I've been waiting...

I'll try it this weekend...

Thanks and Aloha = Beau;

-Original Message-
From: Ask Bjoern Hansen [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 10, 2003 5:30 PM
To: [EMAIL PROTECTED]
Subject: [ANNOUNCE] Apache::DBI 0.90_02



Last night I spent a bit of time making a proper test for
Apache::DBI and make it work without Apache.pm.  Just now I made it
work with mod_perl 2.0.  I have only tested that very briefly.

Until it hits your CPAN mirror, get it from:
http://develooper.com/code/Apache::DBI/

Or from CVS; instructions at
http://dev.perl.org/cvs/info?module=Apache/DBI/

Please try it out if you have a chance.  I would also like to see
more tests added to the t/ directory.


 - ask


Apache-DBI-0.90_02.tar.gz has entered CPAN as

  file: $CPAN/authors/id/A/AB/ABH/Apache-DBI-0.90_02.tar.gz
  size: 26770 bytes
   md5: e8c1082b19ad6a01bd572e13628da17d


Changes since 0.89:


0.90_02 January 10, 2003
- Changes to make Apache::DBI load and function under mod_perl
  2.0.  A few important notes: connect_on_init does not work yet
  and there's no automatic RollBack cleanup handler when
  autocommit is turned off.

0.90_01 January 10, 2003
- Only call Apache::Status if Apache.pm is completely loaded
- Make Test::More a prerequisite so we can do real tests
- Make DBI.pm a prerequisite
- Add a simple, but real, test script.  Requires DBD::mysql
  and a test database







Re: [ANNOUNCE] Apache::DBI 0.90_02

2003-01-11 Thread Stas Bekman
Beau E. Cox wrote:

WOW!

I had heard moving A:DBI to 2 was going to be very difficult!
I've been waiting...


I think it's not what you think. The difficult thing is the pool over 
threads support, so you can re-use the same connection over all threads 
in the process. 0.90_02 version has a pool per proc/thread, no sharing.
But you still benefit from the per-process cache just as in mod_perl 1.0.

[...]

0.90_02 January 10, 2003
- Changes to make Apache::DBI load and function under mod_perl
  2.0.



__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com




HTTP

2003-01-11 Thread Beau E. Cox
Hi -

I am learning Apache/pod_perl with the 'Eagle' book,
and am writing a mini HTTP server in perl as a learning
aid. Everthing was going peachy untill I got to Authorization.

Thru my browser (I've used MS IE and Netscape on W2K and various Linux
browsers) I request a page served by my server; the request lookes like
(from my log):

-  GET / HTTP/1.1
-  Accept: */*
-  Accept-Language: en-us
-  Accept-Encoding: gzip, deflate
-  User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR
1.0.3705)
-  Host: 127.0.0.1:8223
-  Connection: Keep-Alive

I serve the following:

-  HTTP/1.1 401 Authorization Required
-  Date: Sat Jan 11 02:54:52 2003
-  Server: BC_HTTP_PlayServer/0.0.1 (MSWin32)
-  WWW-Authenticate: Basic realm=WallyWorld
-  Content-Length: 167
-  Content-Type: text/html
-
-  html
-  head
-  titleAuthorization Required/title
-  /head
-  body
-  h1Jeff, the instructional HTTP Server/h1
-  hr width=100%/hr
-  p
-  Wrong!
-  /p
-  /body
-  /html

All browsers seem to ignore the

-  WWW-Authenticate: Basic realm=WallyWorld

header line and just display the page instead of popping
up the Authorization window and sending back the Authorize
header line. If I put Authorization
into a page served by Apache it works (of cource).

I've read the RFP's again and again and I can't see what I'm missing.
Can any HTTP experts help?

Aloha = Beau.

PS: Sorry if this seems OT, but it is in my mod_perl learning path!





RE: [ANNOUNCE] Apache::DBI 0.90_02

2003-01-11 Thread Ask Bjoern Hansen
On Fri, 10 Jan 2003, Beau E. Cox wrote:

 I had heard moving A:DBI to 2 was going to be very difficult!
 I've been waiting...

As Stas said, it really wasn't.  You might even have been able to
with Apache::compat; I did not try.

The harder part is to make the database handles shared across a pool
of threads.  But just having it work like it does in Apache 1.x is
much better than not having it work at all!  :-)


 - ask

-- 
ask bjoern hansen, http://www.askbjoernhansen.com/ !try; do();



Re: development techniques

2003-01-11 Thread Adrian Howard

On Friday, January 10, 2003, at 12:07  pm, Mark Fowler wrote:


On Thu, 9 Jan 2003, Jim Martinez wrote:


Is there some way to improve this cycle : edit code - refresh 
browser -
possibly look at the error log - edit code - ...

No one seems to have mentioned WWW::Mechanize (or if they have I've 
missed
it.)  It's a simple module that allows you to interact with LWP like 
it's
a web browser (i.e. click on that link, enter these values into the 
form,
etc) abstracting away the actual parsing of the HTML.
[snip]

I second that suggestion. Very useful module. Especially since it's a 
subclass of LWP::UserAgent - giving it added power (e.g. set different 
user agents to test sites that server different things to different 
browsers).

Adrian



Re: OSCON ideas

2003-01-11 Thread Lyle Brooks
Quoting Perrin Harkins ([EMAIL PROTECTED]):
 As many of you probably know, the call for participation in this year's 
 Open Source Conference has gone out 
 (http://conferences.oreillynet.com/cs/os2003/create/e_sess).  I'm 
 thinking about possible talks to submit and I want a little feedback on 
 what people are most interested in.  Here are two options I'mconsidering:
 
 1) Database Objects in Perl
 
 This talk would focus on the database mapping options for Perl, 
 including modules like Tangram, Class::DBI, SPOPS, etc.  It would 
 examine the differences in features, ease of use, and performance and 
 include a set of hand-coded classes using straight DBI for comparison.


This would be a very interesting talk to attend.  Alot of applications
hook in to databases, so the interest coverage should be pretty high.

I've looked at a few of these, and where I struggle is trying to find
what is the right tool for the job.  When is Tangram too much of a 
tool and when is straight DBI not enough?  What approaches scales
as your needs change.  

I'd throw Alzabo in there as well.  Something about the Object to 
Relational mapping is worthy of inclusion.  IIRC, there's also a
brief discussion of this in the Advanced Perl Programming book.

Maybe I just can't get my brain around some of these frameworks,
but I haven't found one that feels right when I have to do a 
query that isn't just a simple select or join of two tables.



 
 2) The Perl Pet Store
 
 This would be a discussion of porting the J2EE Pet Store reference 
 application to Perl.  It would cover Perl equivalents for various J2EE 
 features, and talk about what was easier or harder to do in Perl. 
 Because of the size of the Pet Store codebase and the complexity of the 
 environment required to run it (multiple databases, etc.), it may not be 
 possible to do a good performance benchmark.  However comparisons on 
 other fronts (amount of code, ease of maintenance, etc.) would be made.

I like this one too.


 
 What do you guys think?
 
 - Perrin