> Correct me if I mistake, but i want to know whatīs better...
> Cause with CGI is a little more difficult make forms and with handlers
> isnīt, i supposse i can use CGI and handlers at the same time.
> Iīve read that CGI object oriented programming just use 2 k of resource of
> the system and not object oriented consume 17k... may be somebody can
> explain me that, iīm referring to the conflict that i got between cgi and
> handlers...

What a coincedence. I'm working this exact section you read the above info
from. You've misinterpreted it of course, I was talking about CGI's OO
interface vs procedural interface. I didn't mention handlers at all in
this section.  We are talking about: 
http://perl.apache.org/guide/performance.html#Measuring_the_Memory_Usage_of_Su
(apache.org is down now, it's handled now)

The chapter http://perl.apache.org/guide/performance.html answers your
quiestion quite well. 

But as Mark Summerfield pointed out, the numbers aren't exactly correct.

The numbers are shown there were taken with:

  use CGI  qw(-compile :all);

at the server startup, therefore the usage of CGI.pm has added 2k for OO
CGI.pm and 18k for procedural interface. Notice that the whole CGI's
namespace is inhereted in if you precompiled functions at the startup. So
having:

  use CGI qw(header);

or

  use CGI qw(:all);

is essientially the same. You will have all the precompiled at the startup
symbols imported even if you ask only for one symbol.  It seems to me like
a bug, but probably that's how CGI.pm works. 

If you don't precompile methods at the server startup, you will get only
5k vs 2k overhead with these two scripts respectively:

  cgi_mtd.pl
  ---------
  use CGI qw(header b);
  print header();
  print b("Hello");

  cgi_oo.pl
  ---------
  use CGI ();
  my $q = CGI->new;
  print $q->header;
  print $q->b("Hello");

The numbers were taken by using B::Terse.


______________________________________________________________________
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.org    http://stason.org/TULARC/
http://singlesheaven.com| http://perlmonth.com http://sourcegarden.org
----------------------------------------------------------------------

Reply via email to