Re: Reverse engineered HTML

2001-05-15 Thread newsreader

On Tue, May 15, 2001 at 07:42:11AM -0400, Paul Cotter wrote:
 Does a package exist that will read an HTML document and generate an 
Apache::Registry cgi script? Even better if it accepts an !--Perl tag.


Am I missing something?  
It's as simple as

undef $/;
$a=FILEHANDLE;
print $a


How you handle the header
is a separate matter.



Re: modify Server header via a handler

2001-05-01 Thread newsreader

randal s. posted a way to do that
sometime back.  search for it in
the archive.  his stonehenge
website apparently uses the same trick.

On Tue, May 01, 2001 at 02:51:14PM -0400, Richard Chen wrote:
 I would like to customize or suppress the Server header
 from the modperl server responses such as this:
 
 Server: Apache/1.3.19 (Unix) mod_perl/1.25 mod_ssl/2.8.1 OpenSSL/0.9.6
 
 I thought I could simply set up a Fixup handler to do this:
 
 package NoServerInfo;
 use Apache::Constants qw(:common);
 sub handler {
 my $r=shift;
 $r-header_out(Server = 'Foo Bar');
 return OK;
 }
 1;
 
 But this does not seem to work. Is there some kind of restriction
 about this particular header in modperl? Without modifying 
 the source code, is there a way to customize this Server header field?
 
 Thanks for any info
 
 Richard



Re: apache::registry + use strict curiosity

2001-04-26 Thread newsreader


that's no apache::registry.  that's perl

there are big guns here who can answer
your questions but it am not one of them.


On Thu, Apr 26, 2001 at 02:25:17PM -0700, Eric Kolve wrote:
 I found something a bit curious that I was wondering if someone could
 explain. I have the following apache::registry script I called test.reg:
 
 #!/usr/bin/perl
  
 use strict;
 if($test){
 # do stuff
 }
  
  
 print qq|HTTP/1.1 200 OK\r\n|;
 print HELLO WORLD\n\n;
 
 
 I ran my server in single-user mode (httpd -X) and requested the page
 which causes an internal server error because I didn't declare '$test'. 
 I next commented out the three conditional lines:
 
 #if($test){
 # do stuff
 #}
 
 Then requested the page a second time, which executed just fine. I
 uncommented those three lines and requested the page a third time, which
 strangely enough actually works.  Registry stats pages to see if they
 change and recompiles pages I believe.  So I am wondering why isn't an
 exception raised on the third request about not declaring '$test'?  Did
 the first request put '$test' in the symbol table?
 
 thanks,
 
 --eric



What is the difference: PerlRun and MaxRequestsPerChild 1

2001-04-25 Thread newsreader

I recently began to experience many lingering
mod_perl processes which slow down my tcp connection.

I use Apache::Registry for all my mod_perl need.
Not the real handler.

The practical solution I found was to cut down the 
number MaxRequestPerChild and kill off the processes
after a few requests.

I understand that Apache::PerlRun has the overhead
of compiling each script with a new request.  I would
like to know whether there is a compilation overhead
if I set say MaxRequestsPerChild 1  ??

I was also thinking that because the script is loaded
from the disk with each request there will be performance
degradation because of disk data ransfer rate will be
order of magnitude less than if the script were
to remain in the memory all the time.

That leads me to think about using very cool RAMFS that
comes linux-2.4.  What does everyone think about using
RAMFS to reduce the performance degradation due to
loading script from the disk if there is one.
I have over 100 scripts altogether but the total size of them
is less than 1 MB and I have plenty of memory.

Thanks in advance



Re: What is the difference: PerlRun and MaxRequestsPerChild 1

2001-04-25 Thread newsreader

On Wed, Apr 25, 2001 at 12:10:01PM +0100, G.W. Haywood wrote:
 Hi there,
 
 On Wed, 25 Apr 2001 [EMAIL PROTECTED] wrote:
 
  like to know whether there is a compilation overhead if I set say
  MaxRequestsPerChild 1 ??
 
 http://perl.apache.org/guide

I have read the guide cover to cover long ago :)


 You can use ramdisks with almost *any* Linux.
 

Ah.. ramdisk and ramfs are different animals





Re: What is the difference: PerlRun and MaxRequestsPerChild 1

2001-04-25 Thread newsreader

Thanks.  I think that is what I really need :)

