RE: Strange mod_perl error. Help needed!

2001-04-17 Thread Vladislav Safronov

Ok! Thanx! I found the bug :-)

 Try to install the AUTOLOAD sub and trace the calls:
 
 use Carp;
 sub AUTOLOAD{
 Carp::cluck("trying to load $AUTOLOAD");
 }
 
 at least you will figure out where the sub is called from. It looks
 
 _
 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://logilune.com/
 http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
 
 



RE: Advice needed. (web app. performance)

2001-01-30 Thread Vladislav Safronov

What about this idea:

open N 'ispell -a' processes for writing and reading at httpd start up, 
save their descriptors into an array in some Perl module and then 
mark decriptors in the table then as "busy" or "idle". But the question
is how to share this dynamicly modified table among all httpd processes? ..

/ vlad





Advice needed. (web app. performance)

2001-01-29 Thread Vladislav Safronov

Hi,

I've just finished a simple web based spellcheck application
based on ispell, it's written as perl module which just call
ispell on every request (actually keeps it open afert first request).
The bad thing is N users used spellcheck there are N running
useless ispells and it is not good I think. 

I think as sort of spellcheck server should be written which can fork
accordingly to user requests. 

Where can I find sample code (skeleton code) for such server?
Would you recommend any other method?

Thanx,

\Vlad.




RE: Advice needed. (web app. performance)

2001-01-29 Thread Vladislav Safronov

I swear, I searched CPAN before posting the question to the conference and I
used Lingua::Ispell
in my application. But Lingua::Ispell just opens 'ispell -a' on reading and
writing for every new httpd process, so it take time to open dictionaries or
switch to other language dictionary.
It provide nice interface .. but I thought that stand-alone "spell" server
would provide better performance and
used less memory.

\ vlad.




[OT] Mixing C and HTML code just like in ePerl?

2000-11-28 Thread Vladislav Safronov

Hi,

I use ePerl and it's good, but some things need better performance.
Is there any "chtml" compiler that allow me freely mix C and html code
just like in ePerl:


HTML code
%
 C code ..
%
HTML code
%=(C expr.)%
..

Vlad.

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




[OT] advice needed.

2000-09-29 Thread Vladislav Safronov

Hi,

I know it's very OT, but don't kick me I just need advice.

I am going to work in a Web Company to write some mod_perl apps.
They gave me a contract (I think the terrible one) which
contains paragraph (among the others) that signs the rights to all
inventions over to them.
The problem is .. I have never sign such contracts and I don't know if it's
"common" contract template that programmers sign when start coding for
somebody.

If someone have 15 minutes to have a look at the my contract (I'll send
link) or tell
where I can find a "typical" contract for such work, let me know.

/Vlad.




RE: [OT] advice needed.

2000-09-29 Thread Vladislav Safronov

this is the contract (one paragraph is already excluded) :

http://vlad.narod.ru/contract.html

is it really looks like a usual thing?

(the matter of the job is just making mod_perl apps.)

/Vlad.

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Friday, September 29, 2000 4:32 PM
 Cc: [EMAIL PROTECTED]
 Subject: Re: [OT] advice needed.
 
 
 Vladislav Safronov wrote:
  I am going to work in a Web Company to write some mod_perl apps.
  They gave me a contract (I think the terrible one) which
  contains paragraph (among the others) that signs the rights to all
  inventions over to them.
 
 The same paragraph (the inventions resulted from your contracting 
 work belong to the company who hired you) is in my contract here
 in Germany and my lawyer told me it's a usual thing.
 
  The problem is .. I have never sign such contracts and I 
 don't know if it's
  "common" contract template that programmers sign when start 
 coding for
  somebody.
 
 I'd go to a lawyer to check the contract.



How to close connect and continue processing?

2000-09-14 Thread Vladislav Safronov

Hi,

After user request my script should say that the request is accepted and
continue processing user data (it takes a time) so I want to tell the
browser
that all data is sent. I searched mod_perl guide but I didn't find such code
snippet.
Could you send me such example?

==

Vlad.






RE: How to close connect and continue processing?

2000-09-14 Thread Vladislav Safronov

I read the guide and I think the best is just add "" :)
(how could I forget it!)
..
system("myprog la la ");
print "/html";
# end


 On Thu, 14 Sep 2000, Matt Sergeant wrote:
 
  On Thu, 14 Sep 2000, Matt Sergeant wrote:
  
   On Thu, 14 Sep 2000, Vladislav Safronov wrote:
   
Hi,

After user request my script should say that the 
 request is accepted and
continue processing user data (it takes a time) so I 
 want to tell the
browser
that all data is sent. I searched mod_perl guide but I 
 didn't find such code
