Programming in Perl for the web? Alternatives?
FedoraForum.org - Fedora Support Forums and Community
Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2017
    Location
    alaska
    Posts
    58
    Linux (Android 7.0) Chrome 70.0.3538.80

    Programming in Perl for the web? Alternatives?

    I have installed the package nginx-mod-http-perl and started reading the documentation for it, which includes a whole O'Reilly book that I downloaded from the nginx website.

    A few years ago I happened to take an "Intro to PHP" course and an "Advanced PHP" course that were offered at a local community college, and I have done most of my web programming in PHP since then. PHP is quick and easy for the web, with a syntax very similar to C and C++.

    To deploy PHP web pages you mostly just create them with a ".php" extension and put the special tags "<?php" and "?>" around the code you want interpreted on the server side.

    Perl seems to have more of a philosophy of writing modules ".pm" which are included in the configuration, and then calling them with a special syntax from html pages. There is more of a forced separation of code and presentation content than there is with PHP.

    Also, Perl has been around a lot longer, and there are more routines and libraries available to do useful things that have not been implemented in PHP yet.

    I am curious about this, and I am interested in moving from Apache/PHP to Nginx/Perl. Are there other options or ideas? I want to get away from the ubiquitous totalitarian LAMP stack as much as I can. It's too much of a "fixture."

    Are there other ideas or suggestions for general purpose web programming? I'm not really crazy about Java or Tomcat, either, but how do, say, Ruby and Python fare?

  2. #2
    Join Date
    Feb 2005
    Location
    London, UK
    Posts
    724
    Windows 7 Chrome 70.0.3538.77

    Re: Programming in Perl for the web? Alternatives?

    Knowing PHP I'm not sure I'd bother learning perl just for Web pages, there doesn't seem to be that much benefit of one over the other.

    I'm interested in doing something with libonion though. It kind of works the opposite way to how you usually create web content - usually you'd create the web content (html, php etc) and put it on top of the web server, libonion allows you to insert a web server directly in to your C applications. For high performance web pages (e.g: real time data) this sounds pretty nifty to me. https://www.coralbits.com/libonion/

  3. #3
    Join Date
    Oct 2017
    Location
    alaska
    Posts
    58
    Linux (Android 7.0) Chrome 70.0.3538.80

    Re: Programming in Perl for the web? Alternatives?

    Quote Originally Posted by HaydnH
    Knowing PHP I'm not sure I'd bother learning perl just for Web pages, there doesn't seem to be that much benefit of one over the other.
    PHP's runtime interpreter is slow, despite some "memoization" and caching to avoid some of the bulk of repetitive code execution with every page hit.

    Perl modules are "compiled" into memory at server load time, and may be executed much faster with each page hit.

    One of the problems is the use of lightweight threads in web servers, which cannot solve the problem of the main process block that occurs on low-level system calls to read() and write(), which by design must block the main process until the socket or file has accepted or returned some data or is closed due to an error. So there is usually a "pool" of processes available for this purpose, but it is definitely one of the limiting factors of web server performance in general.

    PHP has perennial security issues, too, and I am not sure how well these would be mitigated by using Perl instead, although there may be some benefit in this respect.

  4. #4
    Join Date
    Feb 2005
    Location
    London, UK
    Posts
    724
    Linux (Fedora) Chrome 70.0.3538.102

    Re: Programming in Perl for the web? Alternatives?

    I think stating that PHP is slow as a blanket rule is incorrect, Facebook, Google.com & Wikipedia all use PHP just to name a few and I haven't experienced any performance issues with those sites, it maye not handle certain tasks particularly well but for the most part it's performance is fine. Also it's not insecure in itself, however it is fairly easy to write insecure code - anyone writing code that must run in a DMZ should understand the security issues of whatever language they're coding in and write appropriately. Bad code will be slow/insecure in whatever language you write it in.

  5. #5
    Join Date
    Oct 2017
    Location
    alaska
    Posts
    58
    Linux (Android 7.0) Chrome 70.0.3538.80

    Re: Programming in Perl for the web? Alternatives?

    Quote Originally Posted by HaydnH
    I think stating that PHP is slow as a blanket rule is incorrect, Facebook, Google.com & Wikipedia all use PHP just to name a few and I haven't experienced any performance issues with those sites, it maye not handle certain tasks particularly well but for the most part it's performance is fine. Also it's not insecure in itself, however it is fairly easy to write insecure code - anyone writing code that must run in a DMZ should understand the security issues of whatever language they're coding in and write appropriately. Bad code will be slow/insecure in whatever language you write it in.
    FB and WP have horrible performance and security problems, for your information. Google has something much more efficient going on than straight PHP, but there is a TMI problem. Google is simply too hungry for bank passwords among other things that involve Too Much Information.

    With the logic of writing good code in "whatever" language, sure, why not? There are even web frameworks in C++, probably faster and more secure than Perl, PHP, Ruby, Python, Ocaml, and all that.

    But for something like PHP, I want it idiot-proof, nothing that'll overflow buffers and root my server or anything like that when I put it live. Something quick and easy for a one-off basic web script when I'm busy programming other things.

Similar Threads

  1. Linux Programming vs. Windows Server Programming
    By stauntonmck in forum Programming & Packaging
    Replies: 7
    Last Post: 15th July 2013, 09:16 PM
  2. linux programming vs. windows programming
    By unlovedwarrior in forum Programming & Packaging
    Replies: 11
    Last Post: 22nd October 2006, 09:14 PM
  3. Replies: 3
    Last Post: 24th July 2005, 07:31 PM
  4. Replies: 0
    Last Post: 17th December 2004, 12:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •