cvs commit: modperl-2.0/lib/ModPerl Code.pm

2001-12-17 Thread dougm

dougm   01/12/17 21:58:54

  Modified:lib/ModPerl Code.pm
  Log:
  generate a modperl_largefiles.h include file with the
  $Config{ccflags_uselargefiles} we have ripped out when compiling
  modperl.
  
  Revision  ChangesPath
  1.74  +16 -0 modperl-2.0/lib/ModPerl/Code.pm
  
  Index: Code.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v
  retrieving revision 1.73
  retrieving revision 1.74
  diff -u -r1.73 -r1.74
  --- Code.pm   2001/12/05 02:22:24 1.73
  +++ Code.pm   2001/12/18 05:58:54 1.74
  @@ -466,6 +466,21 @@
   ();
   }
   
  +sub generate_largefiles {
  +my($self, $h_fh) = @_;
  +
  +my $flags = $self->perl_config('ccflags_uselargefiles');
  +
  +return unless $flags;
  +
  +for my $flag (split /\s+/, $flags) {
  +my($name, $val) = split '=', $flag;
  +$val ||= '';
  +$name =~ s/^-D//;
  +print $h_fh "#define $name $val\n";
  +}
  +}
  +
   sub ins_underscore {
   $_[0] =~ s/([a-z])([A-Z])/$1_$2/g;
   }
  @@ -526,6 +541,7 @@
  generate_flags  => {h => 'modperl_flags.h',
  c => 'modperl_flags.c'},
  generate_trace  => {h => 'modperl_trace.h'},
  +   generate_largefiles => {h => 'modperl_largefiles.h'},
  generate_constants  => {h => 'modperl_constants.h',
  c => 'modperl_constants.c'},
   );
  
  
  



cvs commit: modperl-2.0/lib/ModPerl Code.pm

2001-12-04 Thread stas

stas01/12/04 18:22:25

  Modified:lib/Apache Build.pm
   lib/ModPerl Code.pm
  Log:
  remove the caching of the noedit preamble and generate a
  fresh noedit header + trace for each invocation. the caching was wrong,
  since it was using the same trace for more than one place in the same
  package.
  
  Revision  ChangesPath
  1.75  +1 -4  modperl-2.0/lib/Apache/Build.pm
  
  Index: Build.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/Apache/Build.pm,v
  retrieving revision 1.74
  retrieving revision 1.75
  diff -u -r1.74 -r1.75
  --- Build.pm  2001/11/22 03:46:47 1.74
  +++ Build.pm  2001/12/05 02:22:24 1.75
  @@ -417,11 +417,8 @@
   chmod 0755, $file;
   }
   
  -my $noedit_warning_hash;
  -
   sub noedit_warning_hash {
  -$noedit_warning_hash ||=
  -  ModPerl::Code::noedit_warning_hash(__PACKAGE__);
  +ModPerl::Code::noedit_warning_hash(__PACKAGE__);
   }
   
   sub save {
  
  
  
  1.73  +5 -9  modperl-2.0/lib/ModPerl/Code.pm
  
  Index: Code.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v
  retrieving revision 1.72
  retrieving revision 1.73
  diff -u -r1.72 -r1.73
  --- Code.pm   2001/11/24 01:15:01 1.72
  +++ Code.pm   2001/12/05 02:22:24 1.73
  @@ -555,8 +555,6 @@
   [(map { "$_.c" } @c_names), (map { "$_.h" } @h_names)];
   }
   
  -my %warnings;
  -
   sub classname {
   my $self = shift || __PACKAGE__;
   ref($self) || $self;
  @@ -564,12 +562,11 @@
   
   sub noedit_warning_c {
   my $class = classname(shift);
  -my $warning = \$warnings{C}->{$class};
  -return $$warning if $$warning;
  +
   my $v = join '/', $class, $class->VERSION;
   my $trace = Apache::TestConfig::calls_trace();
   $trace =~ s/^/ * /mg;
  -$$warning = <{$class};
  -return $$warning if $$warning;
  -($$warning = noedit_warning_c($class)) =~ s/^/\# /mg;
  -$$warning;
  +
  +(my $warning = noedit_warning_c($class)) =~ s/^/\# /mg;
  +return $warning;
   }
   
   sub init_file {
  
  
  



cvs commit: modperl-2.0/lib/ModPerl Code.pm

2001-09-19 Thread stas

stas01/09/19 23:07:48

  Modified:lib/ModPerl Code.pm
  Log:
  adding the generator calls trace ala Apache::TestConfig::genwarning
  
  Revision  ChangesPath
  1.68  +5 -1  modperl-2.0/lib/ModPerl/Code.pm
  
  Index: Code.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v
  retrieving revision 1.67
  retrieving revision 1.68
  diff -u -r1.67 -r1.68
  --- Code.pm   2001/09/17 23:36:35 1.67
  +++ Code.pm   2001/09/20 06:07:48 1.68
  @@ -5,6 +5,8 @@
   use mod_perl ();
   use Apache::Build ();
   
  +use Apache::TestConfig ();
  +
   our $VERSION = '0.01';
   our @ISA = qw(Apache::Build);
   
  @@ -558,6 +560,8 @@
   my $warning = \$warnings{C}->{$class};
   return $$warning if $$warning;
   my $v = join '/', $class, $class->VERSION;
  +my $trace = Apache::TestConfig::calls_trace();
  +$trace =~ s/^/ * /mg;
   $$warning = <


cvs commit: modperl-2.0/lib/ModPerl Code.pm

2001-09-15 Thread dougm

dougm   01/09/15 15:25:55

  Modified:lib/ModPerl Code.pm
  Log:
  integrate modperl_perl.[ch]
  
  Revision  ChangesPath
  1.66  +2 -1  modperl-2.0/lib/ModPerl/Code.pm
  
  Index: Code.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v
  retrieving revision 1.65
  retrieving revision 1.66
  diff -u -r1.65 -r1.66
  --- Code.pm   2001/05/08 21:08:18 1.65
  +++ Code.pm   2001/09/15 22:25:55 1.66
  @@ -522,7 +522,8 @@
   );
   
   my @c_src_names = qw(interp tipool log config cmd options callback handler
  - gtop util io filter bucket mgv pcw global env cgi);
  + gtop util io filter bucket mgv pcw global env cgi
  + perl);
   my @g_c_names = map { "modperl_$_" } qw(hooks directives flags xsinit);
   my @c_names   = ('mod_perl', (map "modperl_$_", @c_src_names));
   sub c_files { [map { "$_.c" } @c_names, @g_c_names] }
  
  
  



cvs commit: modperl-2.0/lib/ModPerl Code.pm

2001-04-29 Thread dougm

dougm   01/04/29 21:37:01

  Modified:lib/ModPerl Code.pm
  Log:
  integrate modperl_global module
  
  Revision  ChangesPath
  1.60  +3 -2  modperl-2.0/lib/ModPerl/Code.pm
  
  Index: Code.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- Code.pm   2001/04/19 17:42:16 1.59
  +++ Code.pm   2001/04/30 04:37:00 1.60
  @@ -93,7 +93,8 @@
   my %flags = (
   Srv => ['NONE', @ithread_opts, qw(ENABLED AUTOLOAD MERGE_HANDLERS),
   @hook_flags, 'UNSET'],
  -Dir => [qw(NONE SEND_HEADER SETUP_ENV MERGE_HANDLERS UNSET)],
  +Dir => [qw(NONE SEND_HEADER SETUP_ENV MERGE_HANDLERS GLOBAL_REQUEST UNSET)],
  +Req => [qw(NONE SET_GLOBAL_REQUEST)],
   Interp => [qw(NONE IN_USE PUTBACK CLONED BASE)],
   Handler => [qw(NONE PARSED METHOD OBJECT ANON AUTOLOAD DYNAMIC)],
   );
  @@ -521,7 +522,7 @@
   );
   
   my @c_src_names = qw(interp tipool log config cmd options callback handler
  - gtop util filter bucket mgv pcw);
  + gtop util filter bucket mgv pcw global);
   my @g_c_names = map { "modperl_$_" } qw(hooks directives flags xsinit);
   my @c_names   = ('mod_perl', (map "modperl_$_", @c_src_names));
   sub c_files { [map { "$_.c" } @c_names, @g_c_names] }
  
  
  



cvs commit: modperl-2.0/lib/ModPerl Code.pm

2001-04-19 Thread dougm