snippet.
Could you send me such example?
   
   $r-register_cleanup(\do_big_work);
  
  I should have mentioned that this is far from a perfect 
 solution (cue
  Stas) as it ties up a mod_perl process. See the guide for alternate
  solutions.
 
 Like Matt has said, this used mostly for light things like logging or
 process killing (Apache::{SizeLimit|GTopLimit}). See the performance
 chapter for forking techniques for heavy jobs:
 http://perl.apache.org/guide/performance.html#Forking_and_Exec
 uting_Subprocess
 
 
  
  -- 
  Matt/
  
  Fastnet Software Ltd. High Performance Web Specialists
  Providing mod_perl, XML, Sybase and Oracle solutions
  Email for training and consultancy availability.
  http://sergeant.org | AxKit: http://axkit.org
  
  
 
 
 
 _
 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://jazzvalley.com
 http://singlesheaven.com http://perlmonth.com   perl.org   apache.org
 
 



RE: How to close connect and continue processing?

2000-09-14 Thread Vladislav Safronov

 On Thu, 14 Sep 2000, Vladislav Safronov wrote:
 
  I read the guide and I think the best is just add "" :)
  (how could I forget it!)
  ..
  system("myprog la la ");
  print "/html";
  # end
 
 True, but what happens if your program tries to print 
 something. You've
 all in/out/err streams inherited, where in/out are tied to a 
 socket. You
 must close them at the beginning of the external script.

hm.. it's true. I should back to the guide ... 
Thanx for the help!

Vlad.

 
 Anyway, it might be neater to use , but performance wise is 
 not, since
 you spawn a shell. Of course for the heavily loaded systems. Fork is
 faster.
 
  
  
   On Thu, 14 Sep 2000, Matt Sergeant wrote:
   
On Thu, 14 Sep 2000, Matt Sergeant wrote:
    
 On Thu, 14 Sep 2000, Vladislav Safronov wrote:
 
  Hi,
  
  After user request my script should say that the 
   request is accepted and
  continue processing user data (it takes a time) so I 
   want to tell the
  browser
  that all data is sent. I searched mod_perl guide but I 
   didn't find such code
  snippet.
  Could you send me such example?
 
 $r-register_cleanup(\do_big_work);

I should have mentioned that this is far from a perfect 
   solution (cue
Stas) as it ties up a mod_perl process. See the guide 
 for alternate
solutions.
   
   Like Matt has said, this used mostly for light things 
 like logging or
   process killing (Apache::{SizeLimit|GTopLimit}). See the 
 performance
   chapter for forking techniques for heavy jobs:
   http://perl.apache.org/guide/performance.html#Forking_and_Exec
   uting_Subprocess
   
   

-- 
Matt/

Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org | AxKit: http://axkit.org


   
   
   
   
 _
   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://jazzvalley.com
  http://singlesheaven.com http://perlmonth.com   perl.org   apache.org
  
  
 



_
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://jazzvalley.com
http://singlesheaven.com http://perlmonth.com   perl.org   apache.org





RE: Question about $sth-finish;

2000-08-17 Thread Vladislav Safronov

 On Tue, Aug 15, 2000 at 03:26:03PM +0400, Vladislav Safronov wrote:
  Hi,
  
  Could you have a look at the lines and answer the question ..
  ---
  sub foo {
  my $dbh = shift;
  
  my $sql = ...
  
  my $sth = $dbh-prepare($sql);
  $sth-execute;
  $sth-finish;
  }
  ===
  Do I always need to call $sth-finish?
 
 You *never* need to call finish on non-select statements.
 (If you do, it's a driver bug.)
 
  Wouldn't it be automaticly called when
  sub foo ends (when my variable $sth get destroyed)?
 
 Finish marks the end of *fetching*, not the end of life of the handle.

So I can freely overwrite the handle with new one, since it's not the end
of life of the handle, can't I?
==
my $sql = "select .."
 
my $sth = $dbh-prepare($sql);
$sth-execute;
.. fetch just some (not all) data
my $newsql = "select .."
$sth = $dbh-prepare($newsql);
$sth-execute;
==
and this code should work with troubles ...

Vlad.



RE: Apache::ePerl

2000-08-17 Thread Vladislav Safronov

Hi!

;) see the benchmarks http://www.chamas.com/bench/index.html

/Vlad
 
 Can anyone say some words about perfomance issues of Embedded 
 Perl - ePerl
 (don't mix up with HTML::Embperl). I mean running under mod_perl using
 Apache::ePerl. Maybe anyone has done some perfomance testing?
 Thanx beforehand.
 
 Sincerely yours,
 
 Vladimir Buyanov, senior web-developer
 Agama Internet Systems
 http://www.aport.ru
 http://www.atrus.ru
 http://www.agama.com
 
 



RE: Question about $sth-finish;

2000-08-16 Thread Vladislav Safronov

Well, summarizing all the answers and assuming using Mysql

1. $sth-finish should be used if (and ONLY if) the 
   the returned data (any SELECT, but not INSERT, UPDATE?)
   has not been fetched ALL and $sth is going to be
   overwritten..

2. $sth (defined as 'my') should not call finish before it
   gets out of scope..

Vlad/
   




Question about $sth-finish;

2000-08-15 Thread Vladislav Safronov

Hi,

Could you have a look at the lines and answer the question ..
---
sub foo {
my $dbh = shift;

my $sql = ...

my $sth = $dbh-prepare($sql);
$sth-execute;
$sth-finish;
}
===
Do I always need to call $sth-finish? Wouldn't it be automaticly called
when
sub foo ends (when my variable $sth get destroyed)?

Vlad.




RE: Question about $sth-finish;

2000-08-15 Thread Vladislav Safronov

 On Tue, 15 Aug 2000, Vladislav Safronov wrote:
 
  Hi,
  
  Could you have a look at the lines and answer the question ..
  ---
  sub foo {
  my $dbh = shift;
  
  my $sql = ...
  
  my $sth = $dbh-prepare($sql);
  $sth-execute;
  $sth-finish;
  }
  ===
  Do I always need to call $sth-finish? Wouldn't it be 
 automaticly called
  when
  sub foo ends (when my variable $sth get destroyed)?
 
 $sth doesn't always get destroyed when foo ends (due to a bug in all
 perls). But otherwise, yes.

"my" (perl's my) variables doesn't always get destoyed, does it Perl's 
documentation say that "my" vars are the most safe since they get destroyed
when they get out of scope ...

Vlad.



RE: Question about $sth-finish;

2000-08-15 Thread Vladislav Safronov

Ok. I think, the answers clear the problem, but I have yet more question.

What can you say about this code? is it ok (overwriting previous handle)?

==
sub foo {
my $dbh = shift;

my $sql1 = "select *...
my $sql2 = "select *...

my $sth = $dbh-prepare($sql1);
$sth-execute;
.. fetch some data.

# should be $sth-finish inserted??

$sth = $dbh-prepare($sql2); # we overwrite previous handle saved in $sth
..
$sth-execute;
.. fetch some data.
return;
}
==

Vlad.




RE: parsing SSI in cgi scripts?

2000-08-14 Thread Vladislav Safronov

 Hi,
 
 Is there way for processing SSI commands in perl?
 (my templates may contains SSI commands, so what
 should I do - just type in real html or process them somehow?)
 
 Check out Apache::SSI.  It can solve the problem.  Can be used with
 Apache::Filter or by instantiating an Apache::SSI object directly.
 
Ok! Thanks!



parsing SSI in cgi scripts?

2000-08-11 Thread Vladislav Safronov

Hi,

Is there way for processing SSI commands in perl?
(my templates may contains SSI commands, so what
should I do - just type in real html or process them somehow?)

/Vlad



does __END__ at the end save memory?

2000-06-29 Thread Vladislav Safronov

Hi, 

Does __END__ directive at the end of every mod_perl script
reduce memory used by httpd ?

Best regards,

/Vlad



RE: Highly optimized mod_perl ?

2000-06-26 Thread Vladislav Safronov

Ok !

 -Original Message-
 From: Stas Bekman [mailto:[EMAIL PROTECTED]]
 Sent: Friday, June 23, 2000 2:02 PM
 To: Vladislav Safronov
 Cc: '[EMAIL PROTECTED]'; '[EMAIL PROTECTED]'
 Subject: RE: Highly optimized mod_perl ?
 
 
  Hi, ( ili privet )
  
  I was looking any tips and tricks to optimize my perl script since,
  our sysadm tells that it's mod_perl slow down the web server
  response time and it should be rewritten in C. This script
  does use any database connection, so I think threre is no 
 real way to
  speed it up. Posting message here was the last chance.
  
  Vlad.
  
  pishite po-russki.
 
 Vlad, this is an international list, so please refrain from 
 using other
 languages than English. It's impolite to speak in the 
 languages that your
 audience doesn't know, even if some of the people do. 
 Especially if you
 are seeking help.
 
 For performance notes see: 
 http://perl.apache.org/guide/performance.html
 
  
   -Original Message-
   From: [EMAIL PROTECTED] 
   [mailto:[EMAIL PROTECTED]]On Behalf Of [EMAIL PROTECTED]
   Sent: Saturday, June 17, 2000 9:24 PM
   To: Vladislav Safronov
   Cc: [EMAIL PROTECTED]
   Subject: RE: Highly optimized mod_perl ?
   
   
   Hi,
   
   There was a discussion on this list about
   1.5 weeks ago on how to optimize mod_perl
   execution when using the database.  Stas
   Bekman basically has done some tests to
   show that the driver needs to be initialized
   in startup.pl file.
   
   There were also a discussion about the fact
   that as far as using templates for HTML
   generation the fastest approach is when
   a template is compiled into perl code
   before being executed.  I do not have
   enough understanding of the internals to 
   explain why though.
   
   Another discussion suggested that it is
   much better to precompile explicitly
   the functions that you need to use
   in modules like CGI.pm instead.  The
   fact that you precompile specific functions
   and not the whole module will save memory
   space of apache processes that run mod_perl.
   Saved memory means less swaping, and more
   memory for cache -- that means speed.
   
   There was also a post referring to a comparasing
   between many scripting and compiled languages
   that pointed out that by far the most
   important factor when choosing a language
   to implement a taks is what algorithm is
   being used (ie. how smart and fast it is)
   and that differences in programming languages
   are not significant compared to that.
   
   I also just recently read in "Advanced Perl Programming"
   by Sriram Srinivasan that (on page 369)
   there are Static Typing Hints:
   they give hints to the interepreter for better 
 optimization
   and type checking.
   so 
   my Dog $spot = new Dog;
   should be faster
   then 
   my $spot= new Dog;
   
   It actually should be faster for the consequent method calls
   to $spot-xyz (because perl would not have to do type checking
   and run-time)
   (this me parapharsing the example from the book
   
   Static hints will also allow for more aggressive compiler 
   optimizations
   (using perlcc) (but I do thing this mod_perl relevant).
   
   This is my high level overview of what I have learned sofar
   from the list (I am new to Perl so I am just trying to absorb
   as much as possible).
   
   Regards,
   Vladislav P.
   
   
   
   
   
   
   On 17-Jun-2000 Vladislav Safronov wrote:
Hi!

Does anyone know the way to highly optimize mod_perl for speed?
Any hacks, advices? All standard advices read from help 
 are done...

Best regards,

Vlad Safronov,
mailto: [EMAIL PROTECTED] 
   
  
 
 
 
 _
 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
 
 



RE: search engine for the Guide

2000-06-23 Thread Vladislav Safronov

Hi, 

Try http://www.comptek.ru/yandex/YandexFree.html
search engine for web servers with highlighting searched words... 



 -Original Message-
 From: Stas Bekman [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, May 04, 2000 2:10 PM
 To: Matt Sergeant
 Cc: mod_perl list
 Subject: Re: search engine for the Guide
 
 
  On Thu, 4 May 2000, Stas Bekman wrote:
  
   On Wed, 3 May 2000, Matt Sergeant wrote:
   
On Wed, 3 May 2000, Stas Bekman wrote:

 Yeah, I've been thinking about it. There was one site 
 that has offered me
 to provide a good search engine and they did, but the 
 problem is that they
 didn't keep up with new releases, so people were 
 searching the outdated
 version, which is quite bad -- I've removed the 
 reference to it, after
 asking them to update their copy for a few months, 
 with no results.

Can't we use WWW::Search - If I recall correctly some 
 of the sites can be
restricted to a domain, so you could build a search 
 interface pretty
easily.
   
   DESCRIPTION :
   This class is the parent for all access methods supported by the
   WWW::Search library. This library implements a Perl API 
 to web-based
   search engines.
   
   It's not the search engine -- it's a Perl API to the 
 search engines. We
   need a search engine not the API to it. Did I miss something?
  
  Yes. On some of the search engines (AltaVista springs to 
 mind) you can
  search for things on particular web sites, or even links to 
 particular web
  sites. So as long as AltaVista keeps its search contents up 
 to date, you
  can leverage their engine. IIRC either Randall or Lincoln did a
  WebTechniques article about this a few months ago.
 
 Oh, I see.
 
 But I want to stress these 2 points: 
 
 1) Currently each chapter in the Guide is a huge document, so 
 doing search
 and having a hit, doesn't really help as you still have to go thru the
 page to find the exact section that you want to read. So I 
 think we want a
 search engine that's not working with the master version per 
 se, but with
 a copy which has name anchors for each line and:
 
   a. can bring you to exact line with match
   b. have the keyword highlighted
 
 2) Most of the search engines have problems with keywords including
 non-alpha chars, like if you search for Apache::Registry you 
 will end up
 searching for Apache and Registry since :: is ignored. Now think about
 '$r-print' 'BEGIN {', '$@', etc. All these are must for the 
 doc with many
 non-alpha characters which should be searched for.
 
 What do you think?
 
 __
 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
--



Highly optimized mod_perl ?

2000-06-17 Thread Vladislav Safronov

Hi!

Does anyone know the way to highly optimize mod_perl for speed?
Any hacks, advices? All standard advices read from help are done...

Best regards,

Vlad Safronov,
mailto: [EMAIL PROTECTED]