You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs-cvs@perl.apache.org by st...@apache.org on 2002/04/04 04:24:28 UTC
cvs commit: modperl-docs/src/docs/1.0/guide Changes.pod control.pod debug.pod performance.pod perl.pod porting.pod scenario.pod snippets.pod troubleshooting.pod
stas 02/04/03 18:24:28
Modified: src/docs/1.0/guide Changes.pod control.pod debug.pod
performance.pod perl.pod porting.pod scenario.pod
snippets.pod troubleshooting.pod
Log:
- untabify the guide
Revision Changes Path
1.6 +19 -19 modperl-docs/src/docs/1.0/guide/Changes.pod
Index: Changes.pod
===================================================================
RCS file: /home/cvs/modperl-docs/src/docs/1.0/guide/Changes.pod,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Changes.pod 3 Apr 2002 09:16:08 -0000 1.5
+++ Changes.pod 4 Apr 2002 02:24:27 -0000 1.6
@@ -1377,11 +1377,11 @@
* warnings.pod was renamed to troubleshooting.pod and now it's
categorized by the following sections:
- Building and Installation
+ Building and Installation
Configuration and Startup
Code Parsing and Compilation
Runtime
- Shutdown and Restart
+ Shutdown and Restart
* porting: the following sections were moved to debug.pod:
"Finding the Line Number the Error/Warning has been Triggered at",
@@ -1583,7 +1583,7 @@
* porting: Wrote a whole new section "Configuration Files: Writing,
Modifying and Reloading.", which consist of 3 big parts:
- Writing Configuration Files
+ Writing Configuration Files
Reloading Configuration Files
Dynamically updating configuration files
@@ -1714,18 +1714,18 @@
* A complete review, which included corrections, verifications,
extensions and clarifications was done to the following pods during
the preparation of the tutorial for the 3rd apache conference:
- start.pod
- intro.pod
- porting.pod
- performance.pod
- strategy.pod
- scenario.pod
- config.pod
- install.pod
- control.pod
- databases.pod
- multiuser.pod
- help.pod
+ start.pod
+ intro.pod
+ porting.pod
+ performance.pod
+ strategy.pod
+ scenario.pod
+ config.pod
+ install.pod
+ control.pod
+ databases.pod
+ multiuser.pod
+ help.pod
=head1 06.19.1999 ver 1.13
@@ -2020,9 +2020,9 @@
* new in scenario.pod: "mod_perl and proxy server"
- Incentives
+ Incentives
Squid proxy server in httpd accelerator mode
- Running a squid and 2 webservers scenario
+ Running a squid and 2 webservers scenario
Running a squid and 1 mod_perl apache server scenario
(Reviewed and modified according to notes by
@@ -2189,7 +2189,7 @@
performance.html#Limiting_the_request_rate_speed_
* modified: register_cleanup in Registry scripts (END{} blocks)
- based on the last week tread
+ based on the last week tread
* new: obvious.html#Handling_the_User_pressed_Stop_
@@ -2229,7 +2229,7 @@
MaxClients MaxRequestsPerChild (actually a pointer to the next item)
* new: performance:
- Tuning the Apache's configuration variables for the best performance
+ Tuning the Apache's configuration variables for the best performance
Tuning with ab - ApacheBench
Tuning with crashme script
Choosing MaxClients
1.8 +5 -5 modperl-docs/src/docs/1.0/guide/control.pod
Index: control.pod
===================================================================
RCS file: /home/cvs/modperl-docs/src/docs/1.0/guide/control.pod,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- control.pod 3 Apr 2002 09:16:08 -0000 1.7
+++ control.pod 4 Apr 2002 02:24:27 -0000 1.8
@@ -1163,11 +1163,11 @@
# paths and add the standard Perl libs
@INC =
qw(/usr/lib/perl5/5.00503/i386-linux
- /usr/lib/perl5/5.00503
- /usr/lib/perl5/site_perl/5.005/i386-linux
- /usr/lib/perl5/site_perl/5.005
- .
- );
+ /usr/lib/perl5/5.00503
+ /usr/lib/perl5/site_perl/5.005/i386-linux
+ /usr/lib/perl5/site_perl/5.005
+ .
+ );
}
use strict;
1.7 +9 -9 modperl-docs/src/docs/1.0/guide/debug.pod
Index: debug.pod
===================================================================
RCS file: /home/cvs/modperl-docs/src/docs/1.0/guide/debug.pod,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- debug.pod 3 Apr 2002 09:16:08 -0000 1.6
+++ debug.pod 4 Apr 2002 02:24:27 -0000 1.7
@@ -1608,7 +1608,7 @@
# there are 29 days in February in a leap year
$month_len[1] =
(($year % 4 or $year % 100 == 0) and $year % 400 )
- ? 28 : 29;
+ ? 28 : 29;
# set $day to be the last day of the previous month
$day = $month_len[$month - 1];
@@ -1668,7 +1668,7 @@
# there are 29 days in February in a leap year
$month_len[1] =
(($year % 4 or $year % 100 == 0) and $year % 400 )
- ? 28 : 29;
+ ? 28 : 29;
# set $day to be the last day of the previous month
$day = $month_len[$month - 1];
@@ -1730,9 +1730,9 @@
{
array => [qw(a b c d)],
hash => {
- foo => "oof",
- bar => "rab",
- },
+ foo => "oof",
+ bar => "rab",
+ },
};
How do we print it out? Very easily:
@@ -2717,10 +2717,10 @@
the original C<Apache::DB> cleanup code, as:
if (ref $r) {
- $SIG{INT} = \&DB::catch;
- $r->register_cleanup(sub {
- $SIG{INT} = \&DB::ApacheSIGINT();
- });
+ $SIG{INT} = \&DB::catch;
+ $r->register_cleanup(sub {
+ $SIG{INT} = \&DB::ApacheSIGINT();
+ });
}
Any Perl/Tk guru to assist???
1.8 +227 -227 modperl-docs/src/docs/1.0/guide/performance.pod
Index: performance.pod
===================================================================
RCS file: /home/cvs/modperl-docs/src/docs/1.0/guide/performance.pod,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- performance.pod 3 Apr 2002 09:16:08 -0000 1.7
+++ performance.pod 4 Apr 2002 02:24:27 -0000 1.8
@@ -1523,7 +1523,7 @@
use Apache::RegistryLoader ();
Apache::RegistryLoader->new->handler("/perl/test.pl",
- "/home/httpd/perl/test.pl");
+ "/home/httpd/perl/test.pl");
You should put this code either into C<E<lt>PerlE<gt>> sections or
into a startup script.
@@ -1554,7 +1554,7 @@
# preload $url
my $status = $rl->handler($url);
unless($status == 200) {
- warn "pre-load of `$url' failed, status=$status\n";
+ warn "pre-load of `$url' failed, status=$status\n";
}
},
$scripts_root_dir);
@@ -2784,31 +2784,31 @@
I will use the following abbreviations:
- NR = Total Number of Request
- NC = Concurrency
- MC = MaxClients
- MRPC = MaxRequestsPerChild
- RPS = Requests per second
+ NR = Total Number of Request
+ NC = Concurrency
+ MC = MaxClients
+ MRPC = MaxRequestsPerChild
+ RPS = Requests per second
Running a mod_perl script with lots of mysql queries (the script under
test is mysqld limited)
(http://www.example.com/perl/access/access.cgi?do_sub=query_form),
with the configuration:
- MinSpareServers 8
- MaxSpareServers 16
- StartServers 10
- MaxClients 50
+ MinSpareServers 8
+ MaxSpareServers 16
+ StartServers 10
+ MaxClients 50
MaxRequestsPerChild 5000
gives us:
- NR NC RPS comment
+ NR NC RPS comment
------------------------------------------------
- 10 10 3.33 # not a reliable figure
- 100 10 3.94
- 1000 10 4.62
- 1000 50 4.09
+ 10 10 3.33 # not a reliable figure
+ 100 10 3.94
+ 1000 10 4.62
+ 1000 50 4.09
B<Conclusions:> Here I wanted to show that when the application is
slow (not due to perl loading, code compilation and execution, but
@@ -2824,20 +2824,20 @@
(http://www.example.com/perl/access/access.cgi), it's the same
script but it just returns the HTML form, without making SQL queries.
- MinSpareServers 8
- MaxSpareServers 16
- StartServers 10
- MaxClients 50
+ MinSpareServers 8
+ MaxSpareServers 16
+ StartServers 10
+ MaxClients 50
MaxRequestsPerChild 5000
- NR NC RPS comment
+ NR NC RPS comment
------------------------------------------------
- 10 10 26.95 # not a reliable figure
- 100 10 30.88
- 1000 10 29.31
- 1000 50 28.01
- 1000 100 29.74
- 10000 200 24.92
+ 10 10 26.95 # not a reliable figure
+ 100 10 30.88
+ 1000 10 29.31
+ 1000 50 28.01
+ 1000 100 29.74
+ 10000 200 24.92
100000 400 24.95
B<Conclusions:> This time the script we executed was pure perl (not
@@ -2855,19 +2855,19 @@
C<MaxRequestsPerChild>, so that no child will be killed during the
benchmarking.
- MinSpareServers 50
- MaxSpareServers 50
- StartServers 50
- MaxClients 50
+ MinSpareServers 50
+ MaxSpareServers 50
+ StartServers 50
+ MaxClients 50
MaxRequestsPerChild 5000
- NR NC RPS comment
+ NR NC RPS comment
------------------------------------------------
- 100 10 32.05
- 1000 10 33.14
- 1000 50 33.17
- 1000 100 31.72
- 10000 200 31.60
+ 100 10 32.05
+ 1000 10 33.14
+ 1000 50 33.17
+ 1000 100 31.72
+ 10000 200 31.60
Conclusion: In this scenario there is no overhead involving the parent
server loading new children, all the servers are available, and the
@@ -2876,21 +2876,21 @@
Now we will change C<MaxClients> and watch the results: Let's reduce
C<MaxClients> to 10.
- MinSpareServers 8
- MaxSpareServers 10
- StartServers 10
- MaxClients 10
+ MinSpareServers 8
+ MaxSpareServers 10
+ StartServers 10
+ MaxClients 10
MaxRequestsPerChild 5000
- NR NC RPS comment
+ NR NC RPS comment
------------------------------------------------
- 10 10 23.87 # not a reliable figure
- 100 10 32.64
- 1000 10 32.82
- 1000 50 30.43
- 1000 100 25.68
- 1000 500 26.95
- 2000 500 32.53
+ 10 10 23.87 # not a reliable figure
+ 100 10 32.64
+ 1000 10 32.82
+ 1000 50 30.43
+ 1000 100 25.68
+ 1000 500 26.95
+ 2000 500 32.53
B<Conclusions:> Very little difference! Ten servers were able to
serve almost with the same throughput as 50 servers. Why? My guess
@@ -2902,35 +2902,35 @@
Now we will start drastically to reduce C<MaxRequestsPerChild>:
- MinSpareServers 8
- MaxSpareServers 16
- StartServers 10
- MaxClients 50
+ MinSpareServers 8
+ MaxSpareServers 16
+ StartServers 10
+ MaxClients 50
- NR NC MRPC RPS comment
+ NR NC MRPC RPS comment
------------------------------------------------
- 100 10 10 5.77
- 100 10 5 3.32
- 1000 50 20 8.92
- 1000 50 10 5.47
- 1000 50 5 2.83
- 1000 100 10 6.51
+ 100 10 10 5.77
+ 100 10 5 3.32
+ 1000 50 20 8.92
+ 1000 50 10 5.47
+ 1000 50 5 2.83
+ 1000 100 10 6.51
B<Conclusions:> When we drastically reduce C<MaxRequestsPerChild>, the
performance starts to become closer to plain mod_cgi.
Here are the numbers of this run with mod_cgi, for comparison:
- MinSpareServers 8
- MaxSpareServers 16
- StartServers 10
- MaxClients 50
+ MinSpareServers 8
+ MaxSpareServers 16
+ StartServers 10
+ MaxClients 50
- NR NC RPS comment
+ NR NC RPS comment
------------------------------------------------
- 100 10 1.12
- 1000 50 1.14
- 1000 100 1.13
+ 100 10 1.12
+ 1000 50 1.14
+ 1000 100 1.13
B<Conclusion>: mod_cgi is much slower. :) In the first test, when
NR/NC was 100/10, mod_cgi was capable of 1.12 requests per second. In
@@ -3099,22 +3099,22 @@
Let's try some numbers. For a heavily loaded web site and a dedicated
machine I would think of (note 400Mb is just for example):
- Available to webserver RAM: 400Mb
+ Available to webserver RAM: 400Mb
Child's memory size bounded: 10Mb
- MaxClients: 400/10 = 40 (larger with mem sharing)
- StartServers: 20
- MinSpareServers: 20
- MaxSpareServers: 35
+ MaxClients: 400/10 = 40 (larger with mem sharing)
+ StartServers: 20
+ MinSpareServers: 20
+ MaxSpareServers: 35
However if I want to use the server for many other tasks, but make it
capable of handling a high load, I'd think of:
- Available to webserver RAM: 400Mb
+ Available to webserver RAM: 400Mb
Child's memory size bounded: 10Mb
- MaxClients: 400/10 = 40
- StartServers: 5
- MinSpareServers: 5
- MaxSpareServers: 10
+ MaxClients: 400/10 = 40
+ StartServers: 5
+ MinSpareServers: 5
+ MaxSpareServers: 10
These numbers are taken off the top of my head, and shouldn't be used
as a rule, but rather as examples to show you some possible scenarios.
@@ -3458,23 +3458,23 @@
This is a typical generated trace.
stat("/home/httpd/docs/foo/test", 0xbffff8fc) = -1 ENOENT
- (No such file or directory)
+ (No such file or directory)
stat("/home/httpd/docs/foo", 0xbffff8fc) = -1 ENOENT
- (No such file or directory)
+ (No such file or directory)
stat("/home/httpd/docs",
- {st_mode=S_IFDIR|0755, st_size=1024, ...}) = 0
+ {st_mode=S_IFDIR|0755, st_size=1024, ...}) = 0
open("/.htaccess", O_RDONLY) = -1 ENOENT
- (No such file or directory)
+ (No such file or directory)
open("/home/.htaccess", O_RDONLY) = -1 ENOENT
- (No such file or directory)
+ (No such file or directory)
open("/home/httpd/.htaccess", O_RDONLY) = -1 ENOENT
- (No such file or directory)
+ (No such file or directory)
open("/home/httpd/docs/.htaccess", O_RDONLY) = -1 ENOENT
- (No such file or directory)
+ (No such file or directory)
stat("/home/httpd/docs/test", 0xbffff774) = -1 ENOENT
- (No such file or directory)
+ (No such file or directory)
stat("/home/httpd/docs",
- {st_mode=S_IFDIR|0755, st_size=1024, ...}) = 0
+ {st_mode=S_IFDIR|0755, st_size=1024, ...}) = 0
Now we modify the C<E<lt>DirectoryE<gt>> entry and add S<AllowOverride None>,
which among other things disables I<.htaccess> files and will not try
@@ -3487,15 +3487,15 @@
We see that the four open() calls for I<.htaccess> have gone.
stat("/home/httpd/docs/foo/test", 0xbffff8fc) = -1 ENOENT
- (No such file or directory)
+ (No such file or directory)
stat("/home/httpd/docs/foo", 0xbffff8fc) = -1 ENOENT
- (No such file or directory)
+ (No such file or directory)
stat("/home/httpd/docs",
- {st_mode=S_IFDIR|0755, st_size=1024, ...}) = 0
+ {st_mode=S_IFDIR|0755, st_size=1024, ...}) = 0
stat("/home/httpd/docs/test", 0xbffff774) = -1 ENOENT
- (No such file or directory)
+ (No such file or directory)
stat("/home/httpd/docs",
- {st_mode=S_IFDIR|0755, st_size=1024, ...}) = 0
+ {st_mode=S_IFDIR|0755, st_size=1024, ...}) = 0
Let's try to shortcut the I<foo> location with:
@@ -3989,15 +3989,15 @@
Apache::RegistryLoader->new->handler(
"/perl/processing_with_cgi_pm.pl",
"[ROOT_DIR]/httpd/perl/processing_with_cgi_pm.pl"
- );
+ );
Apache::RegistryLoader->new->handler(
"/perl/processing_with_apache_request.pl",
"[ROOT_DIR]/httpd/perl/processing_with_apache_request.pl"
- );
+ );
Apache::RegistryLoader->new->handler(
"/perl/processing_with_apache_args.pl",
"[ROOT_DIR]/httpd/perl/processing_with_apache_args.pl"
- );
+ );
</Perl>
And the results:
@@ -4772,7 +4772,7 @@
$sth->execute;
while(@row_ary = $sth->fetchrow_array) {
- # do DB accumulation into some variable
+ # do DB accumulation into some variable
}
# print the output using the data returned from the DB
@@ -4866,7 +4866,7 @@
print "SQL: $do_sql \n" if $debug;
- $dbh->{RaiseError} = 1; # do this, or check every call for errors
+ $dbh->{RaiseError} = 1; # do this, or check every call for errors
$sth = $dbh->prepare($do_sql);
$sth->execute;
# Bind perl variables to columns.
@@ -4905,32 +4905,32 @@
sub {
# Header
- if (@_ and !$header){
- print "<TABLE>\n";
- print $q->Tr(map{ $q->td($_) } @fields );
- $header = 1;
- }
-
- # Body
- if (@_) {
- print $q->Tr(map{$q->td($_)} @_ );
- $counter++;
- return;
- }
-
+ if (@_ and !$header){
+ print "<TABLE>\n";
+ print $q->Tr(map{ $q->td($_) } @fields );
+ $header = 1;
+ }
+
+ # Body
+ if (@_) {
+ print $q->Tr(map{$q->td($_)} @_ );
+ $counter++;
+ return;
+ }
+
# Tail, will be printed only at the end
- if ($header and !($tail or @_)){
- print "</TABLE>\n $counter records found";
- $tail = 1;
- return;
- }
-
+ if ($header and !($tail or @_)){
+ print "</TABLE>\n $counter records found";
+ $tail = 1;
+ return;
+ }
+
# No record found
- unless ($header){
- print $q->p($q->center($q->b("No record was found!\n")));
- }
+ unless ($header){
+ print $q->p($q->center($q->b("No record was found!\n")));
+ }
- } # end of sub {}
+ } # end of sub {}
}; # end of my $rsub = eval {
You might also want to check the section L<Preventing Your Processes
@@ -5437,14 +5437,14 @@
use Apache::DBI ();
Apache::DBI->connect_on_init("DBI:mysql:test",
- "login",
- "passwd",
- {
- RaiseError => 1,
- PrintError => 0,
- AutoCommit => 1,
- }
- );
+ "login",
+ "passwd",
+ {
+ RaiseError => 1,
+ PrintError => 0,
+ AutoCommit => 1,
+ }
+ );
This is a simple way to have Apache children establish connections on
server startup. This call should be in a startup file C<require()d>
@@ -5508,38 +5508,38 @@
# ...
my $dbh = DBI->connect('dbi:Oracle:host', 'user', 'pass')
- || die $DBI::errstr;
+ || die $DBI::errstr;
my $baz = $r->param('baz');
eval {
- my $sth = $dbh->prepare(qq{
- SELECT foo
- FROM bar
- WHERE baz = $baz
- });
- $sth->execute;
-
- while (my @row = $sth->fetchrow_array) {
- # do HTML stuff
- }
-
- $sth->finish;
-
- my $sph = $dbh->prepare(qq{
- BEGIN
- my_procedure(
- arg_in => $baz
- );
- END;
- });
- $sph->execute;
- $sph->finish;
-
- $dbh->commit;
+ my $sth = $dbh->prepare(qq{
+ SELECT foo
+ FROM bar
+ WHERE baz = $baz
+ });
+ $sth->execute;
+
+ while (my @row = $sth->fetchrow_array) {
+ # do HTML stuff
+ }
+
+ $sth->finish;
+
+ my $sph = $dbh->prepare(qq{
+ BEGIN
+ my_procedure(
+ arg_in => $baz
+ );
+ END;
+ });
+ $sph->execute;
+ $sph->finish;
+
+ $dbh->commit;
};
if ($@) {
- $dbh->rollback;
+ $dbh->rollback;
}
$dbh->disconnect;
@@ -5631,40 +5631,40 @@
# ...
my $dbh = DBI->connect('dbi:Oracle:host', 'user', 'pass')
- || die $DBI::errstr;
+ || die $DBI::errstr;
my $baz = $r->param('baz');
eval {
- my $sth = $dbh->prepare(qq{
- SELECT foo
- FROM bar
- WHERE baz = :baz
- });
- $sth->bind_param(':baz', $baz);
- $sth->execute;
-
- while (my @row = $sth->fetchrow_array) {
- # do HTML stuff
- }
-
- $sth->finish;
-
- my $sph = $dbh->prepare(qq{
- BEGIN
- my_procedure(
- arg_in => :baz
- );
- END;
- });
- $sph->bind_param(':baz', $baz);
- $sph->execute;
- $sph->finish;
-
- $dbh->commit;
+ my $sth = $dbh->prepare(qq{
+ SELECT foo
+ FROM bar
+ WHERE baz = :baz
+ });
+ $sth->bind_param(':baz', $baz);
+ $sth->execute;
+
+ while (my @row = $sth->fetchrow_array) {
+ # do HTML stuff
+ }
+
+ $sth->finish;
+
+ my $sph = $dbh->prepare(qq{
+ BEGIN
+ my_procedure(
+ arg_in => :baz
+ );
+ END;
+ });
+ $sph->bind_param(':baz', $baz);
+ $sph->execute;
+ $sph->finish;
+
+ $dbh->commit;
};
if ($@) {
- $dbh->rollback;
+ $dbh->rollback;
}
# ...
@@ -5710,38 +5710,38 @@
use DBI ();
sub connect {
- if (defined $My::DB::conn) {
- eval {
- $My::DB::conn->ping;
- };
- if (!$@) {
- return $My::DB::conn;
- }
- }
-
- $My::DB::conn = DBI->connect(
- 'dbi:Oracle:server', 'user', 'pass', {
- PrintError => 1,
- RaiseError => 1,
- AutoCommit => 0
- }
- ) || die $DBI::errstr; #Assume application handles this
-
- $My::DB::select = $My::DB::conn->prepare(q{
- SELECT foo
- FROM bar
- WHERE baz = :baz
- });
-
- $My::DB::procedure = $My::DB::conn->prepare(q{
- BEGIN
- my_procedure(
- arg_in => :baz
- );
- END;
- });
+ if (defined $My::DB::conn) {
+ eval {
+ $My::DB::conn->ping;
+ };
+ if (!$@) {
+ return $My::DB::conn;
+ }
+ }
- return $My::DB::conn;
+ $My::DB::conn = DBI->connect(
+ 'dbi:Oracle:server', 'user', 'pass', {
+ PrintError => 1,
+ RaiseError => 1,
+ AutoCommit => 0
+ }
+ ) || die $DBI::errstr; #Assume application handles this
+
+ $My::DB::select = $My::DB::conn->prepare(q{
+ SELECT foo
+ FROM bar
+ WHERE baz = :baz
+ });
+
+ $My::DB::procedure = $My::DB::conn->prepare(q{
+ BEGIN
+ my_procedure(
+ arg_in => :baz
+ );
+ END;
+ });
+
+ return $My::DB::conn;
}
1;
@@ -5754,22 +5754,22 @@
my $baz = $r->param('baz');
eval {
- my $sth = $My::DB::select;
- $sth->bind_param(':baz', $baz);
- $sth->execute;
-
- while (my @row = $sth->fetchrow_array) {
- # do HTML stuff
- }
-
- my $sph = $My::DB::procedure;
- $sph->bind_param(':baz', $baz);
- $sph->execute;
-
- $dbh->commit;
+ my $sth = $My::DB::select;
+ $sth->bind_param(':baz', $baz);
+ $sth->execute;
+
+ while (my @row = $sth->fetchrow_array) {
+ # do HTML stuff
+ }
+
+ my $sph = $My::DB::procedure;
+ $sph->bind_param(':baz', $baz);
+ $sph->execute;
+
+ $dbh->commit;
};
if ($@) {
- $dbh->rollback;
+ $dbh->rollback;
}
# ...
1.5 +20 -20 modperl-docs/src/docs/1.0/guide/perl.pod
Index: perl.pod
===================================================================
RCS file: /home/cvs/modperl-docs/src/docs/1.0/guide/perl.pod,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- perl.pod 3 Apr 2002 09:16:08 -0000 1.4
+++ perl.pod 4 Apr 2002 02:24:28 -0000 1.5
@@ -577,18 +577,18 @@
which generates:
anon normal:
- CODE(0x80568e4)
- CODE(0x80568e4)
- CODE(0x80568e4)
- CODE(0x80568e4)
- CODE(0x80568e4)
+ CODE(0x80568e4)
+ CODE(0x80568e4)
+ CODE(0x80568e4)
+ CODE(0x80568e4)
+ CODE(0x80568e4)
anon closure:
- CODE(0x804b4c0)
- CODE(0x8056b54)
- CODE(0x8056bb4)
- CODE(0x80594d8)
- CODE(0x8059538)
+ CODE(0x804b4c0)
+ CODE(0x8056b54)
+ CODE(0x8056bb4)
+ CODE(0x80594d8)
+ CODE(0x8059538)
Note how each code reference from the non-closure is identical, but
the closure form must generate distinct coderefs to point at the
@@ -613,18 +613,18 @@
which generates:
anon normal:
- CODE(0x80568c0)
- CODE(0x80568c0)
- CODE(0x80568c0)
- CODE(0x80568c0)
- CODE(0x80568c0)
+ CODE(0x80568c0)
+ CODE(0x80568c0)
+ CODE(0x80568c0)
+ CODE(0x80568c0)
+ CODE(0x80568c0)
anon closure:
- CODE(0x8056998)
- CODE(0x8056998)
- CODE(0x8056998)
- CODE(0x8056998)
- CODE(0x8056998)
+ CODE(0x8056998)
+ CODE(0x8056998)
+ CODE(0x8056998)
+ CODE(0x8056998)
+ CODE(0x8056998)
We can see that both versions has generated the same code
reference. For the subroutine I<a> it's easy, since it doesn't include
1.5 +83 -85 modperl-docs/src/docs/1.0/guide/porting.pod
Index: porting.pod
===================================================================
RCS file: /home/cvs/modperl-docs/src/docs/1.0/guide/porting.pod,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- porting.pod 20 Mar 2002 17:43:04 -0000 1.4
+++ porting.pod 4 Apr 2002 02:24:28 -0000 1.5
@@ -409,7 +409,7 @@
sub authenticate{
my ($username,$passwd) = @_;
- # some checking
+ # some checking
$authenticated = 1 if SOME_USER_PASSWD_CHECK_IS_OK;
}
@@ -438,7 +438,7 @@
sub authenticate{
my ($username,$passwd) = @_;
- # some checking
+ # some checking
return (SOME_USER_PASSWD_CHECK_IS_OK) ? 1 : 0;
}
@@ -935,23 +935,22 @@
use vars qw(%c);
- %c =
- (
+ %c = (
dir => {
- cgi => "/home/httpd/perl",
- docs => "/home/httpd/docs",
- img => "/home/httpd/docs/images",
- },
+ cgi => "/home/httpd/perl",
+ docs => "/home/httpd/docs",
+ img => "/home/httpd/docs/images",
+ },
url => {
- cgi => "/perl",
- docs => "/",
- img => "/images",
- },
+ cgi => "/perl",
+ docs => "/",
+ img => "/images",
+ },
color => {
- hint => "#777777",
- warn => "#990066",
- normal => "#000000",
- },
+ hint => "#777777",
+ warn => "#990066",
+ normal => "#000000",
+ },
);
Good perl style suggests keeping a comma at the end of lists. That's
@@ -989,23 +988,22 @@
use strict;
use vars qw(%c);
- %c =
- (
+ %c = (
dir => {
- cgi => "/home/httpd/perl",
- docs => "/home/httpd/docs",
- img => "/home/httpd/docs/images",
- },
+ cgi => "/home/httpd/perl",
+ docs => "/home/httpd/docs",
+ img => "/home/httpd/docs/images",
+ },
url => {
- cgi => "/perl",
- docs => "/",
- img => "/images",
- },
+ cgi => "/perl",
+ docs => "/",
+ img => "/images",
+ },
color => {
- hint => "#777777",
- warn => "#990066",
- normal => "#000000",
- },
+ hint => "#777777",
+ warn => "#990066",
+ normal => "#000000",
+ },
);
And the code:
@@ -1053,10 +1051,10 @@
(
base => "/home/httpd",
dir => {
- cgi => "$c{base}/perl",
- docs => "$c{base}/docs",
- img => "$c{base}{docs}/images",
- },
+ cgi => "$c{base}/perl",
+ docs => "$c{base}/docs",
+ img => "$c{base}{docs}/images",
+ },
);
But nothing stops us from adding additional variables, which are
@@ -1066,10 +1064,10 @@
%c =
(
dir => {
- cgi => "$base/perl",
- docs => "$base/docs",
- img => "$base/docs/images",
- },
+ cgi => "$base/perl",
+ docs => "$base/docs",
+ img => "$base/docs/images",
+ },
);
You have just learned how to make configuration files easily
@@ -1423,12 +1421,12 @@
# print warnings if there are any invalid changes
print $q->hr,
$q->p($q->b(qq{Warning! These variables were changed
- but found malformed, thus the original
- values will be preserved.})
- ),
+ but found malformed, thus the original
+ values will be preserved.})
+ ),
join(",<BR>",
- map { $q->b($vars_to_change{$_}) . " : $malformatted{$_}\n"
- } keys %malformatted)
+ map { $q->b($vars_to_change{$_}) . " : $malformatted{$_}\n"
+ } keys %malformatted)
if %malformatted;
# Now complete the vars that weren't changed from the
@@ -1442,8 +1440,8 @@
# escape single quotes "'" while creating a file
my $content = join "\n",
map { $updates{$_} =~ s/(['\\])/\\$1/g;
- '$c{' . $_ . "} = '" . $updates{$_} . "';\n"
- } keys %updates;
+ '$c{' . $_ . "} = '" . $updates{$_} . "';\n"
+ } keys %updates;
# now add '1;' to make require() happy
$content .= "\n1;";
@@ -1452,7 +1450,7 @@
eval {my $res = $content};
if ($@) {
print qq{Warning! Something went wrong with config file
- generation!<P> The error was : <BR><PRE>$@</PRE>};
+ generation!<P> The error was : <BR><PRE>$@</PRE>};
return;
}
@@ -1464,7 +1462,7 @@
open $fh, ">$dynamic_config_file.bak"
or die "Can't open $dynamic_config_file.bak for writing :$! \n";
flock $fh,2; # exclusive lock
- seek $fh,0,0; # rewind to the start
+ seek $fh,0,0; # rewind to the start
truncate $fh, 0; # the file might shrink!
print $fh $content;
close $fh;
@@ -1491,8 +1489,8 @@
print $q->hr,
$q->p(qq{This form allows you to dynamically update the current
- configuration. You don\'t need to restart the server in
- order for changes to take an effect}
+ configuration. You don\'t need to restart the server in
+ order for changes to take an effect}
);
# set the previous settings in the form's hidden fields, so we
@@ -1506,45 +1504,45 @@
push @configs,
map {
$q->td(
- $q->b("$vars_to_change{$_}:"),
- ),
+ $q->b("$vars_to_change{$_}:"),
+ ),
$q->td(
- $q->textfield(-name => $_,
- -default => $c{$_},
- -override => 1,
- -size => 20,
- -maxlength => 50,
- )
- ),
- } qw(name release);
+ $q->textfield(-name => $_,
+ -default => $c{$_},
+ -override => 1,
+ -size => 20,
+ -maxlength => 50,
+ )
+ ),
+ } qw(name release);
# prepare multiline textarea entries
push @configs,
map {
$q->td(
- $q->b("$vars_to_change{$_}:"),
- ),
+ $q->b("$vars_to_change{$_}:"),
+ ),
$q->td(
- $q->textarea(-name => $_,
- -default => $c{$_},
- -override => 1,
- -rows => 10,
- -columns => 50,
- -wrap => "HARD",
- )
- ),
- } qw(comments);
+ $q->textarea(-name => $_,
+ -default => $c{$_},
+ -override => 1,
+ -rows => 10,
+ -columns => 50,
+ -wrap => "HARD",
+ )
+ ),
+ } qw(comments);
print $q->startform('POST',$q->url),"\n",
- $q->center($q->table(map {$q->Tr($_),"\n",} @configs),
- $q->submit('','Update!'),"\n",
- ),
- map ({$q->hidden("prev_".$_, $q->param("prev_".$_))."\n" }
- keys %vars_to_change), # hidden previous values
- $q->br,"\n",
- $q->endform,"\n",
- $q->hr,"\n",
- $q->end_html;
+ $q->center($q->table(map {$q->Tr($_),"\n",} @configs),
+ $q->submit('','Update!'),"\n",
+ ),
+ map ({$q->hidden("prev_".$_, $q->param("prev_".$_))."\n" }
+ keys %vars_to_change), # hidden previous values
+ $q->br,"\n",
+ $q->endform,"\n",
+ $q->hr,"\n",
+ $q->end_html;
} # end sub conf_modification_form
@@ -3198,9 +3196,9 @@
# change status form
my $button_label = $status ? "Stop" : "Start";
print qq{<HR>
- <FORM>
- <INPUT TYPE=SUBMIT NAME=switch VALUE=" $button_label ">
- </FORM>
+ <FORM>
+ <INPUT TYPE=SUBMIT NAME=switch VALUE=" $button_label ">
+ </FORM>
};
print qq{</BODY></HTML>};
@@ -3528,9 +3526,9 @@
# change status form
my $button_label = $status ? "Stop" : "Start";
print qq{<HR>
- <FORM>
- <INPUT TYPE=SUBMIT NAME=switch VALUE=" $button_label ">
- </FORM>
+ <FORM>
+ <INPUT TYPE=SUBMIT NAME=switch VALUE=" $button_label ">
+ </FORM>
};
print qq{</BODY></HTML>};
1.7 +4 -4 modperl-docs/src/docs/1.0/guide/scenario.pod
Index: scenario.pod
===================================================================
RCS file: /home/cvs/modperl-docs/src/docs/1.0/guide/scenario.pod,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- scenario.pod 3 Apr 2002 09:16:08 -0000 1.6
+++ scenario.pod 4 Apr 2002 02:24:28 -0000 1.7
@@ -405,14 +405,14 @@
% /usr/bin/perl Makefile.PL \
APACHE_SRC=../apache_x.x.x/src \
- DO_HTTPD=1 USE_APACI=1 EVERYTHING=1 \
+ DO_HTTPD=1 USE_APACI=1 EVERYTHING=1 \
APACHE_PREFIX=/usr/local/httpd_perl \
- APACI_ARGS='--prefix=/usr/local/httpd_perl'
+ APACI_ARGS='--prefix=/usr/local/httpd_perl'
If you need to pass any other configuration options to Apache's
C<configure>, add them after the I<--prefix> option. e.g:
- APACI_ARGS='--prefix=/usr/local/httpd_perl \
+ APACI_ARGS='--prefix=/usr/local/httpd_perl \
--enable-module=status'
Notice that B<all> C<APACI_ARGS> (above) must be passed as one long
@@ -1431,7 +1431,7 @@
Listen 4077
<VirtualHost localhost:4077>
ServerName www.example.com
- DocumentRoot /home/httpd/docs/www.example.com
+ DocumentRoot /home/httpd/docs/www.example.com
DirectoryIndex index.shtml index.html
</VirtualHost>
1.7 +30 -30 modperl-docs/src/docs/1.0/guide/snippets.pod
Index: snippets.pod
===================================================================
RCS file: /home/cvs/modperl-docs/src/docs/1.0/guide/snippets.pod,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- snippets.pod 3 Apr 2002 09:16:08 -0000 1.6
+++ snippets.pod 4 Apr 2002 02:24:28 -0000 1.7
@@ -97,7 +97,7 @@
my $why = shift;
chomp $why;
- my $orig_why = $why; # an ASCII copy for email report
+ my $orig_why = $why; # an ASCII copy for email report
# handle the shell execution case (so we will not get all the HTML)
print("Error: $why\n"), exit unless $ENV{MOD_PERL};
@@ -113,41 +113,41 @@
if ($orig_why =~ /Client attempted to POST (\d+) bytes/o) {
$message = qq{
- You cannot POST messages bigger than
- @{[1024*$max_image_size]} bytes.<BR>
- You have tried to post $1 bytes<BR>
- If you are trying to upload an image, make sure its
- size is no bigger than @{[1024*$max_image_size]}
- bytes.<P>
- Thank you!
- };
+ You cannot POST messages bigger than
+ @{[1024*$max_image_size]} bytes.<BR>
+ You have tried to post $1 bytes<BR>
+ If you are trying to upload an image, make sure its
+ size is no bigger than @{[1024*$max_image_size]}
+ bytes.<P>
+ Thank you!
+ };
} elsif ($orig_why =~ /Malformed multipart POST/o) {
$message = qq{
- Have you tried to upload an image in the wrong way?<P>
- To successfully upload an image you must use a browser that supports
- image upload and use the 'Browse' button to select that image.
- DO NOT type the path to the image into the upload field.<P>
- Thank you!
- };
+ Have you tried to upload an image in the wrong way?<P>
+ To successfully upload an image you must use a browser that supports
+ image upload and use the 'Browse' button to select that image.
+ DO NOT type the path to the image into the upload field.<P>
+ Thank you!
+ };
} elsif ($orig_why =~ /closed socket during multipart read/o) {
$message = qq{
- Have you pressed a 'STOP' button?<BR>
- Please try again!<P>
- Thank you!
- };
+ Have you pressed a 'STOP' button?<BR>
+ Please try again!<P>
+ Thank you!
+ };
} else {
$message = qq{
- <B>You need take no action since
- the error report has already been
- sent to the webmaster. <BR><P>
- <B>Thank you for your patience!</B>
- };
+ <B>You need take no action since
+ the error report has already been
+ sent to the webmaster. <BR><P>
+ <B>Thank you for your patience!</B>
+ };
$should_email = 1;
}
@@ -158,7 +158,7 @@
<HTML><BODY BGCOLOR="white">
<B>Oops, Something went wrong.</B><P>
$message
- </BODY></HTML>};
+ </BODY></HTML>};
# send email report if appropriate
if ($should_email){
@@ -183,7 +183,7 @@
print STDERR "[".scalar localtime()."] [SIGDIE] $orig_why \n";
exit 1;
- } # end of sub mydie
+ } # end of sub mydie
You may have noticed that I trap the CGI.pm's die() calls here, I
@@ -760,10 +760,10 @@
# init the server
my $smtp = Net::SMTP->new(
- # $smtp_server,
- Timeout => 60,
- Debug => 0,
- );
+ # $smtp_server,
+ Timeout => 60,
+ Debug => 0,
+ );
$smtp->mail($from) or carp ("Failed to specify a sender [$from]\n");
$smtp->to($to) or carp ("Failed to specify a recipient [$to]\n");
1.7 +3 -3 modperl-docs/src/docs/1.0/guide/troubleshooting.pod
Index: troubleshooting.pod
===================================================================
RCS file: /home/cvs/modperl-docs/src/docs/1.0/guide/troubleshooting.pod,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- troubleshooting.pod 3 Apr 2002 09:16:08 -0000 1.6
+++ troubleshooting.pod 4 Apr 2002 02:24:28 -0000 1.7
@@ -127,7 +127,7 @@
=head2 RegistryLoader: Translation of uri [...] to filename failed
RegistryLoader: Translation of uri [/home/httpd/perl/test.pl] to filename
- failed [tried: /home/httpd/docs/home/httpd/perl/test.pl]
+ failed [tried: /home/httpd/docs/home/httpd/perl/test.pl]
This error shows up when C<Apache::RegistryLoader> fails to translate
the URI into the corresponding filesystem path. Most failures happen
@@ -341,8 +341,8 @@
/usr/apps/lib/perl5/site_perl/5.005/aix/Apache/Registry.pm
line 168
Apache::Registry::compile('package
- Apache::ROOT::perl::tmp_2epl;use Apache qw(exit);sub han...')
- called at
+ Apache::ROOT::perl::tmp_2epl;use Apache qw(exit);sub han...')
+ called at
/usr/apps/lib/perl5/site_perl/5.005/aix/Apache/Registry.pm
line 121
Apache::Registry::handler('Apache=SCALAR(0x205026c0)')
---------------------------------------------------------------------
To unsubscribe, e-mail: docs-cvs-unsubscribe@perl.apache.org
For additional commands, e-mail: docs-cvs-help@perl.apache.org