whiteperl051 has asked for the wisdom of the Perl Monks concerning the following question:

I love Perl. It's awesome.

I've been thinking of writing software in Perl that can be used on Windows but for it to work I will require a redistributable web server and perhaps Mysql? to go with that.

So, the way it would work is that I have a setup.exe file that I offer for download. When setup.exe is run to install my app it will install a webserver on port 12345 with mysql and then execute my Perl scripts - and this is all done on the host machine. Hope this makes sense.

Is there perhaps a web server I can borrow or redistribute with my Perl app so that I don't have to re-create a web server myself which can execute and run the Perl scripts.

Some apps that work this way (you simply install it and the app runs in a web browser on a server running on the local host) that come to mind is:

sabnzbd / deluge / sonarr / etc.
  • Comment on Perl with redistributable web server and mysql?

Replies are listed 'Best First'.
Re: Perl with redistributable web server and mysql?
by Corion (Patriarch) on Aug 28, 2016 at 18:07 UTC

    Personally, if this is for a single user application I would try to avoid MySQL and a "real" webserver, and go with an all-Perl setup of, say Twiggy and DBD::SQLite, that is, use a webserver written in Perl and use SQLite instead of a separate database proces.

    Alas, I'm not aware of an easy way to create a setup/installation file for Perl. Maybe consider looking at PAR::Packer to create a single executable that people can copy...

      Perhaps I missed something, but the OP mentioned doing this on Windows. According to its CPAN Tester Matrix, it doesn't look like there are any passes in the mswin32 column for Twiggy. It looks like it might work under Cygwin, but not everyone is going to want Cygwin installed on their Windows system.

      For Windows, I think Mojolicious, Dancer or Dancer2 would probably work better than Twiggy - although I have heard a lot of good things about Twiggy.

        I routinely use Dancer with a Twiggy backend engine on Windows. I think Twiggy fails its tests due to relying on Test::TCP, which usually fails its test suite on Windows due to relying on fork().

Re: Perl with redistributable web server and mysql?
by marto (Cardinal) on Aug 28, 2016 at 19:16 UTC

    I'm pretty sure that sabnzbd and sonarr don't use mysql, they use SQLite (see DBD::SQLite). I doubt that a torrent client would use mysql either. What framework where you thinking of for the web interface?

Re: Perl with redistributable web server and mysql?
by Cody Fendant (Hermit) on Aug 29, 2016 at 05:41 UTC
Re: Perl with redistributable web server and mysql?
by Tanktalus (Canon) on Aug 30, 2016 at 00:07 UTC

    I'd be sorely tempted to try a redistributable docker image... yeah, ok, it'd be a bit of a pain to set up docker automatically on a windows host, but once you got that done once, the features you could add - mysql/sqlite, nginx/apache, redis, beanstalk, I mean, really, you name it. And it would also work on Macs and Linux systems just by setting up docker there as well.

    Yeah, I've been playing with docker a bit lately. Suddenly, it has become my hammer to all the world's nail-looking problems :)

Re: Perl with redistributable web server and mysql?
by Discipulus (Canon) on Aug 30, 2016 at 08:44 UTC
    For the redistributable part, you can also consider to use strawberry perl notably the portable editions: you can modify a portable edition adding what you need via cpan or adding separate executables in, let's say, the /strawberry/perl/bin folder. You can play with the portableshell.bat file that come with the distribution and after that repack in a compressed file.

    citrusperl is a tool that is very near to your needs: but I have just tried it in the past and it is focused in Wx GUI applications, but can create a customized Perl distribution usable on windows machines.

    For stand alone executable PAR is the base choice and cavapackager can be an alternative.

    Let us know your achievements!

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
Re: Perl with redistributable web server and mysql?
by dasgar (Priest) on Aug 30, 2016 at 05:25 UTC

    For the database portion, I'd agree with what others are saying about recommending for ou to use SQLite rather relying on having a specific database software installed.

    For the web server portion, you could consider using Mojolicious as your web server. Someone even has a blog posting (see here) about using Mojolicious and PAR::Packer. That might help get you started with putting a Perl based web server into an executable.

      Thanks so much for all the awesome replies. I will definitely be researching and trying the recommendations mentioned here and post here when I find an elegant solution.

      I simply love doing things in Perl - Always a pleasure to use.

        I settled on Mojolicious but ran into a few problems. For now I have scrapped the idea of doing it with Mojolicious due to some limitations with Mojolicious as it does not fit into what I plan on doing. Still, it seems a redistributable web server might serve my purposes the best. Anybody have any recommendations for a redistributable web server that can handle Strawberry Perl?