Polyglot has asked for the wisdom of the Perl Monks concerning the following question:
I have developed a web-based search engine with Perl that operates on a MySQL database. The HTML/JavaScript/CSS output is simple, and compatible with most any browser.
Someone recently tracked me down from another country and requested a version of my website in CD form. I would be happy to release the contents of the database to a wider distribution, e.g. public domain, but the source code is all Perl, and it is not easy to run an entire website (I'm linux-based right now) on a CD. I found Server2Go, but it still seems a bit awkward.
Additionally, if I could somehow precompile the code, for wider compatibility and for source protection, it would be nice.
I can try to invent this wheel if it has not already been done, but I suspect someone has already attempted this before. I would appreciate your wisdom.
Re: How to run a linux/perl-based website on a CD for Windows
by onelesd (Pilgrim) on Jul 09, 2012 at 23:09 UTC
|
You could create a minimal live-cd of your favorite linux distro with your app pre-installed and configured, and install a browser with a bookmark to http://localhost/.
Take a look at PAR::Packer for some basic source protection.
| [reply] |
|
| [reply] |
|
| [reply] |
|
| [reply] |
|
|
Polyglot,
The browser tried to show the binary code!
You already have some good answers, but to give you a little idea of what is going on when the browser gives the binary instead of the results of the binary. Most browsers are clients and expect to 'talk' to a server. This is really important when using cgi. What you need to do is install a small server on the CD that will execute your 'cgi-bin' scripts. I have never used it, but I believe CPAN has a Perl server that you might be able to include.
Now if you really are going to charge for this CD, then my next comments are academic. You are already hosting the application, so the only reason the person from another country would want the CD is to get to your Perl scripts. So my question to the 'tracker' is "Why don't you put a link on your site to my site?" If that isn't acceptable, then just ignore the request.
In the past, I used to offer 'free demos' that could be downloaded by anyone. But when you find your demo being sold on eBay for $5.00 as a real system, you quickly change the policy. Your name will be on it, so many will expect you to support it. Just a heads up!
Good Luck!
"Well done is better than well said." - Benjamin Franklin
| [reply] |
Re: How to run a linux/perl-based website on a CD for Windows
by ww (Archbishop) on Jul 09, 2012 at 23:25 UTC
|
Your hope to "somehow precompile the code, for wider compatibility and for source protection,...." isn't one you can satisfy with an executable Perl script. Simply can't be done. If it can be executed, you can do no more than obfuscate.
As to the request from the individual who "tracked (you) down," it'll be a lot easier -- IMO -- to provide code, the DB and its contents, and the HTML/CSS and let that person bring it up as a working site with whatever mods are required for whatever purpose the requester has in mind.
A small website will fit easily enough on one or perhaps 2 CDs; but for any real utility, I suspect the whole shooting match needs to go on a server, even its only for an intranet.
Afterthought: I've been assuming that the supliant specified that your work run under Windows and from a CD. That may have to be negotiated. But as far as being "linux/perl-based" I see no reason that the code won't be compatible, unless you are using *nix-only modules like, say, IO:stty or something that has such a module in its requirements. | [reply] [d/l] |
|
Yes, I should be able to fit it all onto one CD. If all I can do for code protection is to obfuscate it, do you have a recommendation? I was hoping to be able to use a compiled binary, but if this not a workable solution, I think you may be right.
Regarding the modules I'm using, aside from strict, CGI, and DBI, the main one I'll need is Encode. I have gotten the whole thing running via Server2Go, but its interface is not especially intuitive or user-friendly. I don't know how to have the CD automatically boot to the site page without the individual having to navigate to it after having started the server program.
| [reply] |
|
- Protection: Its the nature of Perl. You can't protect the source of an executable. And if you're willing to give the product away... why, then, give it away.... or charge the requester a fee, and attach a copywrite notice. (That won't protect your code, either, but maybe it'll make you feel better... and if requester turns out to be making a zillion Euro or dollars or whatever with your work, that may give you some basis to sue.)
- Boot to the site page: M$ (or Google) will probably tell you how to do what it calls 'autorun;' but again, unless the individual who asked for your work is naive, s/he should be able to install Perl; set up an apache server, MYSQL, and whatever else (my memory is slipping) is needed.
| [reply] |
Re: How to run a linux/perl-based website on a CD for Windows
by marto (Cardinal) on Jul 10, 2012 at 08:34 UTC
|
Since you want to let people access this site/system and keep the source hidden, giving it away in any form seems senseless when you could simply host a demo system yourself online. Hosting is a competitive market these days.
| [reply] |
Re: How to run a linux/perl-based website on a CD for Windows
by aitap (Curate) on Jul 10, 2012 at 07:59 UTC
|
You can continue using Linux. I would recommend remastering KNOPPIX or building your own Debian live-cd, but this is a matter of choice, so you can use any distro you want. OpenSUSE Build Service is quite interesting, too.
You can install any packages you need, place your site files, install the webserver and add an auto-running script (for example, in /etc/skel/.xinitrc) which launches the browser you installed at http://127.0.0.1/.
The user will just need to place the CD in his drive and reboot.
Sorry if my advice was wrong.
| [reply] |
|
|