On Wed, Apr 25, 2001 at 08:19:21PM +0800, Stas Bekman wrote:
 the two events contrudict and lead to the need to re-read the guide, and
 especially this section:
 http://perl.apache.org/guide/performance.html#Preloading_Registry_Scripts_at_S
 
 :)
 _
 Stas Bekman  JAm_pH --   Just Another mod_perl Hacker
 http://stason.org/   mod_perl Guide  http://perl.apache.org/guide
 mailto:[EMAIL PROTECTED]   http://apachetoday.com http://eXtropia.com/
 http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
 



Re: What is the difference: PerlRun and MaxRequestsPerChild 1

2001-04-25 Thread newsreader

On Wed, Apr 25, 2001 at 07:19:25PM +0800, Stas Bekman wrote:
  if I set say MaxRequestsPerChild 1  ??
 
 Not if you preload your scripts at the server startup. But then you pay
 the price of the time to spawn a new process, which has a very little
 overhead under low load since Apache preforks processes (assuming that you
 have MaxSpareServers set to a reasonable number). Under very high load
 your machine will spend a lot of CPU, spawning processes, which is not
 good.
 

I have lots of custom modules that I preload with startup.pl.

Still I have many scripts that run under Apache::Registry.
Not exactly sure how to preload these scripts.  I have the following
directive

PerlTaintCheck On
IfModule mod_perl.c
Location /

#  PerlSetVar PerlRunOnce On

SetHandler perl-script
PerlRequire /home/apache/modperl/startup.pl
PerlHandler Apache::Registry

#  PerlSendHeader On

  Options +ExecCGI
/Location
/IfModule

Note: this is a dedicated mod_perl server and I'm not serving
any static pages.
-

Document root / contains 100 perl scripts.

I preload 40 modules (of which 29 is my own
custom modules) in startup.pl as
explained in your guide.

So I guess I don't understand what you mean by 
preloading scripts.  One of the reasons
I like having 100 scripts in document root
with Apache::Registry is that I can modify
them at any time and I don't have restart
the server.  This is also one of the reasons
I don't bother with the real handler.

Thanks



Re: Apache growing (memory)

2001-04-25 Thread newsreader

