While I wait for my freshly installed-from-sources Perl 5.8.8 to run the cat-install script to install Catalyst, I'll mumble about concurrency in Perl, now that I am trying to learn Erlang.
Concurrency can be doen at the level of process (fork(), which is fork(2) and friends on UNIXen) or at the level of thread.
Since Perl 5.8.x we have threads, although a bit shakey. However, threads mean semaphores, locks, etc... Ugly.
CPAN to the rescue:
subs::parallel looks very nice. I will have to stress it to see if it's really usable, but it puts perl threads to the use in a very simple way, I like it.
Parallel::Simple also looks very nice, although it uses fork(). This has also problems, but nowadays fork() is very fast and cheap in UNIXen.
If you have to run the same thing many times, and it can run in parallel, Parallel::ForkControl is very nice. I've used it in the past to run control code on a big subnet, limiting the amount of bandwidth I sucked up, and it improved my partner's program by 3 orders of magnitude (yeah, that's right, 3 hours--counting the sleep we added on purpose--instead of 3 months) by improving the use of the IO bottleneck... :-)
There are other CPAN modules so you don't have to use threads or fork() yourself. Have a look on the module namespaces Proc::*, Parallel::* or forks::*, for example, and see which one suites your needs the best.
BTW, nothing of this is similar to Erlangs lightweight processess, which use message passing to work, and I don't think we could make a similar thing that worked easily enough.
Termite is a Scheme implementation of Erlang's concurrency model, and a couple of changes to the compiler/interpreter were necessary to implement it in Scheme, so I guess some changes would be needed in perl itself (i.e. in the compiler/interpreter).
Simulating Erlang's ability in perl is a different story, which I may tackle one of these days if I have time enough... :-P
In the meantime, I'm back to fighting with CPAN.pm and my proxy, which is stupid enough to be really annoying (argh!). BTW, any way to let CPAN know it has to use the HTTP methods instead of FTP? Using the fully qualified HTTP URI of my proxy doesn't seem to work... :-/
Best regards!
Re:disable ftp in CPAN
diakopter on 2006-09-12T20:35:40
Of course, this assumes you already have LWP installed... which has a large number of prereqs that aren't in the 5.8.8 core.Re:disable ftp in CPAN
excalibor on 2006-09-12T22:04:26
Well, heh, it says LWP is not installed...
I wish we had a properly ordered CORE... I still think that a layered approach to packaging would put some order to this little chaos of ours (see the comments section to my last journal post).
Okay, I don't have LWP... If I download the tarball, will it come with all the dependencies solved?
(anyway, I'll try it tomorrow, thanks for the tips!)Re:disable ftp in CPAN
diakopter on 2006-09-12T22:35:23
No, it does not come with its dependencies.:(