[32797] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4061 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 22 09:09:37 2013

Date: Tue, 22 Oct 2013 06: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           Tue, 22 Oct 2013     Volume: 11 Number: 4061

Today's topics:
        Activestate: upgrading to a later version without losin <bernie@fantasyfarm.com>
    Re: Can't Perl Be Event Driven Too? <cwilbur@chromatico.net>
    Re: Can't Perl Be Event Driven Too? <cwilbur@chromatico.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 21 Oct 2013 16:57:15 -0400
From: Bernie Cosell <bernie@fantasyfarm.com>
Subject: Activestate: upgrading to a later version without losing modules
Message-Id: <v84b69d0qn3fvdbpm918fe1idtjq4orm1p@library.airnews.net>

I discovered that I can no longer ppm new modules to my 5.12 version of
Activestate Perl without buying a "business edition" license.   I don't
mind upgrading to the latest version [5.16, I think it is].   What I can't
find is if the install just "slides in" over the current install [which
would be perfect].   The package is an .MSI bundle.  right now perl is
installed in c:\perl64.  If I just tell the installer to put the new
version there, will that work?  THANKS!
    /bernie\
-- 
Bernie Cosell                     Fantasy Farm Fibers
bernie@fantasyfarm.com            Pearisburg, VA
    -->  Too many people, too few sheep  <--          


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

Date: Mon, 21 Oct 2013 14:26:50 -0400
From: Charlton Wilbur <cwilbur@chromatico.net>
Subject: Re: Can't Perl Be Event Driven Too?
Message-Id: <87li1m8oph.fsf@chromatico.net>

>>>>> "JB" == John Black <jblack@nospam.com> writes:

    JB> I keep hearing about how Javascript / Node.js is great for web
    JB> servers because its "event driven" and "non-blocking"...

The essential part of this is that it is in the nature of Node.js to be
asynchronous and to use callbacks and deferred execution.  Because of
the emphasis on asynchrony in the entire stack, because very few calls
actually block for any reason, it's possible to write asynchronous code
at the highest level.

While this is possible in Perl (and really not that difficult), the lack
of emphasis on asynchrony and non-blocking calls in Perl overall means
you need to take extra care to make sure that nothing blocks.  


    JB> But how hard is it to use Perl for an event driven application
    JB> like a web server.  Seems to me you can just have a main thread
    JB> processing the event requests.  For each request, it spawns a
    JB> thread to go off and do the work which reports back when done.
    JB> The main event queueing thread is not "blocked" while the other
    JB> threads are doing the work.  Presto - event driven...  What am I
    JB> missing?

This is not event-driven in the sense that node.js is event driven.

Event-driven code generally has a single thread of execution and a task
queue.  To make your code event-driven, you would have to structure it
as small blocks of code that respond to events, none of which contain
any blocking code that you have to wait for. 

So your web server:  it receives a request.  It parses the request.
Then it tries to open the file to serve (for simplicity, let's make this
a stupid web server that doesn't do anything dynamic).  Since this is
likely to block, it does it asynchronously, which means that instead of
waiting for it to return, the runtime will trigger an event when it
occurs. So when the file-to-serve-is-opened event fires, we then read
the first chunk of the file and pass it to our output socket.  Both of
those can block! so now we have the file-chunk-ready event and the
output-socket-ready event. Eventually we get the file-has-ended event,
and we close the socket.  

But the key is, single thread of execution, with a priority queue of
events that need to be responded to; and the response to an event may
include firing off OS calls that will result in other events being
queued when they return.

(Practically, writing in Node reminds me a lot of cooperative
multitiasking: if you do it all correctly and there are no bugs, the
fact that you have fewer safeguards means you can get screamingly fast
performance.  However, when you have a bug, it can take the entire
server down, and not just the thread/process you're in.)

Charlton




-- 
Charlton Wilbur
cwilbur@chromatico.net


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

Date: Mon, 21 Oct 2013 14:31:42 -0400
From: Charlton Wilbur <cwilbur@chromatico.net>
Subject: Re: Can't Perl Be Event Driven Too?
Message-Id: <87haca8ohd.fsf@chromatico.net>

>>>>> "JB" == John Black <jblack@nospam.com> writes:

    JB> For education, I wanted to learn to write a web based app on a
    JB> cloud type of structure like Heroku.  I wanted to use Perl but
    JB> now I notice Heroku doesn't even support it!

    JB> "Write apps in your language ? we support Ruby, Node.js,
    JB> Clojure, Java, Play, Python and Scala."

    JB> Why would they support Ruby and Python but not Perl??

Politics.  A lot of the external factors around Perl have made it less
popular than it by rights ought to be: in particular, the early missteps
in Perl 6 development took away a lot of momentum; and where 10 years
ago Perl was the obvious choice in its subfamily of languages, nowadays
there are a dozen viable competitors.

Charlton


-- 
Charlton Wilbur
cwilbur@chromatico.net


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

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 4061
***************************************


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