dougm   01/04/19 10:42:19

  Modified:lib/ModPerl Code.pm
  Log:
  add PerlInputFilterHandler
  
  Revision  ChangesPath
  1.59  +3 -2  modperl-2.0/lib/ModPerl/Code.pm
  
  Index: Code.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v
  retrieving revision 1.58
  retrieving revision 1.59
  diff -u -r1.58 -r1.59
  --- Code.pm   2001/04/18 05:25:01 1.58
  +++ Code.pm   2001/04/19 17:42:16 1.59
  @@ -14,14 +14,15 @@
   PerSrv => [qw(PostReadRequest Trans)], #Init
   PerDir => [qw(HeaderParser
 Access Authen Authz
  -  Type Fixup OutputFilter Response Log)], #Init Cleanup
  +  Type Fixup Response Log
  +  InputFilter OutputFilter)], #Init Cleanup
   Connection => [qw(PreConnection ProcessConnection)],
   );
   
   my %hooks = map { $_, canon_lc($_) }
   map { @{ $handlers{$_} } } keys %handlers;
   
  -my %not_ap_hook = map { $_, 1 } qw(response output_filter);
  +my %not_ap_hook = map { $_, 1 } qw(response output_filter input_filter);
   
   my %hook_proto = (
   Process=> {
  
  
  



cvs commit: modperl-2.0/lib/ModPerl Code.pm

2001-04-17 Thread dougm

dougm   01/04/17 22:25:01

  Modified:lib/ModPerl Code.pm
  Log:
  strip APR_ and AP_ prefixes from constant names
  
  Revision  ChangesPath
  1.58  +3 -2  modperl-2.0/lib/ModPerl/Code.pm
  
  Index: Code.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v
  retrieving revision 1.57
  retrieving revision 1.58
  diff -u -r1.57 -r1.58
  --- Code.pm   2001/04/18 04:40:00 1.57
  +++ Code.pm   2001/04/18 05:25:01 1.58
  @@ -680,7 +680,7 @@
   $file;
   }
   
  -my $constant_prefixes = join '|', qw{APR};
  +my $constant_prefixes = join '|', qw{APR?};
   
   sub generate_constants {
   my($self, $h_fh, $c_fh) = @_;
  @@ -789,7 +789,8 @@
push @tags, $group;
   my $name = join '_', 'MP_constants', $class, $group;
print $c_fh "\nstatic const char *$name [] = { \n",
  -  (map { s/^APR_//; qq(   "$_",\n) } @$constants), "   NULL,\n};\n";
  +  (map { s/^($constant_prefixes)_//o;
  + qq(   "$_",\n) } @$constants), "   NULL,\n};\n";
   }
   
   my %switch;
  
  
  



cvs commit: modperl-2.0/lib/ModPerl Code.pm

2001-04-17 Thread dougm

dougm   01/04/17 21:40:02

  Modified:lib/ModPerl Code.pm
  Log:
  include modperl_bucket
  
  Revision  ChangesPath
  1.57  +1 -1  modperl-2.0/lib/ModPerl/Code.pm
  
  Index: Code.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- Code.pm   2001/04/11 23:00:59 1.56
  +++ Code.pm   2001/04/18 04:40:00 1.57
  @@ -520,7 +520,7 @@
   );
   
   my @c_src_names = qw(interp tipool log config cmd options callback handler
  - gtop util filter mgv pcw);
  + gtop util filter bucket mgv pcw);
   my @g_c_names = map { "modperl_$_" } qw(hooks directives flags xsinit);
   my @c_names   = ('mod_perl', (map "modperl_$_", @c_src_names));
   sub c_files { [map { "$_.c" } @c_names, @g_c_names] }
  
  
  



cvs commit: modperl-2.0/lib/ModPerl Code.pm

2001-04-11 Thread dougm

dougm   01/04/11 16:01:00

  Modified:.Makefile.PL
   lib/ModPerl Code.pm
  Log:
  make sure Apache::ConstantsTable can be found
  
  Revision  ChangesPath
  1.32  +1 -1  modperl-2.0/Makefile.PL
  
  Index: Makefile.PL
  ===
  RCS file: /home/cvs/modperl-2.0/Makefile.PL,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- Makefile.PL   2001/04/04 05:27:59 1.31
  +++ Makefile.PL   2001/04/11 23:00:56 1.32
  @@ -115,7 +115,7 @@
   
   $xs->generate;
   
  -shift @INC;
  +#shift @INC; #ModPerl::Code needs this path too
   }
   
   sub generate_script {
  
  
  
  1.56  +2 -2  modperl-2.0/lib/ModPerl/Code.pm
  
  Index: Code.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- Code.pm   2001/04/11 22:40:38 1.55
  +++ Code.pm   2001/04/11 23:00:59 1.56
  @@ -680,12 +680,12 @@
   $file;
   }
   
  -use Apache::ConstantsTable ();
  -
   my $constant_prefixes = join '|', qw{APR};
   
   sub generate_constants {
   my($self, $h_fh, $c_fh) = @_;
  +
  +require Apache::ConstantsTable;
   
   print $c_fh qq{\#include "modperl_const.h"\n};
   print $h_fh "#define MP_ENOCONST -3\n\n";
  
  
  



cvs commit: modperl-2.0/lib/ModPerl Code.pm

2001-04-11 Thread dougm

dougm   01/04/11 15:40:40

  Modified:lib/ModPerl Code.pm
  Log:
  generate the constants lookup code
  
  Revision  ChangesPath
  1.55  +153 -1modperl-2.0/lib/ModPerl/Code.pm
  
  Index: Code.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v
  retrieving revision 1.54
  retrieving revision 1.55
  diff -u -r1.54 -r1.55
  --- Code.pm   2001/03/26 21:43:30 1.54
  +++ Code.pm   2001/04/11 22:40:38 1.55
  @@ -515,6 +515,8 @@
  generate_flags  => {h => 'modperl_flags.h',
  c => 'modperl_flags.c'},
  generate_trace  => {h => 'modperl_trace.h'},
  +   generate_constants  => {h => 'modperl_constants.h',
  +   c => 'modperl_constants.c'},
   );
   
   my @c_src_names = qw(interp tipool log config cmd options callback handler
  @@ -531,7 +533,14 @@
   sub h_files { [map { "$_.h" } @h_names, @g_h_names] }
   
   sub clean_files {
  -[(map { "$_.c" } @g_c_names), (map { "$_.h" } @g_h_names)];
  +my @c_names = @g_c_names;
  +my @h_names = @g_h_names;
  +
  +for (\@c_names, \@h_names) {
  +push @$_, 'modperl_constants';
  +}
  +
  +[(map { "$_.c" } @c_names), (map { "$_.h" } @h_names)];
   }
   
   my %warnings;
  @@ -669,6 +678,149 @@
   close $fh;
   
   $file;
  +}
  +
  +use Apache::ConstantsTable ();
  +
  +my $constant_prefixes = join '|', qw{APR};
  +
  +sub generate_constants {
  +my($self, $h_fh, $c_fh) = @_;
  +
  +print $c_fh qq{\#include "modperl_const.h"\n};
  +print $h_fh "#define MP_ENOCONST -3\n\n";
  +
  +generate_constants_lookup($h_fh, $c_fh);
  +generate_constants_group_lookup($h_fh, $c_fh);
  +}
  +
  +my %shortcuts = (
  + NOT_FOUND => 'HTTP_NOT_FOUND',
  + FORBIDDEN => 'HTTP_FORBIDDEN',
  + AUTH_REQUIRED => 'HTTP_UNAUTHORIZED',
  + SERVER_ERROR => 'HTTP_INTERNAL_SERVER_ERROR',
  +);
  +
  +sub constants_lookup_code {
  +my($h_fh, $c_fh, $constants, $class) = @_;
  +
  +my(%switch, %alias);
  +
  +%alias = %shortcuts;
  +
  +my $postfix = lc $class;
  +my $package = $class . '::';
  +my $package_len = length $package;
  +
  +my $func = canon_func(qw(constants lookup), $postfix);
  +my $proto = "int $func(const char *name)";
  +
  +print $h_fh "$proto;\n";
  +
  +print $c_fh <


cvs commit: modperl-2.0/lib/ModPerl Code.pm

2001-03-14 Thread dougm

dougm   01/03/14 10:32:13

  Modified:lib/ModPerl Code.pm
  Log:
  generate modperl_handler_lookup() function for mapping Perl*Handler strings to 
integer value
  
  Revision  ChangesPath
  1.44  +56 -2 modperl-2.0/lib/ModPerl/Code.pm
  
  Index: Code.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- Code.pm   2001/03/14 17:38:29 1.43
  +++ Code.pm   2001/03/14 18:32:11 1.44
  @@ -141,18 +141,19 @@
   while (my($class, $handlers) = each %{ $self->{handlers} }) {
   my $i = 0;
   my $n = @$handlers;
  +my $handler_type = canon_define('HANDLER_TYPE', $class);
   
   print $h_fh "\n#define ",
 canon_define($class, 'num_handlers'), " $n\n\n";
   
  -print $h_fh "#define ",
  -  canon_define('HANDLER_TYPE', $class), " $type\n\n";
  +print $h_fh "#define $handler_type $type\n\n";
   
   $type++;
   
   for my $name (@$handlers) {
   my $define = canon_define($name, 'handler');
   $self->{handler_index}->{$class}->[$i] = $define;
  +$self->{handler_index_type}->{$class}->[$i] = $handler_type;
   $self->{handler_index_desc}->{$class}->[$i] = "Perl${name}Handler";
   print $h_fh "#define $define $i\n";
   $i++;
  @@ -205,6 +206,55 @@
   return ($h_add, $c_add);
   }
   
  +sub generate_handler_find {
  +my($self, $h_fh, $c_fh) = @_;
  +
  +my $proto = 'int modperl_handler_lookup(const char *name, int *type)';
  +my(%ix, %switch);
  +
  +print $h_fh "$proto;\n";
  +
  +print $c_fh <{handlers} }) {
  +my $i = 0;
  +
  +for my $name (@$handlers) {
  +$name =~ /^([A-Z])/;
  +push @{ $switch{$1} }, $name;
  +$ix{$name}->{name} = $self->{handler_index}->{$class}->[$i];
  +$ix{$name}->{type} = $self->{handler_index_type}->{$class}->[$i++];
  +}
  +}
  +
  +for my $key (sort keys %switch) {
  +my $names = $switch{$key};
  +print $c_fh "  case '$key':\n";
  +
  +for my $name (@$names) {
  +my $n = length($name);
  +print $c_fh <{type};
  +  return $ix{$name}->{name};
  +  }
  +EOF
  +}
  +}
  +
  +print $c_fh "};\nreturn -1;\n}\n";
  +
  +return ("", "");
  +}
  +
   sub generate_handler_directives {
   my($self, $h_fh, $c_fh) = @_;
   
  @@ -454,6 +504,8 @@
  c => 'modperl_hooks.c'},
  generate_handler_directives => {h => 'modperl_directives.h',
  c => 'modperl_directives.c'},
  +   generate_handler_find   => {h => 'modperl_hooks.h',
  +   c => 'modperl_hooks.c'},
  generate_flags  => {h => 'modperl_flags.h',
  c => 'modperl_flags.c'},
  generate_trace  => {h => 'modperl_trace.h'},
  @@ -560,6 +612,7 @@
   }
   
   for my $method (reverse sort keys %sources) {
  +print "$method...";
   my($h_fh, $c_fh) = map {
   $self->fh($sources{$method}->{$_});
   } qw(h c);
  @@ -570,6 +623,7 @@
   if ($c_add) {
   print $c_fh $c_add;
   }
  +print "done\n";
   }
   
   $self->postamble;
  
  
  