On Wed, Apr 25, 2001 at 10:02:06AM -0400, Brendan McAdams wrote:
Our application performance actually
 improved across the board when we implements MaxRequests... (This

Do you have numbers to back this up?  How does reading in a new
script every now and then IMPROVE anything compared to keeping
in memory all the time?  It's not like perl gets tired
after using the same memory all the time.

Memory leakage is a separate issue which I don't seem to be able to solve
any how with use strict and I'm not using any global variables at all.




Re: Problem building on Solaris 2.7

2001-04-24 Thread newsreader

Stead of DSO why don't you compile
statically.

On Tue, Apr 24, 2001 at 02:47:55PM -0700, Mod-Perl List wrote:
 
 
 I am trying to build mod_perl 1.25 as a DSO on Solaris 2.7
 and when I execute perl Makefile.PL, it says I will probably
 get core dumps and to upgrade to perl 5.6. I am running
 Perl 5.005_03, the latest considered stable on Solaris 2.7. I
 cannot upgrade to 5.6 due to heavy perl code already on this
 machine.
 
 Can anyone point me in the right direction?
 
 Thanks,
 CC



Re: problems with make test, server not starting

2000-12-28 Thread newsreader

On Thu, Dec 28, 2000 at 09:58:41PM +, Richard wrote:
 On Thu, 28 Dec 2000, you wrote:
  Screw the tests. Mine fails all the time, I just type 'make install' and it 
  all works perfectly.
 
 Hmn, just tried that.
 
 my httpd.conf file did not seem to change, i setup a location directive for
 Apache::Status to see if it was all ok, but get a config error telling me it
 does not understand PerlHandler. Would that suggest that i am trying to start a
 non mod_perl enabled apache?
 
 :-(
 
 i don't want to grab an RPM.
 
 Richard



Re: Linux Hello World Benchmarks: +PHP,JSP,ePerl

2000-12-18 Thread newsreader


On Mon, Dec 18, 2000 at 10:37:16AM -0800, Joshua Chamas wrote:
 
 Please feel free to run the tests yourself, and if you give
 me the results, I'll be sure to post them at a later date
 at http://www.chamas.com/bench/ .  You can grab the benchmarks
 from http://www.chamas.com/bench/hello.tar.gz
 

I downloaded the tar ball just to fool around on my system.  It will
be nice to have a README file with a short instruction set.

Do you compile apache for each test or do you just use
one size fits all apache  with everything compiled in?



Re: Linux Hello World: TT Optimized...

2000-12-12 Thread newsreader

On Mon, Dec 11, 2000 at 10:14:56PM -0800, Joshua Chamas wrote:
 [EMAIL PROTECTED] wrote:
  
  Could you please explain the differences between
  CGI Raw and CGI.pm?  I'm using oo method of
  CGI.

 The Raw CGI test makes no use of CGI.pm, just issues raw print 
 statements that sets up the right CGI headers.  Please note that the 
 number that I reported showed a difference of .00065 seconds of system 
 time per request between CGI.pm  Raw CGI HelloWorld, so I wouldn't much 
 worry about the environment overhead.

Oh you meant cgi.  CGI should be reserved for CGI.pm stuff.

I don't use CGI's html functions at all because I just
don't see much saving in terms of typing.  I guess I am 
in between your 'RAW' case and CGI.pm case

I only use CGI's param,header,cookie and redirect functions 
and DISABLE_UPLOADS and POST_MAX variables.  Given that
real handler is the second best performer after static
html I wonder how big of a step from using Registry to 
writing a handler. I know I can rely on CGI because
it is time tested. I wonder whether there are CGI equivalent
modules if I don't use handler.  I read earlier
that CGI alternatives have some problems.


 
 If you are using CGI.pm object methods, I would worry about calling 
 all those methods to build your HTML and if you are performance 
 minded, I would use them frugally.
 
 --Josh



Re: Mod_perl vs mod_php

2000-12-12 Thread newsreader

Maybe he meant php hello world vs perl hello world?


On Tue, Dec 12, 2000 at 01:16:59PM -0800, Randal L. Schwartz wrote:
  "Jimi" == Jimi Thompson [EMAIL PROTECTED] writes:
 
 Jimi Does anyone have any mod_perl vs. mod_php benchmarks?
 
 Perl code gets 0 performance on PHP.
 PHP code likewise gets 0 performance on Perl.
 
 Given that, you've got to write different code on both, and you can
 probably always come up with enough variance that you can make
 benchmarks show whatever you want them to show.
 
 Given *that*, what's your real question?
 
 -- 
 Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
 Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
 See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: Mod_perl vs mod_php

2000-12-12 Thread newsreader

On Tue, Dec 12, 2000 at 02:53:30PM -0800, Randal L. Schwartz wrote:
  "newsreader" == newsreader  [EMAIL PROTECTED] writes:
 
 newsreader Maybe he meant php hello world vs perl hello world?
 
 And the point of such a comparison would be... what?

it will be to publish in your favorite magazine/web site/mailing list/whatever
Did you miss chamas' hello world thread?  I don't really care for 
benchmark myself but your point they way I understand was that it
was not possible to make benchmark comparison.  In fact in theory 
it is possible even beyond hello world.  Take two programmers
from perl and php worlds and give them the same problem.  It *is* possible
to make a comparison of the resultant applications.  Purely technical
comparison.

 The real costs of a web application these days are the total product

Now you are talking about something other than technical comparison.
Wouldn't that be like saying "ferrari has a bigger top speed than 
corolla does but so what corolla gets better gas mileage."  It all
depends on how benchmark is to be used.

transactions-per-second is an important factor that determines
whether or not somebody will come back to your site, I think.  So
if you are shooting for yahoo like numbers maybe you should start
thinking transaction-per-second. you are the one who frequently
touts the virtue of writing a real handler instead of using registry??
what is your point about such energetic touting?

What I really like to see compared is the development time of php vs perl code for a 
given
problem.  I've read ad nauseam about perl development time being shorter than C.
How does php compare to perl in this regard, I wonder.

 costs, not the transactions-per-second costs.  Until you're getting
 Yahoo-number hits, does it really matter whether something takes 1
 second vs 3 seconds to process?  And even then, shouldn't you be more
 worried about which of these two systems better supports 304 responses
 and data caching and dependency tracking, instead of which one
 executes a useless static page faster?
 
 -- 
 Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
 Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
 See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: Linux Hello World: TT Optimized...

2000-12-11 Thread newsreader

Could you please explain the differences between
CGI Raw and CGI.pm?  I'm using oo method of
CGI.

Thanks
   
On Mon, Dec 11, 2000 at 07:56:03PM -0800, Joshua Chamas wrote:
 Hey,
 
 Updated results from the other day with the Template Toolkit 
 benchmark properly optimized, thanks Perrin!  
 
 The reference for these numbers is at: http://www.chamas.com/bench
 If you would like the hello test suite, please email me separately.
 
 ]# ./bench.pl -time=60
 
 Test Name Test FileHits/sec Total Hits   Total Time   
sec/Hits 
       
 
 Apache::ASP   hello.asp 414.1   24846 hits   60.00 sec
0.002415 
 Apache::Registry CGI Raw  hello_raw.re  741.7   44502 hits   60.00 sec
0.001348 
 Apache::Registry CGI.pm   hello.reg 500.0   30001 hits   60.00 sec
0.002000 
 HTML Static   hello.html   1215.7   5 hits   41.13 sec
0.000823 
 HTML::Embperl hello.epl 509.6   30579 hits   60.00 sec
0.001962 
 HTML::Mason   hello.mas 385.9   23153 hits   60.00 sec
0.002592 
 ModPerl Handler   hello.bench   885.8   5 hits   56.45 sec
0.001129 
 Template Toolkit  hello.tt  560.3   33622 hits   60.01 sec
0.001785 
 
 -- Josh
 
 _
 Joshua Chamas Chamas Enterprises Inc.
 NodeWorks  free web link monitoring Huntington Beach, CA  USA 
 http://www.nodeworks.com1-714-625-4051



Re: persistent connections for handlers

2000-12-09 Thread newsreader

I'm also interested in this problem. I've
been piping my mails to sendmail and I'm
told that this is not a good idea with mod_perl.
I find that talking to SMTP server is noticeably
slower although I don't know whether the slowness is
just in the initial connection.  I am using the local
sendmail daemon as the SMTP server.


On Sat, Dec 09, 2000 at 11:05:50AM -0500, John Saylor wrote:
 Hi
 
 I am writing a mod_perl handler that takes a HTTP POST and sends mail. What
 I'd like to do is to open up a connection to the SMTP server [a Net::SMTP
 object] and a log file [filehandle] that exist outside of the handler. So
 that when the handler is run, it has access to these items, and can send
 data to them, but that they don't get opened up and brought down each time.
 
 Right now, I have them being set up [and torn down] in BEGIN {} and END {}
 blocks. The code doesn't complain, and it sends the right thing back to the
 browser, but nothing gets mailed or written to the log. I can post the code,
 but I was hoping that this problem is generic enough [and my description
 good enough] that someone can point me in the right direction without the
 details of the code.
 
 My question is this: how do you set up persistent connections that a handler
 can use, but ones that don't get initalized each time the handler is called?
 
 Are these just file [package] scoped globals?
 Do I need subroutines to check the status of these objects/handles and
 reinitialize them as needed?
 Is there another way?
 
 Any pointers, suggestions, or non-sequitors are welcome, thanks.
 
 --
 \js
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: perl's memory leak

2000-12-07 Thread newsreader


The output I get is 

used memory = 0
used memory = 0
used memory = 0
used memory = 0
used memory = 0


I'm interested in how many leaks are possible in mod_perl
though because my mod_perl processes are getting bigger
with time -- about 200 requests is making the process
fatter by 1mb on the average.  I'm watching to see if
they will max out around the current level of 10 mb per child.



On Thu, Dec 07, 2000 at 07:53:16PM +0300, Ivan E. Panchenko wrote:
 
 
 Today I discovered a strange behaiviour of perl, 
 and I wonder if anybody can tell me what to do with it.
 
 The matter is that perl DOES NOT REUSE MEMORY allocated for 
 intermediate calculation results. This is specially harmful to
 data-intensive modperl applications where one perl process processes
 many queries and can leak great amount of memory.
 
 The example is below:
 
 use BSD::Resource; 
 my $cc = 'a' x 2000 ;# alocates 20Mb for the right part and
# 20Mb for $a
 p;
 { my $a = $cc.'x'; # allocates 20 more Mb for right part
# and 20 for a
 p;
   undef $a;# deallocates $a
 }
 p;
 { my $b = $cc.'y'; # allocates 20 more Mb for right part
# and reuses deallocated 20Mb for b 
  p;
   undef $b; 
 }
 p;
 
 sub p { 
   print STDERR "used memory = ".(BSD::Resource::getrusage)[2]."\n"
 }
 
 # end of example.
 Output:
 used memory = 40772
 used memory = 79804
 used memory = 80068
 used memory = 99676
 used memory = 99700
 ##
 Here I used BSD:Resource to measure consumed memory. Its result seems to
 be correlated with the amount of memory taken by the process from the OS.
 #
 
 This was checked on FreeBSD 3.4 and 4.2 ; and perl5.00405 5.00503 .
 Same things where noticed on Linux and probably on Solaris too.
 
   Ivan
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Apache 1.3.14 build

