I would like to run a Perl web application on Windows (assume 2008 R2 x64) with reasonable speed / capacity.
Currently my app is based on Mojolicious, using Strawberry Perl and running as CGI through Apache 2.2-win32. With about 20000 lines of code, the creation of the perl process takes a lot of time, almost a second or two while the actually processing is just a blink of a second.
I would imagine it to be running much faster and be able to serve much more req/sec if the app is configured in a Fast CGI or persistent style.
If I am on Linux, I would probably have sticked with the PSGI/Plack/Starman and Nginx reverse proxying.
Unfortunately, Starman/Starlet does not support Win32.
Morbo/Twiggy does not meet my need because the webapp does block (DB calls) and for some request it does take a while to finish.
So I am looking at Fast CGI solution right now. Unfortunately Apache and mod_fcgid does not work with Perl (Stackoverflow). And I am yet be able to found or work out a compatible binary with mod_fastcgi with 2.4. Something I didn't try yet is mod_fastcgi + Apache 2.2, but I wish I could stay on Apache 2.4.
I am also thinking if I could run my own FCGI process manager (the thing that manage preforking), together with Mojo::Server::FastCGI, and use mod_proxy_fcgi to do reverse proxy instead. Perl module FCGI::ProcManager also does not support Win32. Could there be any other process manager, prehaps in C#? (Preferably in C# for further hacking)
Let me sum up the question -
What's the best way to run Perl web app on Windows at a speed much faster than CGI, but not in non-blocking style.
and prehaps that lead to a question of - how to make mod_fcgid works with Perl? Or is there any fcgi process manager out there?
you could use Mojolicious + mod_psgi + apache.
There are pre-compiled binaries here, although for Apache 2.2:
http://strawberryperl.com/package/kmx/mod_psgi/
--
Mike
You could use the threaded Plack server Thrall.
Is Cygwin considered robust and safe enough to be used on enterprise applications?
Do you know Enterprise applications that were developed or using Cygwin?
If you've been using cygwin - how often did you need support? Is there a fine-support for Cygwin? how well was the support you were given?
Thank you very much.
Why on earth would you even consider cygwin towards any sort of enterprise application? Even their site directly gives multiple signs it shouldn't be used for anything critical. You can't run native linux apps and you have to rebuild your app from source if you want it to run. It won't make your apps able to use any *nix functionality like signals, ptys, etc. All it is is a slim Linux type API layer....to answer your question, I don't think anyone would want to use cygwin in an enterprise application.
Like Maz asked, why wouldn't you just run linux? What potential benefits would you ever see coming from cygwin in an enterprise environment?
The best answer to your question may be obtained from the Cygwin web site. The answers obtained there come directly from the maintainers of the Cygwin DLL and ported software.
I am searching for a simple webserver that runs on windows and which runs code written in a scripting language. A requirement I have is that it supports HTTPS.
On Linux I could use a simple python script and load the OpenSSL module, but that does not work on Windows. Also I have found a Powershell server, but it has no HTTPS suppport.
So, maybe someone of you has a recommendation.
I'd suggest IIS 5.x, 6.x, or 7.x which comes with Windows Server 2003 or 2008 all depending on what version of Windows you're running. It supports https, but it's hardly simple. It has powerful capabilities, and can do classic ASP Server side scripting as well as a full blown .NET web apps. It all depends on what you want to do.
Maybe Manos http://jacksonh.tumblr.com/post/1159500924/manos-de-mono-the-manifesto is an option.
So I ordered Learning Perl 6th edition and I know it's using 5.14, but Strawberry Perl is only at 5.12, so what are my options? Is 5.12 fine for it or will there be problems with what's being taught?
Is my only option using Linux? If so distro suggestions would be good along with instructions or a link to instructions on updating perl in said distro (or in general). I'm relatively new to Linux, only ever having installed Ubuntu a few times and never really stuck with it. The perfect solution would be a distro that's good for installing on another PC in my house so I can just remote desktop (or equivalent, even SSH, though GUIs are nice) into since I have an older PC that I want to put a new hard drive in and mess around with. (Pentium 4 with a bit less than a gig of RAM so not awful)
Hopefully this question is considered more constructive than my last two and I look forward to your responses.
Edit: Also any resources for a Linux noob would be a great help if possible and if it's the best option.
I haven't actually seen Learning Perl 6th edition, but I would be very surprised if you had difficulty working through it with Perl 5.12. Perl 5.14 is still too new for most people to be writing code that requires it. The book may mention some features that you can't take advantage of in 5.12, but it should still explain how to accomplish things using only 5.12 features.
I would recommend just using the current Strawberry Perl and not worrying about the version number.
Update: As Mike pointed out, here's the opening paragraph of the Preface:
Welcome to the sixth edition of Learning Perl, updated for Perl 5.14 and its latest features. This book is still good even if you are still using Perl 5.8 (although, it's been a long time since it was released; have you thought about upgrading?).
So that confirms you'll have no problem trying to use 5.12 with the 6th edition.
Use ActivePerl
It is a very good product, it is free, and it has a reliable (for the most part) PPM (Perl Package Manager). I use it and have no troubles usually. It is a binary distribution just like Strawberry Perl, but you use PPM to get modules instead of CPAN.pm.
Note: If you are getting Perl 5.14 Just because of the book, don't. I got that book (I am also a beginner) and used 5.12.4. You get mostly all of the features (except for a few ;-)
I moved from Windows and PHP to Linux and Perl a while ago, and haven't looked back - but I don't want to start an OS or programming language war here. My desktop is running Ubuntu, but you could stick with Windows (I have Windows available in a VirtualBox VM for those times when I need it).
You can download the Ubuntu Server ISO and attach it as a CD/DVD image via the Virtual Media Manager. You can then set up as many Ubuntu VMs as you like. I use very basic setting for mine:
RAM: 512MB
Hard Disk: 8GB dynamic
Network Adapter: Bridged
I have a few images configured. One is setup with Nginx + Catalyst, one with Bricolage CMS and Apache, and a few other variations (including a PHP one). The great thing with VMs is that you can create snapshots, duplicate images, experiment, and blow things away and restart if you mess things up.
How you choose to setup your development environment is down to personal choice. I use SSHMenu to open four SSH connections to my development server - this also places the terminals at predefined positions on my screen.
I use one terminal to run code, access the debugger, etc. I use another for connecting the DBMS client (PostgreSQL / MySQL). I use the other two for editing code and unit tests. I use Vim in the terminal as my editor. I was going to try Emacs too, but never got round to it.
I use git as my version control system, with bare repositories on a separate file server. I did start with Mercurial, but it appears as though much of the Perl world is using git, so I switched.
I have configured the GNOME terminal to use the beautiful Solarized colour scheme (you can find a handy script for that here).
As for the Perl version: I don't know. I agree with other comments about using a standard package rather than trying to build your own - especially if you are a Linux newbie. I've just looked on the O'Reilly preview page, and in the Preface, it says "this book is good even if you are still using Perl 5.8" - so you should be okay with an earlier version. You also need to be aware that if you are planning on doing web development in Perl, you may be limited to older versions of Perl by your chosen hosting provider.
A few more thoughts:
Programming Perl, despite its age, is still a great resource. One you've completed Learning Perl, and perhaps Intermediate Perl, it's well worth reading. The section on Pattern Matching (regular expressions) is fantastic.
Modern Perl is a really good read. It's well written, concise, and full of really useful tips.
cpanm is a great alternative to the standard CPAN application.
local::lib is very useful. I use it to create a per-application set of CPAN modules. This means that I can simply copy the entire directory structure from my development server to the application server, without having to worry about conflicts with other applications that might be using different versions of the same modules. This is probably not relevant to you at the moment, but when you've learned more and start using lots of CPAN modules, it can be really handy.
A quick local::lib example:
mkdir -p ~/myapp/extlib
cpanm --prompt -L ~/myapp/extlib CPAN::Module1 CPAN::Module2 ...
eval $(perl -Mlocal::lib=~/myapp/extlib/)
In ~/myapp/scripts/myscript.pl:
use FindBin;
use local::lib "$FindBin::Bin/../extlib";
You could
Install Windows and then run Ubuntu inside a VM on your Windows machine. You can start it up, ssh to it and then mess around with it.
Use ActivePerl.
Simply use ActivePerl - you can download 5.14 or 5.12 and it's as good as Strawberry, even with the complete CPAN toolchain, nowadays. The only limiting factor is the license, it's absolutely free to use but you can't bundle it in any of your apps without getting an OEM license. So for 99% of the cases this is a good distribution.
StrawberryPerl is also suitable, but they usually have a slightly longer delay between the release of a Perl version and the availability of an updated StrawberryPerl version.
I have a fully updated Ubuntu 11.04; it has Perl 5.10.1. I don't know how up to date other Linux distributions are. Cygwin also has 5.10.1.
You could always build from source.
Well, you can either use Active Perl, or use a GNU/Linux distro and get the latest Perl from it's repos. GNU/Linux is not Windows, it is open-source and you can install it on as many PCs as you want it. You could try Ubuntu or it's builds for an easy-to-use system.
Most of Learning Perl doesn't depend on Perl 5.14 features, and those that do are clearly marked. In most cases, I try to show a non-v5.14 way to do the same thing. You'll miss out on some nice v5.14 features, but you won't be stuck without them. And, for what it is worth, the new Programming Perl, due very soon, covers up to v5.16. Don't buy the old version if you don't have it yet.
Many people have already suggested very good options for various Perls, so I won't repeat those. My advice to students is always to learn on the Perl version and operating system you want to deploy to.
You don't have to stick to Windows. You can get a virtual machine of just about any operating system you like. VMWare and Oracle VirtualBox have free players and many places offer pre-configured virtual machines. From there, you can install any Perl version that you like. It's also incredibly cheap and easy to have multi-boot systems (although a VM doesn't prevent you from using both at the same time).
On Windows, you can also install cygwin, then install any Perl that you like.
Also, there is a preview release for Strawberry Perl 5.14.
I need to embed a tiny webserver in a compiled jsfl external library for Adobe Flash CS4 so that an outside process can communicate with it. The external library will be a Carbon bundle on Mac and a set of dlls on Windows, so the webserver will need to be embedded/loaded from C/C++ code with no external dependencies like Ruby. Most of the tiny webservers like fnord or mini-httpd have never been ported to the Mac or Windows but are mostly intended to be compiled on Linux. I was thinking of using a Lua based embedded webserver but not sure if that would work or not. Are there any embedded webservers that are easier than others to port to Windows and Mac?
All right, I finally answered this. After evaluating several webservers I found a gem, Mongoose. Mongoose is a very small embeddable web server written in C that compiles and runs easily on Linux, Mac, and Windows (there is an even a link in the wiki to getting it to run on the iPhone). Many webservers say they do this but Mongoose was really easy to get up and running. It just did exactly what I expected a little web server to do with minimal fuss. My previous approach, to use libevent or libev, I found a bit too hard, mostly because of threading issues I faced with my main GUI thread. Mongoose came with support for CGI and PHP but I actually found the C based handlers very easy to write so I stuck with that.
Webrick and Mongrel run on both.
I thought of one other idea that is easier than Lua that I will try: using a webserver built with libevent. All I really need to do is serve up one file and I don't need any other HTTP features so something like the following might work:
http://3.rdrail.net/blog/libevent-webserver-in-40-lines-of-c/
I will report back.