cvs commit: modperl-2.0/lib/ModPerl Code.pm

2001-02-21 Thread dougm

dougm   01/02/21 19:49:22

  Modified:lib/Apache Build.pm
   lib/ModPerl Code.pm
  Log:
  make noedit_warning routines more usable elsewhere
  
  Revision  ChangesPath
  1.31  +9 -2  modperl-2.0/lib/Apache/Build.pm
  
  Index: Build.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/Apache/Build.pm,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- Build.pm  2001/02/08 19:30:44 1.30
  +++ Build.pm  2001/02/22 03:49:22 1.31
  @@ -333,6 +333,13 @@
   chmod 0755, $file;
   }
   
  +my $noedit_warning_hash;
  +
  +#we are use'd by ModPerl::Code, so delay this until after compilation
  +CHECK {
  +$noedit_warning_hash = ModPerl::Code::noedit_warning_hash(__PACKAGE__);
  +}
  +
   sub save {
   my($self, $file) = @_;
   
  @@ -347,7 +354,7 @@
   #work around autosplit braindeadness
   my $package = 'package Apache::BuildConfig';
   
  -print $fh ModPerl::Code::noedit_warning_hash();
  +print $fh $noedit_warning_hash;
   
   print $fh <', $mf or die "open $mf: $!";
   
  -print $fh ModPerl::Code::noedit_warning_hash();
  +print $fh $noedit_warning_hash;
   
   $self->make_tools($fh);
   
  
  
  
  1.41  +23 -11modperl-2.0/lib/ModPerl/Code.pm
  
  Index: Code.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- Code.pm   2001/02/18 21:57:50 1.40
  +++ Code.pm   2001/02/22 03:49:22 1.41
  @@ -469,10 +469,20 @@
   [(map { "$_.c" } @g_c_names), (map { "$_.h" } @g_h_names)];
   }
   
  -sub noedit_warning {
  -my $v = join '/', __PACKAGE__, $VERSION;
  -return <{$class};
  +return $$warning if $$warning;
  +my $v = join '/', $class, $class->VERSION;
  +$$warning = <{$class};
  +return $$warning if $$warning;
  +($$warning = noedit_warning_c($class)) =~ s/^/\# /mg;
  +$$warning;
   }
   
   sub init_file {
  @@ -512,7 +524,7 @@
   warn "generating...$file\n";
   unlink $file;
   open my $fh, '>>', $file or die "open $file: $!";
  -print $fh @preamble, $noedit_warning;
  +print $fh @preamble, noedit_warning_c();
   
   $self->{fh}->{$name} = $fh;
   }
  @@ -576,7 +588,7 @@
   
   my $package = 'package Apache2';
   
  -print $fh ModPerl::Code::noedit_warning_hash();
  +print $fh noedit_warning_hash();
   
   print $fh <


cvs commit: modperl-2.0/lib/ModPerl Code.pm

2001-02-01 Thread dougm

dougm   01/02/01 13:35:44

  Modified:lib/ModPerl Code.pm
  Log:
  use hex for better readability
  
  Revision  ChangesPath
  1.39  +3 -2  modperl-2.0/lib/ModPerl/Code.pm
  
  Index: Code.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- Code.pm   2001/01/21 23:19:02 1.38
  +++ Code.pm   2001/02/01 21:35:42 1.39
  @@ -279,6 +279,7 @@
   $n++;
   
   for my $f (@$opts) {
  +my $x = sprintf "0x%08x", $i;
   my $flag = "${class}_f_$f";
   my $cmd  = $class . $f;
   my $name = canon_name($f);
  @@ -290,7 +291,7 @@
   print $h_fh <


cvs commit: modperl-2.0/lib/ModPerl Code.pm

2000-06-11 Thread dougm

dougm   00/06/11 21:41:09

  Modified:lib/ModPerl Code.pm
  Log:
  add string => flag bit lookup functions
  
  Revision  ChangesPath
  1.28  +29 -4 modperl-2.0/lib/ModPerl/Code.pm
  
  Index: Code.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- Code.pm   2000/06/12 03:30:50 1.27
  +++ Code.pm   2000/06/12 04:41:09 1.28
  @@ -83,12 +83,14 @@
   
   my %flags = (
   Srv => [qw(NONE PERL_TAINT_CHECK PERL_WARN FRESH_RESTART
  -   PERL_CLONE PERL_ALLOC)],
  +   PERL_CLONE PERL_ALLOC UNSET)],
   Dir => [qw(NONE INCPUSH SENDHDR SENTHDR ENV CLEANUP RCLEANUP)],
   Interp => [qw(NONE IN_USE PUTBACK CLONED BASE)],
   Handler => [qw(NONE PARSED METHOD OBJECT ANON)],
   );
   
  +my %flags_lookup = map { $_,1 } qw(Srv);
  +
   sub new {
   my $class = shift;
   bless {
  @@ -234,10 +236,17 @@
   }
   
   sub generate_flags {
  -my($self, $h_fh) = @_;
  +my($self, $h_fh, $c_fh) = @_;
   
   while (my($class, $opts) = each %{ $self->{flags} }) {
   my $i = 0;
  +my @lookup = ();
  +my $lookup_proto = "";
  +if ($flags_lookup{$class}) {
  +$lookup_proto = join canon_func('flags', 'lookup', $class),
  +  'int ', '(const char *str)';
  +push @lookup, "$lookup_proto {";
  +}
   
   print $h_fh "\n#define Mp${class}FLAGS(p) p->flags\n";
   $class = "Mp$class";
  @@ -245,6 +254,10 @@
   for my $f (@$opts) {
   my $flag = "${class}_f_$f";
   my $cmd  = $class . $f;
  +if (@lookup) {
  +my $name = canon_name($f);
  +push @lookup, qq(   if (strEQ(str, "$name")) return $flag;);
  +}
   
   print $h_fh < 'modperl_hooks.c'},
  generate_handler_directives => {h => 'modperl_directives.h',
  c => 'modperl_directives.c'},
  -   generate_flags  => {h => 'modperl_flags.h'},
  +   generate_flags  => {h => 'modperl_flags.h',
  +   c => 'modperl_flags.c'},
  generate_trace  => {h => 'modperl_trace.h'},
   );
   
   my @c_src_names = qw(interp tipool log config callback gtop);
  -my @g_c_names = map { "modperl_$_" } qw(hooks directives xsinit);
  +my @g_c_names = map { "modperl_$_" } qw(hooks directives flags xsinit);
   my @c_names   = ('mod_perl', (map "modperl_$_", @c_src_names));
   sub c_files { [map { "$_.c" } @c_names, @g_c_names] }
   sub o_files { [map { "$_.o" } @c_names, @g_c_names] }
  
  
  



cvs commit: modperl-2.0/lib/ModPerl Code.pm MM.pm

2000-06-08 Thread dougm

dougm   00/06/08 21:30:42

  Modified:lib/Apache Build.pm
   lib/ModPerl Code.pm MM.pm
  Log:
  integrate with ModPerl::BuildOptions
  misc build tweaks
  
  Revision  ChangesPath
  1.19  +13 -64modperl-2.0/lib/Apache/Build.pm
  
  Index: Build.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/Apache/Build.pm,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- Build.pm  2000/05/30 18:34:45 1.18
  +++ Build.pm  2000/06/09 04:30:41 1.19
  @@ -7,6 +7,7 @@
   use Cwd ();
   use ExtUtils::Embed ();
   use ModPerl::Code ();
  +use ModPerl::BuildOptions ();
   
   use constant is_win32 => $^O eq 'MSWin32';
   use constant IS_MOD_PERL_BUILD => grep { -e "$_/lib/mod_perl.pm" } qw(. ..);
  @@ -95,6 +96,10 @@
   $ccopts .= " -g -Wall";
   }
   
  +if ($self->{MP_CCOPTS}) {
  +$ccopts .= " $self->{MP_CCOPTS}";
  +}
  +
   if ($self->{MP_TRACE}) {
   $ccopts .= " -DMP_TRACE";
   }
  @@ -174,41 +179,6 @@
   
   #--- user interaction ---
   
  -sub parse_init_file {
  -my $self = shift;
  -
  -my $fh;
  -for (qw(./ ../ ./. ../.), "$ENV{HOME}/.") {
  -my $file = $_ . 'makepl_args.mod_perl2';
  -if (open $fh, $file) {
  -$self->{init_file} = $file;
  -last;
  -}
  -$fh = undef;
  -}
  -
  -return unless $fh;
  -
  -print "Reading Makefile.PL args from $self->{init_file}\n";
  -while(<$fh>) {
  -chomp;
  -s/^\s+//; s/\s+$//;
  -next if /^\#/ || /^$/;
  -last if /^__END__/;
  -
  -if (/^MP_/) {
  -my($key, $val) = split $self->{param_qr}, $_, 2;
  -$self->{$key} = $val;
  -print "   $key = $val\n";
  - }
  -else {
  -push @ARGV, $_;
  -}
  -}
  -close $fh;
  -}
  -
  -
   sub prompt {
   my($self, $q, $default) = @_;
   return $default if $self->{MP_PROMPT_DEFAULT};
  @@ -256,43 +226,17 @@
   return Apache::BuildConfig::->new;
   }
   
  -sub parse_argv {
  -my $self = shift;
  -return unless @ARGV;
  -
  -my @args = @ARGV;
  -@ARGV = ();
  -
  -for (@args) {
  -if (/^MP_/) {
  -my($key, $val) = split $self->{param_qr}, $_, 2;
  -$self->{$key} = $val;
  -print "$key = $val\n";
  -}
  -else {
  -#pass along to MakeMaker
  -push @ARGV, $_;
  -}
  -}
  -}
  -
   sub new {
   my $class = shift;
   
   my $self = bless {
   cwd => Cwd::fastcwd(),
  -param_qr => qr([\s=]+),
   MP_LIBNAME => 'libmodperl',
   @_,
   }, $class;
   
  -$self->parse_init_file;
  -$self->parse_argv;
  +ModPerl::BuildOptions->init($self);
   
  -if ($self->{MP_DEBUG} and $self->{MP_USE_GTOP}) {
  -$self->{MP_USE_GTOP} = 0 unless $self->find_dlfile('gtop');
  -}
  -
   $self;
   }
   
  @@ -354,6 +298,8 @@
   #work around autosplit braindeadness
   my $package = 'package Apache::BuildConfig';
   
  +print $fh ModPerl::Code::noedit_warning_hash();
  +
   print $fh ', $mf or die "open $mf: $!";
   
  +print $fh ModPerl::Code::noedit_warning_hash();
  +
   $self->make_tools($fh);
   
   print $fh $self->canon_make_attr('libname', $self->{MP_LIBNAME});
  @@ -774,7 +722,8 @@
   my @inc = ();
   
   for ("$src/modules/perl", "$src/include",
  - "$src/lib/apr/include", "$src/os/$os")
  + "$src/lib/apr/include", "$src/os/$os",
  + $self->file_path("src/modules/perl"))
 {
 push @inc, "-I$_" if -d $_;
 }
  
  
  
  1.26  +9 -0  modperl-2.0/lib/ModPerl/Code.pm
  
  Index: Code.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- Code.pm   2000/05/23 20:54:42 1.25
  +++ Code.pm   2000/06/09 04:30:42 1.26
  @@ -407,7 +407,14 @@
   }
   
   my $noedit_warning = noedit_warning();
  +my $noedit_warning_hash = noedit_warning_hash();
   
  +sub noedit_warning_hash {
  +return $noedit_warning_hash if $noedit_warning_hash;
  +(my $warning = noedit_warning()) =~ s/^/\# /mg;
  +$warning;
  +}
  +
   sub init_file {
   my($self, $name) = @_;
   
  @@ -491,6 +498,8 @@
   open my $fh, '>', $file or die "open $file: $!";
   
   my $package = 'package Apache2';
  +
  +print $fh ModPerl::Code::noedit_warning_hash();
   
   print $fh 

cvs commit: modperl-2.0/lib/ModPerl Code.pm MM.pm

2000-04-30 Thread dougm

dougm   00/04/30 11:36:52

  Modified:.Makefile.PL
   lib/Apache Build.pm
   lib/ModPerl Code.pm MM.pm
  Log:
  "discover" xs modules.  since there is no list hardwired
  any module can be unpacked in the mod_perl-2.xx directory
  and built static
  
  this stunt also make it possible to leave .xs files where
  they are, unlike 1.xx where *.xs live in src/modules/perl
  and are copied to subdir/ if DYNAMIC=1
  
  Revision  ChangesPath
  1.19  +21 -4 modperl-2.0/Makefile.PL
  
  Index: Makefile.PL
  ===
  RCS file: /home/cvs/modperl-2.0/Makefile.PL,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- Makefile.PL   2000/04/30 03:31:16 1.18
  +++ Makefile.PL   2000/04/30 18:36:50 1.19
  @@ -32,6 +32,8 @@
   },
   );
   
  +post_configure();
  +
   sub configure {
   system_sanity_check();
   set_modperl_version();
  @@ -48,14 +50,27 @@
   
   printf "Configuring Apache/%s mod_perl/%s Perl/v%vd\n",
 $httpd_version, $VERSION, $^V;
  -
  -$code->generate;
   
  -$build->write_src_makefile;
  +for (@{ clean_files() }) {
  +unlink;
  +}
   
  +#ModPerl::MM will use Apache::BuildConfig in subdir/Makefile.PL's
   $build->save;
  +}
  +
  +sub post_configure {
  +
  +#didn't exist until configure()
  +require Apache::BuildConfig;
  +#now have any data subdir/Makefile.PL's save, e.g. XS
  +$build = Apache::BuildConfig->new;
  +
  +$build->write_src_makefile;
   $build->save_ldopts;
   
  +$code->generate($build);
  +
   printf "Will build mod_perl %s as %s\n",
 $build->is_dynamic ? "shared" : "static",
   $build->{"MODPERL_LIB"};
  @@ -63,6 +78,8 @@
   if ($build->{MP_INST_APACHE2}) {
   print "Will install Apache Perl modules into Apache2/\n";
   }
  +
  +$build->save;
   }
   
   sub echo_cmd {
  @@ -190,7 +207,7 @@
   my $self = shift;
   #up one from the Apache2/ subdir
   #so it can be found for 'use Apache2 ()'
  -$self->{PM}->{'lib/Apache2.pm'} =~ s:^\$\(INST_LIB\):blib/lib:;
  +$self->{PM}->{'lib/Apache2.pm'} = "blib/lib/Apache2.pm";
   '';
   }
   
  
  
  
  1.16  +93 -26modperl-2.0/lib/Apache/Build.pm
  
  Index: Build.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/Apache/Build.pm,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- Build.pm  2000/04/30 03:31:17 1.15
  +++ Build.pm  2000/04/30 18:36:51 1.16
  @@ -315,6 +315,12 @@
   $self->{$key} ||= ($override || $default_files{$name});
   }
   
  +sub file_path {
  +my($self, $file) = @_;
  +return $file if $file =~ m:^/:;
  +join '/', $self->{cwd}, $file;
  +}
  +
   sub freeze {
   require Data::Dumper;
   local $Data::Dumper::Terse = 1;
  @@ -339,6 +345,8 @@
   my($self, $file) = @_;
   
   $file ||= $self->default_file('build_config');
  +$file = $self->file_path($file);
  +
   (my $obj = $self->freeze) =~ s/^//;
   open my $fh, '>', $file or die "open $file: $!";
   
  @@ -573,9 +581,70 @@
   "$attr = $self->{$attr}\n\n";
   }
   
  +sub xsubpp {
  +my $self = shift;
  +my $xsubpp = join ' ', '$(MODPERL_PERLPATH)',
  +  '$(MODPERL_PRIVLIBEXP)/ExtUtils/xsubpp',
  +'-typemap', '$(MODPERL_PRIVLIBEXP)/ExtUtils/typemap';
  +$xsubpp;
  +}
  +
  +sub make_xs {
  +my($self, $fh) = @_;
  +
  +print $fh $self->canon_make_attr(xsubpp => $self->xsubpp);
  +
  +return [] unless $self->{XS};
  +
  +my @files;
  +my @xs_targ;
  +
  +while (my($name, $xs) = each %{ $self->{XS} }) {
  +#Foo/Bar.xs => Bar.c
  +(my $c = $xs) =~ s:.*/(\w+)\.xs$:$1.c:;
  +push @files, $c;
  +
  +$xs = "../../../$xs"; #XXX
  +
  +push @xs_targ, < \$*.xsc && \$(MODPERL_MV) \$*.xsc \$@
  +
  +EOF
  +}
  +
  +my %o = (xs_o_files => 'o', xs_o_pic_files => 'lo');
  +
  +for my $ext (qw(xs_o_files xs_o_pic_files)) {
  +print $fh $self->canon_make_attr($ext, map {
  +(my $file = $_) =~ s/c$/$o{$ext}/; $file;
  +} @files);
  +}
  +
  +print $fh $self->canon_make_attr(xs_clean_files => @files);
  +
  +\@xs_targ;
  +}
  +
   my @perl_config_pm =
  -  qw(cc ld ar rm ranlib lib_ext dlext cccdlflags lddlflags optimize);
  +  qw(cc ld ar rm ranlib lib_ext dlext cccdlflags lddlflags optimize
  + perlpath privlibexp);
  +
  +sub make_tools {
  +my($self, $fh) = @_;
   
  +#XXX win32
  +
  +for (@perl_config_pm) {
  +print $fh $self->canon_make_attr($_, $self->perl_config($_));
  +}
  +
  +print $fh $self->canon_make_attr('RM_F' => #XXX
  + $self->{MODPERL_RM} . ' -f');
  +
  +print $fh $self->canon_make_attr(MV => 'mv');
  +}

cvs commit: modperl-2.0/lib/ModPerl Code.pm

2000-04-29 Thread dougm

dougm   00/04/29 20:31:17

  Modified:.Makefile.PL
   lib/Apache Build.pm
   lib/ModPerl Code.pm
  Log:
  MP_INST_APACHE2=1 attribute will cause *.pm and *.so to be installed in
  an Apache2/ subdirectory so mod_perl-1.xx and mod_perl-2.0 can co-exist
  in the same site_perl tree.
  'PerlModule Apache2' will add these directories to @INC
  
  Revision  ChangesPath
  1.18  +36 -12modperl-2.0/Makefile.PL
  
  Index: Makefile.PL
  ===
  RCS file: /home/cvs/modperl-2.0/Makefile.PL,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- Makefile.PL   2000/04/29 02:28:35 1.17
  +++ Makefile.PL   2000/04/30 03:31:16 1.18
  @@ -2,12 +2,10 @@
   use strict;
   use warnings;
   
  -use ExtUtils::Embed ();
  -use ExtUtils::MakeMaker qw(WriteMakefile);
  -
   use lib qw(lib);
   use Apache::Build ();
   use ModPerl::Code ();
  +use ModPerl::MM ();
   
   our $VERSION;
   
  @@ -21,12 +19,13 @@
   
   configure();
   
  -WriteMakefile(
  +ModPerl::MM::WriteMakefile(
   NAME => 'mod_perl',
   VERSION => $VERSION,
   macro => {
   MODPERL_SRC => $code->path,
   PERL => $build->perl_config('perlpath'),
  +MOD_INSTALL => ModPerl::MM::mod_install(),
   },
   clean => {
   FILES => "@{ clean_files() }",
  @@ -60,6 +59,10 @@
   printf "Will build mod_perl %s as %s\n",
 $build->is_dynamic ? "shared" : "static",
   $build->{"MODPERL_LIB"};
  +
  +if ($build->{MP_INST_APACHE2}) {
  +print "Will install Apache Perl modules into Apache2/\n";
  +}
   }
   
   sub echo_cmd {
  @@ -84,12 +87,6 @@
   chdir $build->cwd;
   }
   
  -sub echo_unlink {
  -my $file = shift;
  -print "unlink $file\n";
  -unlink $file;
  -}
  -
   sub clean_files {
   my $path = $code->path;
   
  @@ -153,11 +150,13 @@
   }
   }
   
  +package MY;
  +
   sub MY::top_targets {
   my $self = shift;
   my $string = $self->MM::top_targets;
   
  -$build->mm_add_dep(\$string, pure_all => 'modperl_lib');
  +ModPerl::MM::add_dep(\$string, pure_all => 'modperl_lib');
   
   $string .= <<'EOF';
   
  @@ -175,7 +174,7 @@
   sub MY::clean {
   my $self = shift;
   my $string = $self->MM::clean(@_);
  -$build->mm_add_dep(\$string, clean => 'modperl_src_clean');
  +ModPerl::MM::add_dep(\$string, clean => 'modperl_src_clean');
   $string;
   }
   
  @@ -185,4 +184,29 @@
   
   sub MY::tool_autosplit {
   '';
  +}
  +
  +sub MY::post_initialize {
  +my $self = shift;
  +#up one from the Apache2/ subdir
  +#so it can be found for 'use Apache2 ()'
  +$self->{PM}->{'lib/Apache2.pm'} =~ s:^\$\(INST_LIB\):blib/lib:;
  +'';
  +}
  +
  +sub MY::manifypods {
  +my $self = shift;
  +my $ver = $self->{VERSION} || "";
  +local $_ = $self->MM::manifypods(@_);
  +s/pod2man\s*$/pod2man --release mod_perl-$ver/m;
  +$_;
  +}
  +
  +sub MY::pasthru {
  +my $self = shift;
  +chomp(my $str = $self->MM::pasthru);
  +join $/, "$str\\",
  +"\t".'PERL="$(PERL)"\\',
  +"\t".'DEFINE="$(DEFINE)"',
  +"";
   }
  
  
  
  1.15  +1 -7  modperl-2.0/lib/Apache/Build.pm
  
  Index: Build.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/Apache/Build.pm,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Build.pm  2000/04/29 18:01:25 1.14
  +++ Build.pm  2000/04/30 03:31:17 1.15
  @@ -301,6 +301,7 @@
   'build_config' => 'lib/Apache/BuildConfig.pm',
   'ldopts' => 'src/modules/perl/ldopts',
   'makefile' => 'src/modules/perl/Makefile',
  +'apache2_pm' => 'lib/Apache2.pm',
   );
   
   sub clean_files {
  @@ -743,13 +744,6 @@
   my $self = shift;
   
   return "";
  -}
  -
  -#--- tweak MakeMaker ---
  -
  -sub mm_add_dep {
  -my($self, $string, $targ, $add) = @_;
  -$$string =~ s/($targ\s+::)/$1 $add /;
   }
   
   1;
  
  
  
  1.23  +29 -0 modperl-2.0/lib/ModPerl/Code.pm
  
  Index: Code.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- Code.pm   2000/04/28 05:40:34 1.22
  +++ Code.pm   2000/04/30 03:31:17 1.23
  @@ -2,8 +2,10 @@
   
   use strict;
   use warnings;
  +use Apache::Build ();
   
   our $VERSION = '0.01';
  +our @ISA = qw(Apache::Build);
   
   my %handlers = (
   Process=> [qw(ChildInit)], #ChildExit Restart PreConfig
  @@ -473,6 +475,33 @@
   warn "generating...$xsinit\n";
   
   ExtUtils::Embed::xsinit($xsinit);
  +
  +warn "generating...", $self->generate_apache2_pm, "\n";
  +}
  +
  +sub generate_apache2_pm {
  +my $self = shift;
  +
  +my $lib = $self->perl_config

cvs commit: modperl-2.0/lib/ModPerl Code.pm

2000-04-27 Thread dougm

dougm   00/04/27 22:40:35

  Modified:lib/ModPerl Code.pm
  Log:
  keep these names in one place
  
  Revision  ChangesPath
  1.22  +4 -11 modperl-2.0/lib/ModPerl/Code.pm
  
  Index: Code.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- Code.pm   2000/04/27 22:02:02 1.21
  +++ Code.pm   2000/04/28 05:40:34 1.22
  @@ -5,25 +5,18 @@
   
   our $VERSION = '0.01';
   
  -#XXX Init, PreConfig
   my %handlers = (
  -Process=> [qw(ChildInit ChildExit Restart)],
  +Process=> [qw(ChildInit)], #ChildExit Restart PreConfig
   Files  => [qw(OpenLogs PostConfig)],
  -PerSrv => [qw(PostReadRequest Trans)],
  +PerSrv => [qw(PostReadRequest Trans)], #Init
   PerDir => [qw(HeaderParser
 Access Authen Authz
  -  Type Fixup Response
  -  Log Cleanup)],
  +  Type Fixup Log)], #Init Response Cleanup
   Connection => [qw(PreConnection ProcessConnection)],
   );
   
   my %hooks = map { $_, canon_lc($_) }
  -qw{OpenLogs PostConfig ChildInit
  -   PreConnection PostConnection
  -   PostReadRequest Trans
  -   HeaderParser
  -   Access Authen Authz
  -   Type Fixup Log};
  +map { @{ $handlers{$_} } } keys %handlers;
   
   my %hook_proto = (
   Process=> {
  
  
  



cvs commit: modperl-2.0/lib/ModPerl Code.pm

2000-04-27 Thread dougm

dougm   00/04/27 14:48:38

  Modified:lib/ModPerl Code.pm
  Log:
  hookup PerlPostConfigHandler
  
  Revision  ChangesPath
  1.20  +1 -0  modperl-2.0/lib/ModPerl/Code.pm
  
  Index: Code.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- Code.pm   2000/04/27 21:42:24 1.19
  +++ Code.pm   2000/04/27 21:48:38 1.20
  @@ -32,6 +32,7 @@
   ProcessConnection => 'process_connection',
   OpenLogs => 'open_logs',
   ChildInit => 'child_init',
  +PostConfig => 'post_config',
   );
   
   my %hook_proto = (
  
  
  



cvs commit: modperl-2.0/lib/ModPerl Code.pm

2000-04-24 Thread dougm

dougm   00/04/24 21:38:54

  Modified:lib/Apache Build.pm
   lib/ModPerl Code.pm
  Log:
  .h dependencies
  
  Revision  ChangesPath
  1.12  +3 -2  modperl-2.0/lib/Apache/Build.pm
  
  Index: Build.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/Apache/Build.pm,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Build.pm  2000/04/25 04:25:40 1.11
  +++ Build.pm  2000/04/25 04:38:53 1.12
  @@ -616,7 +616,7 @@
   print $fh $self->canon_make_attr($method, $self->$method());
   }
   
  -for my $method (qw(c_files o_files o_pic_files)) {
  +for my $method (qw(c_files o_files o_pic_files h_files)) {
   print $fh $self->canon_make_attr($method, @{ $code->$method() });
   }
   
  @@ -670,7 +670,8 @@
$(MODPERL_RM_F) $(MODPERL_O_PIC_FILES)
$(MODPERL_RM_F) $(MODPERL_CLEAN_FILES)
   
  -$(MODPERL_O_FILES): Makefile
  +$(MODPERL_O_FILES): $(MODPERL_H_FILES) Makefile
  +$(MODPERL_O_PIC_FILES): $(MODPERL_H_FILES) Makefile
   EOF
   
   close $fh;
  
  
  
  1.16  +6 -4  modperl-2.0/lib/ModPerl/Code.pm
  
  Index: Code.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- Code.pm   2000/04/25 03:48:26 1.15
  +++ Code.pm   2000/04/25 04:38:54 1.16
  @@ -380,12 +380,14 @@
   
   my @c_src_names = qw(interp log config callback gtop);
   my @g_c_names = map { "modperl_$_" } qw(hooks directives xsinit);
  -my @c_names   = ('mod_perl', (map "modperl_$_", @c_src_names), @g_c_names);
  -sub c_files { [map { "$_.c" } @c_names] }
  -sub o_files { [map { "$_.o" } @c_names] }
  -sub o_pic_files { [map { "$_.lo" } @c_names] }
  +my @c_names   = ('mod_perl', (map "modperl_$_", @c_src_names));
  +sub c_files { [map { "$_.c" } @c_names, @g_c_names] }
  +sub o_files { [map { "$_.o" } @c_names, @g_c_names] }
  +sub o_pic_files { [map { "$_.lo" } @c_names, @g_c_names] }
   
   my @g_h_names = map { "modperl_$_" } qw(hooks directives flags trace);
  +my @h_names = @c_names;
  +sub h_files { [map { "$_.h" } @h_names, @g_h_names] }
   
   sub clean_files {
   [(map { "$_.c" } @g_c_names), (map { "$_.h" } @g_h_names)];
  
  
  



cvs commit: modperl-2.0/lib/ModPerl Code.pm

2000-04-20 Thread dougm

dougm   00/04/20 22:20:14

  Modified:lib/ModPerl Code.pm
  Log:
  generate register_hook, command_rec entries and description code
  
  Revision  ChangesPath
  1.13  +78 -6 modperl-2.0/lib/ModPerl/Code.pm
  
  Index: Code.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- Code.pm   2000/04/18 22:59:13 1.12
  +++ Code.pm   2000/04/21 05:20:14 1.13
  @@ -17,6 +17,19 @@
   Connection => [qw(PreConnection PostConnection)],
   );
   
  +my %hooks = (
  +ChildInit => 'child_init',
  +PostReadRequest => 'post_read_request',
  +Trans => 'translate_name',
  +HeaderParser => 'header_parser',
  +Access => 'access_checker',
  +Authen => 'check_user_id',
  +Authz => 'auth_checker',
  +Type => 'type_checker',
  +Fixup => 'fixups',
  +Log => 'log_transaction'
  +);
  +
   my %hook_proto = (
   Process=> {
   ret  => 'void',
  @@ -42,6 +55,9 @@
   
   $hook_proto{PerDir} = $hook_proto{PerSrv};
   
  +my $dcfg_get = 
  +  'modperl_dir_config_t *dcfg = (modperl_dir_config_t *)dummy';
  +
   my %directive_proto = (
   PerSrv => {
   args => [{type => 'cmd_parms', name => 'parms'},
  @@ -53,15 +69,15 @@
   },
   PerDir => {
   args => [{type => 'cmd_parms', name => 'parms'},
  - {type => 'modperl_dir_config_t', name => 'dcfg'},
  + {type => 'void', name => 'dummy'},
{type => 'char', name => 'arg'}],
  -cfg  => {get => '', name => 'dcfg'},
  +cfg  => {get => $dcfg_get, name => 'dcfg'},
   scope => 'OR_ALL',
   },
   );
   
   while (my($k,$v) = each %directive_proto) {
  -$directive_proto{$k}->{ret} = 'char *';
  +$directive_proto{$k}->{ret} = 'const char *';
   }
   
   for (qw(Process Connection Files)) {
  @@ -88,6 +104,30 @@
   
   sub path { shift->{path} }
   
  +sub handler_desc {
  +my($self, $h_add, $c_add) = @_;
  +local $" = ",\n";
  +while (my($class, $h) = each %{ $self->{handler_index_desc} }) {
  +my $func = canon_func($class, 'handler', 'desc');
  +my $array = join '_', 'MP', $func;
  +my $proto = "const char *$func(int idx)";
  +
  +$$h_add .= "$proto;\n";
  +
  +$$c_add .= <{handler_index}->{$class}->[$i] = $define;
  +$self->{handler_index_desc}->{$class}->[$i] = "Perl${name}Handler";
   print $h_fh "#define $define $i\n";
   $i++;
   }
  @@ -110,6 +151,8 @@
   sub generate_handler_hooks {
   my($self, $h_fh, $c_fh) = @_;
   
  +my @register_hooks;
  +
   while (my($class, $prototype) = each %{ $self->{hook_proto} }) {
   my $callback = canon_func($class, 'callback');
   my $return = $prototype->{ret} eq 'void' ? '' : 'return';
  @@ -118,6 +161,11 @@
   for my $handler (@{ $self->{handlers}{$class} }) {
   my $name = canon_func($handler, 'handler');
   
  +if (my $hook = $hooks{$handler}) {
  +push @register_hooks,
  +  "ap_hook_$hook($name, NULL, NULL, HOOK_LAST);";
  +}
  +
   my($protostr, $pass) = canon_proto($prototype, $name);
   my $ix = $self->{handler_index}->{$class}->[$i++];
   
  @@ -132,11 +180,22 @@
   EOF
   }
   }
  +
  +local $" = "\n";
  +my $hooks_proto = 'void modperl_register_handler_hooks(void)';
  +my $h_add = "$hooks_proto;\n";
  +my $c_add = "$hooks_proto {\n@register_hooks\n}\n";
  +
  +$self->handler_desc(\$h_add, \$c_add);
  +
  +return ($h_add, $c_add);
   }
   
   sub generate_handler_directives {
   my($self, $h_fh, $c_fh) = @_;
   
  +my @cmd_entries;
  +
   while (my($class, $handlers) = each %{ $self->{handlers} }) {
   my $prototype = $self->{directive_proto}->{$class};
   my $i = 0;
  @@ -151,6 +210,8 @@
   
   print $h_fh "$protostr;\n";
   
  +push @cmd_entries, $cmd_name;
  +
   print $h_fh <{cfg}->{get};
  -MP_TRACE_d(MP_FUNC, "push \@%s, %s\n", parms->cmd->name, arg);
  +MP_TRACE_d(MP_FUNC, "push \@%s, %s\\n", parms->cmd->name, arg);
   return modperl_cmd_push_handlers(&($av), arg, parms->pool);
   }
   EOF
   }
   }
  +
  +my $h_add =  '#define MP_CMD_ENTRIES \\' . "\n" . join ', \\'."\n", 
@cmd_entries;
  +
  +return ($h_add, "");
   }
   
   sub generate_flags {
  @@ -388,9 +453,16 @@
   }
   
   for my $method (reverse sort keys %sources) {
  -$self->$method(map {
  +my($h_fh, $c_fh) = map {
   $self->fh($sources{$method}->{$_});
  -} qw(h c));
  +} qw(h c);
  +my($h_add, $c_add) = $self->$method($h_fh, $c_fh);
  +if ($h_add) {
  +print $h_fh $h_add;
  +}

cvs commit: modperl-2.0/lib/ModPerl Code.pm

2000-04-16 Thread dougm

dougm   00/04/16 17:07:40

  Modified:lib/ModPerl Code.pm
  Log:
  MP_TRACE_x_do for arbitrary expressions
  
  Revision  ChangesPath
  1.9   +5 -0  modperl-2.0/lib/ModPerl/Code.pm
  
  Index: Code.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Code.pm   2000/04/16 01:41:22 1.8
  +++ Code.pm   2000/04/17 00:07:40 1.9
  @@ -200,20 +200,25 @@
   
   #ifdef MP_TRACE
   #define MP_TRACE_a if (MP_debug_level) modperl_trace
  +#define MP_TRACE_a_do(exp) if (MP_debug_level) exp
   #else
   #define MP_TRACE_a if (0) modperl_trace
  +#define MP_TRACE_a_do(exp)
   #endif
   
   EOF
   
   for my $type (@trace) {
   my $define = "#define MP_TRACE_$type";
  +my $define_do = join '_', $define, 'do';
   
   print $h_fh <


cvs commit: modperl-2.0/lib/ModPerl Code.pm

2000-04-15 Thread dougm

dougm   00/04/15 18:41:22

  Modified:.Makefile.PL
   lib/ModPerl Code.pm
  Log:
  dont need single file option now that sources are sorted on mtime
  
  Revision  ChangesPath
  1.8   +4 -11 modperl-2.0/Makefile.PL
  
  Index: Makefile.PL
  ===
  RCS file: /home/cvs/modperl-2.0/Makefile.PL,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Makefile.PL   2000/04/16 00:50:04 1.7
  +++ Makefile.PL   2000/04/16 01:41:21 1.8
  @@ -21,7 +21,7 @@
   use Getopt::Std;
   my %opts;
   getopts('Ecm:', \%opts);
  -configure()if $opts{c};
  +configure()  if $opts{c};
   make(\%opts) if $opts{m};
   }
   
  @@ -55,9 +55,7 @@
   
   sub make {
   my $opts = shift;
  -my $target = $opts->{m};
  -return clean() if $target eq 'c';
  -my $single_file = $target =~ /\.c$/ ? $target : "";
  +return clean() if $opts->{m} eq 'c';
   
   my $ccopts = ExtUtils::Embed::ccopts();
   my @inc = $build->inc;
  @@ -68,16 +66,11 @@
   my $flags = "-g -Wall";
   $flags .= " -E" if $opts->{E};
   
  -my @c_files = $single_file ? $single_file : $code->c_files;
  -
  -for (sort { (stat $b)[9] <=> (stat $a)[9] } @c_files) {
  +for (sort { (stat $b)[9] <=> (stat $a)[9] } @{ $code->c_files }) {
   echo_cmd "$cc $flags $ccopts @inc -c $_";
  -return if $single_file;
   }
  -
  -my @objs = $code->o_files;
   
  -echo_cmd "$ar crv libmodperl.a @objs";
  +echo_cmd "$ar crv libmodperl.a @{ $code->o_files }";
   
   chdir $build->cwd;
   }
  
  
  
  1.8   +2 -2  modperl-2.0/lib/ModPerl/Code.pm
  
  Index: Code.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Code.pm   2000/04/15 23:00:45 1.7
  +++ Code.pm   2000/04/16 01:41:22 1.8
  @@ -275,8 +275,8 @@
   my @c_src_names = qw(interp log config);
   my @g_c_names = map { "modperl_$_" } qw(hooks directives);
   my @c_names   = ('mod_perl', (map "modperl_$_", @c_src_names), @g_c_names);
  -sub c_files { map { "$_.c" } @c_names }
  -sub o_files { map { "$_.o" } @c_names }
  +sub c_files { [map { "$_.c" } @c_names] }
  +sub o_files { [map { "$_.o" } @c_names] }
   
   my @g_h_names = map { "modperl_$_" } qw(hooks directives flags trace);
   
  
  
  



Re: cvs commit: modperl-2.0/lib/ModPerl Code.pm

2000-04-15 Thread brian moseley

On Sat, 15 Apr 2000, Doug MacEachern wrote:

> that is sad.  consider PerlFreshRestart and graceful
> restart. it doesn't take much effort to type '' instead
> of "".  it might not make that much of a difference in
> parse time, but it doesn't hurt either. can we please
> drop this topic, there's plenty more important things to
> worry about.

if you don't watch it i'm going to start questioning where
you put your curly braces.





Re: cvs commit: modperl-2.0/lib/ModPerl Code.pm

2000-04-15 Thread Stas Bekman

> > The only question I still want to ask you is why do we care about the
> > parse time, when mod_perl is a preloaded and precompiled. 
> 
> again, this is not the only reason.  however, i do think it's important to
> speed up parse time if possible.  
> consider t/TEST
> print "still waiting for server to warm up...";
> }
> for (1..4) {
> sleep $_;
> if (simple_fetch "/test.html") {
> print "ok\n";
> }
> else {
> print "...";
> }
> }
> 
> that is sad.  consider PerlFreshRestart and graceful restart.
> it doesn't take much effort to type '' instead of "".  it might not make
> that much of a difference in parse time, but it doesn't hurt either.
> can we please drop this topic, there's plenty more important things to
> worry about.




__
Stas Bekman | JAm_pH--Just Another mod_perl Hacker
http://stason.org/  | mod_perl Guide  http://perl.apache.org/guide 
mailto:[EMAIL PROTECTED]  | http://perl.orghttp://stason.org/TULARC/
http://singlesheaven.com| http://perlmonth.com http://sourcegarden.org
--




Re: cvs commit: modperl-2.0/lib/ModPerl Code.pm

2000-04-15 Thread Doug MacEachern

> The only question I still want to ask you is why do we care about the
> parse time, when mod_perl is a preloaded and precompiled. 

again, this is not the only reason.  however, i do think it's important to
speed up parse time if possible.  
consider t/TEST
print "still waiting for server to warm up...";
}
for (1..4) {
sleep $_;
if (simple_fetch "/test.html") {
print "ok\n";
}
else {
print "...";
}
}

that is sad.  consider PerlFreshRestart and graceful restart.
it doesn't take much effort to type '' instead of "".  it might not make
that much of a difference in parse time, but it doesn't hurt either.
can we please drop this topic, there's plenty more important things to
worry about.




Re: cvs commit: modperl-2.0/lib/ModPerl Code.pm

2000-04-15 Thread Stas Bekman

On Fri, 14 Apr 2000, Doug MacEachern wrote:

> > > Orwant and friends in "Algorithms with Perl" page 28 claims the first form
> > > is slower.
> 
> faster to *parse*, not faster to *run*.  stas, your benchmarks don't test
> parse time.

The only question I still want to ask you is why do we care about the
parse time, when mod_perl is a preloaded and precompiled. If nothing
should be parsed at the *run time*, why it's important to work on the
*parse time*. I understand that it will make a server start and restart
faster.  Anything else that I've missed? 

Thanks a lot!

__
Stas Bekman | JAm_pH--Just Another mod_perl Hacker
http://stason.org/  | mod_perl Guide  http://perl.apache.org/guide 
mailto:[EMAIL PROTECTED]  | http://perl.orghttp://stason.org/TULARC/
http://singlesheaven.com| http://perlmonth.com http://sourcegarden.org
--




Re: cvs commit: modperl-2.0/lib/ModPerl Code.pm

2000-04-14 Thread Doug MacEachern

> I don't want to get involved in an unproductive semi-religious war or
> anything

so then why did you?

>, but I'd just like to caution against change for (what seems
> little more than) the sake of change.

re-read my message, it is for more than the sake of change.
 
> I think it was our Lord Chancellor in about 1980 who said:
> 
> "If a thing ain't broke, don't mend it".

i consider ~30Mb processes broken, i plan to do everything in my power to
fix that.  e.g. Exporter.pm "ain't broke", it does what it says it will
do.  what it doesn't tell you is how much bloat it adds to the runtime.
as far as i'm concerned, that needs mending.  mod_perl-2.0 will either
have it's own version of Exporter written in C (which is experimental in
1.x) or will not export anything.  i haven't decided which yet, but i have
decided that the standard Exporter.pm will not be used.
 
> The issue of compile and execution times is a red herring.

says who?

> If you care that much about CPU cycles you'll at least get out
> Kernighan & Ritchie.

really?  does that explain how Perl is implemented internally and what i
can do to squeeze the best performance out of Perl?
 
> One of the most frequent causes of software failures is fiddling about
> with the code to make it prettier or to satisfy some other lust.  If
> it works and has been tested by thousands of people, please leave it
> alone unless you have a *very* good reason to brea^H^H^H^H touch it:)

this has nothing to do with being pretty or satisfying lust.
modperl-2.0 is a complete re-write, it's only been tested by me so far.
regardless, using 'constant string' instead of "constant string" isn't
going to break anything.




Re: cvs commit: modperl-2.0/lib/ModPerl Code.pm

2000-04-14 Thread G.W. Haywood

Hi All,

> On Fri, 14 Apr 2000, Stas Bekman wrote:
>
> > > It seems that TIMTOWTDI is going to die soon as everybody tells
> > > me that I should code as shown in "OO Perl" and ""Algorithms
> > > with Perl" :(
> 
> On Fri, 14 Apr 2000, Doug MacEachern wrote:
> 
> > i'm using '' vs. "" because '' is faster for Perl to parse and
> > faster for me to parse.

I don't want to get involved in an unproductive semi-religious war or
anything, but I'd just like to caution against change for (what seems
little more than) the sake of change.

I think it was our Lord Chancellor in about 1980 who said:

"If a thing ain't broke, don't mend it".

Never was this advice more valuable than when given to software
hackers.  The issue of compile and execution times is a red herring.
If you care that much about CPU cycles you'll at least get out
Kernighan & Ritchie.

One of the most frequent causes of software failures is fiddling about
with the code to make it prettier or to satisfy some other lust.  If
it works and has been tested by thousands of people, please leave it
alone unless you have a *very* good reason to brea^H^H^H^H touch it:)

