On Sat, 18 Sep 2004, Octavian Rasnita wrote:

> Can you recommend me some tricks to make it work a little faster?

In general, it does make sense to use CGI.pm rather than hand coding 
things, but if you need a speed boost then the best strategies are to 
[a] use a smaller subset of CGI.pm, [b] substitute a related but smaller 
module, or [c] use mod_perl. Roughly in that order of desperation.

> If I want to use the OOP style, is it possible to load only some 
> methods and not all?

Yes, of course. The obvious way to do this is to use something like

  use CGI qw[ :something ];

to just pull in the aspects of the module that you want.

Look up the docs for CGI to see which ones best match what you're doing.

  <http://www.perldoc.com/perl5.8.4/lib/CGI.html>
  <http://search.cpan.org/~lds/CGI.pm-3.05/CGI.pm>

Alternatively, try an alternate module like CGI::Fast or CGI::Lite:

  <http://www.perldoc.com/perl5.8.4/lib/CGI/Fast.html>
  <http://search.cpan.org/~lds/CGI.pm-3.05/CGI/Fast.pm>

  <http://search.cpan.org/~smylers/CGI-Lite-2.02/Lite.pm>

That or look into using mod_perl, possibly with Apache::Registry, which 
will let you (more or less) keep using your CGI.pm scripts, but it 
should speed them up considerably.

> Why do I need to use multiple CGI objects in the same session? Can you give
> me an example?

You should only need one -- what makes you think you need more?

> If I won't find many reasons to keep using the OOP style, I think I will
> start using the functional one... (hoping that it will work faster).

I don't *think* there should be a whole lot of speed difference here, 
though of course the way to know that for sure is to benchmark them. 

 

-- 
Chris Devers

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to