[32137] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 3402 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jun 5 00:09:20 2011

Date: Sat, 4 Jun 2011 21:09:02 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 4 Jun 2011     Volume: 11 Number: 3402

Today's topics:
    Re: How to keep SQL statement preparation and executing <xhoster@gmail.com>
    Re: simple CGI server <*@eli.users.panix.com>
    Re: simple CGI server <xhoster@gmail.com>
    Re: simple CGI server <uri@StemSystems.com>
    Re: simple CGI server <e9427749@stud4.tuwien.ac.at>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Fri, 03 Jun 2011 20:03:55 -0700
From: Xho Jingleheimerschmidt <xhoster@gmail.com>
Subject: Re: How to keep SQL statement preparation and executing code together
Message-Id: <4de9b08a$0$22146$ed362ca5@nr5-q3a.newsreader.com>

Rainer Weikusat wrote:
> Marc Haber <mh+usenetspam1118@zugschl.us> writes:
>> Rainer Weikusat <rweikusat@mssgmbh.com> wrote:
>>> A pretty obvious idea would be
>>>
>>> 	sub do_something {
>>> 		$sth = $dbh->prepare(...) or die unless $sth;
>>> 	        $sth->execute(...)
>>>
>>> 	        .
>>> 	        .
>>> 	        .
>>> 	}                
>> Neat idea. I'd go with Peter's suggestion nevertheless, I didn't know
>> about prepare_cached before.
> 
> This is actually almost the 'worst of both worlds' solution because it
> implies that you still have the clutter of the prepare calls and the
> local overhead of executing them

What is the local overhead of executing them?  Pretty close to zero.

> and just save the IPC for the
> repeated prepares and the database processing which would otherwise be
> needed for executing them. 

Parsing and planning a query is quite resource intensive for many 
database servers, and is often well worth saving.

> Unless you're not really doing anything
> with the data except invoking stored procedures which do the
> processing work inside the DBMS and just return the results to you,

Even without stored procedures, the DBMS does its part of the processing 
work inside itself and returns just the results to me.  That is why I 
use one.

> that's not going to help in any meaningful way (the additional IPC for
> the repeated prepares and the DBMS processing required to execute them
> is most likely noise compared to IPC and processing required for
> querying the data you're interested in

If each execution is returning hundreds of thousands of rows, that is 
probably true.  If each execution is returning one or two rows, it is not.

> while the redundant local stuff
> slows your processing down for nothing in return).

I find that rather hard to believe.  The redundant local stuff is 
essentially a hash look up, on a string whose hash value is almost 
certainly cached.

Xho


------------------------------

Date: Fri, 3 Jun 2011 22:01:39 +0000 (UTC)
From: Eli the Bearded <*@eli.users.panix.com>
Subject: Re: simple CGI server
Message-Id: <eli$1106031801@qz.little-neck.ny.us>

In comp.lang.perl.misc, Xho Jingleheimerschmidt  <xhoster@gmail.com> wrote:
> I'm looking for a simple CGI server written in Perl.  It doesn't need to 
> be threaded or forking, other than the fork implicit in the CGI protocol.
> 
> I've searched CPAN, but most of what I found was about talking to a 
> server, not being a server.

HTTP::Server::Simple might be exactly what you want.

> use Something::CGI;
> Something::CGI->run_loop(
>      {listen_on => 8080, dir => "/path/to/servers/cgi-bin"}
> );
> __END__

You'll need a little bit more code than that, though. 

Elijah
------
just wrote an http server for ease of sending test cases to an http client


------------------------------

Date: Fri, 03 Jun 2011 18:33:32 -0700
From: Xho Jingleheimerschmidt <xhoster@gmail.com>
Subject: Re: simple CGI server
Message-Id: <4de989a9$0$22201$ed362ca5@nr5-q3a.newsreader.com>

Eli the Bearded wrote:
> In comp.lang.perl.misc, Xho Jingleheimerschmidt  <xhoster@gmail.com> wrote:
>> I'm looking for a simple CGI server written in Perl.  It doesn't need to 
>> be threaded or forking, other than the fork implicit in the CGI protocol.
>>
>> I've searched CPAN, but most of what I found was about talking to a 
>> server, not being a server.
> 
> HTTP::Server::Simple might be exactly what you want.

That is one of the ones that emulates mod_perl, not mod_cgi.

> 
>> use Something::CGI;
>> Something::CGI->run_loop(
>>      {listen_on => 8080, dir => "/path/to/servers/cgi-bin"}
>> );
>> __END__
> 
> You'll need a little bit more code than that, though. 

Yeah, unfortunately I found it easier to just install apache than to 
figure out how to come up with that extra code.


Xho


------------------------------

Date: Fri, 03 Jun 2011 22:03:25 -0400
From: "Uri Guttman" <uri@StemSystems.com>
Subject: Re: simple CGI server
Message-Id: <87wrh21hg2.fsf@quad.sysarch.com>

>>>>> "XJ" == Xho Jingleheimerschmidt <xhoster@gmail.com> writes:

  >> You'll need a little bit more code than that, though. 

  XJ> Yeah, unfortunately I found it easier to just install apache than to
  XJ> figure out how to come up with that extra code.

that extra code is a bit of work. it means parsing the http request
headers (modules can do that for you), setting up the ENV and/or stdio,
forking the child cgi process, reading back more headers (which need
parsing) and data and sending it back to the browser. nothing earth
shattering but not a quicky project. as you said, apache is just simpler
to install.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


------------------------------

Date: Sat, 04 Jun 2011 13:28:37 +0200
From: Josef <e9427749@stud4.tuwien.ac.at>
Subject: Re: simple CGI server
Message-Id: <4dea16e7$0$5640$3b214f66@tunews.univie.ac.at>

Am 04.06.2011 03:33, schrieb Xho Jingleheimerschmidt:
> That is one of the ones that emulates mod_perl, not mod_cgi.
>
> Yeah, unfortunately I found it easier to just install apache than to
> figure out how to come up with that extra code.

Then maybe lighty (lighttpd.net) is worth a look.
(Even under the assumption you are very common with apache.)

Also from hearsay a addon for firefox exists (has existed) that
allow direct execution of cgi scripts.

so long,
   Josef


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 3402
***************************************


home help back first fref pref prev next nref lref last post