73,
A. User.




Re: cvs commit: modperl-2.0/lib/ModPerl Code.pm

2000-04-14 Thread Stas Bekman

On Fri, 14 Apr 2000, Doug MacEachern wrote:

> > > Orwant and friends in "Algorithms with Perl" page 28 claims the first form
> > > is slower.
> 
> faster to *parse*, not faster to *run*.  stas, your benchmarks don't test
> parse time.
>  
> > It seems that TIMTOWTDI is going to die soon as everybody tells me that I
> > should code as shown in "OO Perl" and ""Algorithms with Perl" :( 
> > 
> > The books are cool, but why turning them into bibles? The book authors are
> > great, but why rising them into gods? 
> 
> bibles?  gods?  i haven't touched either of these books.  i'm using '' vs.
> "" because '' is faster for Perl to parse and faster for me to parse.
> i'm thinking about string usage more, rather than just slinging them
> around without a care.  i'm trying to avoid interpolation, which turns
> into concatination, which uses more memory and is slower than using a
> list.  if i see a '' string, i don't worry, if i see "", i want to look
> close and thing about how expensive it will turn out to be.
> 
> there will be exceptions, like "\n", ' define' vs "\ndefine", i do prefer
> the later for readability.  in fact, there's plenty of interpolation
> happening in those modules, i very much value readability, and the 
> "\n", ' define' did make me cringe a bit.  and i will probably change that
> one back.
> 
> and, your benchmark of those shows "\ndefine" to be faster, because
> the string being copied is so tiny, it's less expensive than pushing an
> extra item onto the stack.  when generating webpages, we generally don't
> deal with such tiny strings, do we?
> 
> use Benchmark;
> 
> open my $fh, '>', '/dev/null';
> 
> my($one, $two, $three, $four) = map { $_ x 1000 } 'a'..'d';
> 
> timethese(300_000, {
>  concat => sub {
>  print $fh "$one$two$three$four";
>  },
>  list => sub {
>  print $fh $one, $two, $three, $four;
>  },
> });
> 
> Benchmark: timing 30 iterations of concat, list...
> concat: 12 wallclock secs (10.83 usr +  0.67 sys = 11.50 CPU) @
> 26086.96/s (n=30)
>   list:  9 wallclock secs ( 6.75 usr +  0.59 sys =  7.34 CPU) @
> 40871.93/s (n=30)