2000-12-05 Thread newsreader

They say mod_perl 1.24_01 (not 1.24) is to be used with apache 1.3.14

On Tue, Dec 05, 2000 at 04:02:42PM -0600, Wang, Pin-Chieh wrote:
 I am trying to build apache v.1.3.14 with Mod_perl v. 1.24 using APACI
 I am using Perl 5.6 build 620 - the latest
 
 I ran perl Makefile.PL under mod_perl-1.24 directory
 The system created Makefile in support,regex. directories
 but terminated prematually with warning message for "Apache Version 1.3.0
 required, aborting.."
 
 Any body knows why?
 Should I go back to Apache 1.3.0?
 
 Thanks for any help
 
 PC Wang
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Order of Installation!!!

2000-12-01 Thread newsreader

It's not enough to just install the modules. 

Did you configure the httpd.conf with mod_perl
as explained in the documentation?

On Fri, Dec 01, 2000 at 03:40:45PM -0200, Edmar Edilton da Silva wrote:
 Hi all,
 I have installed on my machine the following modules:
 apache 1.3.12-2
 mod_perl 1.21-10
 DBI 1.13-1
 DBD::Oracle 1.03
 Apache::DBI 0.86-1
 
 The problem is that when I run a perl script under mod_perl, the
 response time is almost the same than the response time of the same
 script being ran without the mod_perl module. And I know that mod_perl
 was correctly installed. Another problem is that I can not open database
 connections when the WWW server starts because happen an error in the
 child processes of the apache. I think can there is some problem in the
 installation or configuration of the modules.
 Did the order for installing of the modules do any difference?
 If someone help me will be very appreciated. Thanks...
 
 --
 
 Edmar Edilton da Silva
 Bacharel em Ciência da Computacão - UFV
   Mestrando em Ciência da Computacão - UNICAMP
 
 
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: no such file or directory

2000-11-30 Thread newsreader

Actucally 'file' has always been  '/full/path/to/file' because
my path in most of my scripts are empty and
I have the taintcheck on.  Besides they were working under
mod_perl for a full week.
 
It's weird that I can now make them work by converting every dbmopen to tie.
It seems that perl suddenly decides not to like dbmopen function any more.
This function still works for other scripts not running as
httpd though.


On Thu, Nov 30, 2000 at 07:45:45AM +, G.W. Haywood wrote:
 Hi there,
 
 On Wed, 29 Nov 2000 [EMAIL PROTECTED] wrote:
 
  I have this mysterious problem of my mod_perl scripts
  giving errors like no such file or directory
  when I know for a fact that files and directory are there.
 
  dbmopen %A,'file',0644 
 
 Try 
 
 dbmopen %A,'/full/path/to/file',0644 
 
 73,
 Ged.
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




no such file or directory

2000-11-29 Thread newsreader


Hi People

I have this mysterious problem of my mod_perl scripts
giving errors like no such file or directory
when I know for a fact that files and directory are there.

The files are berkeley db file.  The problems first show
up in the midst of doing multiple recompiling and reinstallation
of mod_perl and apache.  They mysteriously disappeared after repeatedly invoking
the scripts.  However today I attempted changed one of my supposedly 
obselete dbmopen functions to tie functions and they came right back.

So I immediately reinstall  the old version. The problems is still
there

All I did was change
dbmopen %A,'file',0644 

to 
use DB_File;
tie %A,'file.db'

They work fine on the command line. I have mod_perl 1.24_01 apache 1.3.14 linux
2.2.17.  I can post more info if necessary

Thanks

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]