Doug, you are my man :) That's the explanation I was looking for! Thanks a
lot!

P.S. I'm sending a few more benchmarks to the list now :) Apache::Request
rules!!!

__
Stas Bekman | JAm_pH--Just Another mod_perl Hacker
http://stason.org/  | mod_perl Guide  http://perl.apache.org/guide 
mailto:[EMAIL PROTECTED]  | http://perl.orghttp://stason.org/TULARC/
http://singlesheaven.com| http://perlmonth.com http://sourcegarden.org
--




Re: cvs commit: modperl-2.0/lib/ModPerl Code.pm

2000-04-14 Thread Doug MacEachern

> > Orwant and friends in "Algorithms with Perl" page 28 claims the first form
> > is slower.

faster to *parse*, not faster to *run*.  stas, your benchmarks don't test
parse time.
 
> It seems that TIMTOWTDI is going to die soon as everybody tells me that I
> should code as shown in "OO Perl" and ""Algorithms with Perl" :( 
> 
> The books are cool, but why turning them into bibles? The book authors are
> great, but why rising them into gods? 

bibles?  gods?  i haven't touched either of these books.  i'm using '' vs.
"" because '' is faster for Perl to parse and faster for me to parse.
i'm thinking about string usage more, rather than just slinging them
around without a care.  i'm trying to avoid interpolation, which turns
into concatination, which uses more memory and is slower than using a
list.  if i see a '' string, i don't worry, if i see "", i want to look
close and thing about how expensive it will turn out to be.

there will be exceptions, like "\n", ' define' vs "\ndefine", i do prefer
the later for readability.  in fact, there's plenty of interpolation
happening in those modules, i very much value readability, and the 
"\n", ' define' did make me cringe a bit.  and i will probably change that
one back.

and, your benchmark of those shows "\ndefine" to be faster, because
the string being copied is so tiny, it's less expensive than pushing an
extra item onto the stack.  when generating webpages, we generally don't
deal with such tiny strings, do we?

use Benchmark;

open my $fh, '>', '/dev/null';

my($one, $two, $three, $four) = map { $_ x 1000 } 'a'..'d';

timethese(300_000, {
 concat => sub {
 print $fh "$one$two$three$four";
 },
 list => sub {
 print $fh $one, $two, $three, $four;
 },
});

Benchmark: timing 30 iterations of concat, list...
concat: 12 wallclock secs (10.83 usr +  0.67 sys = 11.50 CPU) @
26086.96/s (n=30)
  list:  9 wallclock secs ( 6.75 usr +  0.59 sys =  7.34 CPU) @
40871.93/s (n=30)





Re: cvs commit: modperl-2.0/lib/ModPerl Code.pm

2000-04-14 Thread Stas Bekman

On Fri, 14 Apr 2000, Bill Moseley wrote:

> At 11:56 AM 04/14/00 +0300, Stas Bekman wrote:
> >>   sticking to the convention of single quoting constant strings
> >
> >Why? You lose the interpolation feature when you need it and you get to
> >the awkward statement like this:
> >
> >>   -print $h_fh "\n#define ",
> >>   +print $h_fh "\n", '#define ',
> 
> Orwant and friends in "Algorithms with Perl" page 28 claims the first form
> is slower.

% perl -v
This is perl, version 5.005_03 built for i386-linux

xxx:

   use Benchmark;

   timethese(50, {
   'My'   => sub {return "\n#define "},
   'Your' => sub {return "\n", '#define '},
   });

% perl xxx
Benchmark: timing 50 iterations of My, Your...
My:  7 wallclock secs ( 4.49 usr +  0.31 sys =  4.80 CPU)
  Your:  5 wallclock secs ( 4.40 usr +  0.34 sys =  4.74 CPU)

My:  5 wallclock secs ( 4.40 usr +  0.34 sys =  4.74 CPU)
  Your:  6 wallclock secs ( 4.90 usr +  0.32 sys =  5.22 CPU)

My:  7 wallclock secs ( 4.34 usr +  0.34 sys =  4.68 CPU)
  Your:  5 wallclock secs ( 4.55 usr +  0.32 sys =  4.87 CPU)


As you see not on my machine, unless print() behaves diffently... 
Apparently it's not: 

xxx1:
-
   use Benchmark;

   open STDERR , ">>/dev/null";
   timethese(50, {
   'My'   => sub {print STDERR "\n#define "},
   'Your' => sub {print STDERR "\n", '#define '},
   });


% perl xxx1
Benchmark: timing 50 iterations of My, Your...
My:  9 wallclock secs ( 7.56 usr +  0.54 sys =  8.10 CPU)
  Your: 13 wallclock secs ( 9.50 usr +  0.67 sys = 10.17 CPU)

My: 11 wallclock secs ( 7.74 usr +  0.56 sys =  8.30 CPU)
  Your: 13 wallclock secs ( 9.73 usr +  0.60 sys = 10.33 CPU)

25% slower!!!

It seems that TIMTOWTDI is going to die soon as everybody tells me that I
should code as shown in "OO Perl" and ""Algorithms with Perl" :( 

The books are cool, but why turning them into bibles? The book authors are
great, but why rising them into gods? 

Every time I should post a snippet of code I'm afraid to be flamed for
writing a *bad* code :( I guess you saw some examples at the fun-with-perl
mailing list. 

__
Stas Bekman | JAm_pH--Just Another mod_perl Hacker
http://stason.org/  | mod_perl Guide  http://perl.apache.org/guide 
mailto:[EMAIL PROTECTED]  | http://perl.orghttp://stason.org/TULARC/
http://singlesheaven.com| http://perlmonth.com http://sourcegarden.org
--




Re: cvs commit: modperl-2.0/lib/ModPerl Code.pm

2000-04-14 Thread Bill Moseley

At 11:56 AM 04/14/00 +0300, Stas Bekman wrote:
>>   sticking to the convention of single quoting constant strings
>
>Why? You lose the interpolation feature when you need it and you get to
>the awkward statement like this:
>
>>   -print $h_fh "\n#define ",
>>   +print $h_fh "\n", '#define ',

Orwant and friends in "Algorithms with Perl" page 28 claims the first form
is slower.


Bill Moseley
mailto:[EMAIL PROTECTED]



Re: cvs commit: modperl-2.0/lib/ModPerl Code.pm

2000-04-14 Thread Stas Bekman

On 14 Apr 2000 [EMAIL PROTECTED] wrote:

> dougm   00/04/13 21:09:26
> 
>   Modified:.Makefile.PL
>lib/Apache Build.pm
>lib/ModPerl Code.pm
>   Log:
>   sticking to the convention of single quoting constant strings

Why? You lose the interpolation feature when you need it and you get to
the awkward statement like this:

>   -print $h_fh "\n#define ",
>   +print $h_fh "\n", '#define ',
 ^


__
Stas Bekman | JAm_pH--Just Another mod_perl Hacker
http://stason.org/  | mod_perl Guide http://perl.apache.org/guide/ 
mailto:[EMAIL PROTECTED]  | http://perl.orghttp://stason.org/TULARC/
http://singlesheaven.com| http://perlmonth.com http://sourcegarden.org
--




cvs commit: modperl-2.0/lib/ModPerl Code.pm

2000-04-13 Thread dougm

dougm   00/04/13 21:09:26

  Modified:.Makefile.PL
   lib/Apache Build.pm
   lib/ModPerl Code.pm
  Log:
  sticking to the convention of single quoting constant strings
  
  Revision  ChangesPath
  1.2   +6 -6  modperl-2.0/Makefile.PL
  
  Index: Makefile.PL
  ===
  RCS file: /home/cvs/modperl-2.0/Makefile.PL,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Makefile.PL   2000/04/13 07:03:35 1.1
  +++ Makefile.PL   2000/04/14 04:09:25 1.2
  @@ -94,15 +94,15 @@
   }
   
   sub set_modperl_version {
  -require "./lib/mod_perl.pm";
  +require './lib/mod_perl.pm';
   
   $VERSION = $mod_perl::VERSION;
   $VERSION =~ s/(\d\d)(\d\d)$/$1_$2/;
   
  -open my $fh, "Changes";
  +open my $fh, 'Changes';
   while(<$fh>) {
if(/^=item.*-dev/) {
  - $VERSION .= "-dev";
  + $VERSION .= '-dev';
last;
}
last if /^=item/;
  @@ -112,7 +112,7 @@
   
   sub phat_warn {
   my($msg, $abort) = @_;
  -my $level = $abort ? "ERROR" : "WARNING";
  +my $level = $abort ? 'ERROR' : 'WARNING';
   warn [0]" :
  -"You might need to install Perl from source";
  +'You might need to install Perl from source';
   phat_warn(< $^O eq "MSWin32";
  +use constant is_win32 => $^O eq 'MSWin32';
   use constant IS_MOD_PERL_BUILD => grep { -e "$_/lib/mod_perl.pm" } qw(. ..);
   
   our $VERSION = '0.01';
  @@ -26,8 +26,8 @@
#these extra tries are for things built outside of mod_perl
#e.g. libapreq
push @trys,
  - which("apxs"),
  - "/usr/local/apache/bin/apxs";
  + which('apxs'),
  + '/usr/local/apache/bin/apxs';
   }
   
   for (@trys) {
  @@ -36,13 +36,13 @@
last if -x $apxs;
   }
   
  -return "" unless $apxs and -x $apxs;
  +return '' unless $apxs and -x $apxs;
   
   qx($apxs @_ 2>/dev/null);
   }
   
   sub apxs_cflags {
  -my $cflags = __PACKAGE__->apxs("-q" => 'CFLAGS');
  +my $cflags = __PACKAGE__->apxs('-q' => 'CFLAGS');
   $cflags =~ s/\"/\\\"/g;
   $cflags;
   }
  @@ -55,7 +55,7 @@
return $app if -x $app;
   }
   
  -return "";
  +return '';
   }
   
   #--- Perl Config stuff ---
  @@ -63,7 +63,7 @@
   sub perl_config {
   my($self, $key) = @_;
   
  -return $Config{$key} ? $Config{$key} : "";
  +return $Config{$key} ? $Config{$key} : '';
   }
   
   
  @@ -86,7 +86,7 @@
   sub find_dlfile {
   my($self, $name) = @_;
   
  -return "" unless $Config{'libs'} =~ /$name/;
  +return '' unless $Config{'libs'} =~ /$name/;
   
   require DynaLoader;
   require AutoLoader; #eek
  @@ -139,7 +139,7 @@
   
   sub build_config {
   my $self = shift;
  -unshift @INC, "lib";
  +unshift @INC, 'lib';
   eval { require Apache::BuildConfig; };
   shift @INC;
   return bless {}, (ref($self) || $self) if $@;
  @@ -260,7 +260,7 @@
$self->default_dir,
<../apache*/src>,
<../stronghold*/src>,
  - "../src", "./src")
  + '../src', './src')
 {
 next unless (-d $src_dir || -l $src_dir);
 next if $seen{$src_dir}++;
  @@ -282,7 +282,7 @@
   return $self->{ap_includedir} = "$d/include";
   }
   
  -$self->{ap_includedir} = Apache::Build->apxs("-q" => 'INCLUDEDIR');
  +$self->{ap_includedir} = Apache::Build->apxs('-q' => 'INCLUDEDIR');
   }
   
   #--- parsing apache *.h files ---
  @@ -334,7 +334,7 @@
   return 0 unless $fh;
   
   my $n;
  -my $mmn_pat = join "|", qw(MODULE_MAGIC_NUMBER_MAJOR MODULE_MAGIC_NUMBER);
  +my $mmn_pat = join '|', qw(MODULE_MAGIC_NUMBER_MAJOR MODULE_MAGIC_NUMBER);
   while(<$fh>) {
if(s/^\#define\s+($mmn_pat)\s+(\d+).*/$2/) {
   chomp($n = $_);
  @@ -349,7 +349,7 @@
   sub fold_dots {
   my $v = shift;
   $v =~ s/\.//g;
  -$v .= "0" if length $v < 3;
  +$v .= '0' if length $v < 3;
   $v;
   }
   
  @@ -361,7 +361,7 @@
   
   sub httpd_version_cache {
   my($self, $dir, $v) = @_;
  -return "" unless $dir;
  +return '' unless $dir;
   $self->{httpd_version}->{$dir} = $v if $v;
   $self->{httpd_version}->{$dir};
   }
  @@ -393,7 +393,7 @@
next unless ($fserver,$fversion,$frest) =
m,^([^/]+)/(\d\.\d+\.?\d*)([^ ]*),i;
   
  - if($fserver eq "Apache") {
  + if($fserver eq 'Apache') {
($server, $version) = ($fserver, $fversion);
#$frest =~ s/^(a|b)(\d+).*/'_' . (length($2) > 1 ? $2 : "0$2")/e;
$version .= $frest if $frest;
  @@ -411,11 +411,11 @@
   my $self = shift;
   my @ldfl