Programming in Perl for the web? Alternatives?
FedoraForum.org - Fedora Support Forums and Community
Results 1 to 8 of 8
  1. #1
    Join Date
    Oct 2017
    Location
    alaska
    Posts
    59
    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
    739
    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
    59
    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
    739
    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
    59
    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.

  6. #6
    Join Date
    Nov 2018
    Location
    usa
    Posts
    6
    Windows NT 10.0 Chrome 69.0.3497.100

    Re: Programming in Perl for the web? Alternatives?

    Quote Originally Posted by justinacolmena
    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?
    I don't want to be rude, I use PERL and PHP for both in website, I use PERL for some specific task that can easily be handle by it rather than using the PHP. I Agree Perl is offering a separation of code .PM then call it on the .PL, but you can also write all those code in the PL without calling a PM.

    On the other side PHP for a couple of years has evolve tremendously, if you dig a bit there's a lot of FRAMEWORKS that do this separation(MVC pattern) beautifully and more advance command to be use, right now I'm using the framework LARAVEL which i can highly recommend if you want to check it. In the past we are stuck on PHP 5.6 (latest), but now we have this PHP 7 which performs faster than PHP 5.6 and with the proper server setup nginx and all ( unmanaged server ) it will make them faster.

    FB use PHP but they use HHVM to compile it into native code that speed up the process.

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

    Re: Programming in Perl for the web? Alternatives?

    Quote Originally Posted by adrick08
    I don't want to be rude
    Then don't.

    I have very little patience for all the ID theft that occurs on poorly secured sites on the internet, and the adware, malware, spyware, worms, Trojans, and keyloggers that get installed.

    The prevailing don't-care attitude for web programming security just doesn't work for me.

  8. #8
    Join Date
    Dec 2005
    Location
    North Carolina
    Age
    29
    Posts
    1,161
    Linux Firefox 63.0

    Re: Programming in Perl for the web? Alternatives?

    Quote Originally Posted by justinacolmena
    I have very little patience for all the ID theft that occurs on poorly secured sites on the internet, and the adware, malware, spyware, worms, Trojans, and keyloggers that get installed.

    The prevailing don't-care attitude for web programming security just doesn't work for me.
    I don't think there is a don't care attitude so much as there are several avenues of attack. Even with a static site you need to pay attention to how ssh, your web server and firewall are configured to just deliver static content. Take user input at any time and now you have to make sure the input you are getting isn't triggering commands on the system. A database adds another surface of attack. Not running your own server? You are at the mercy of your hosting provider to keep software updated. Most programmers also tend to be self taught, some of these things we learn on the go.

    PHP has improved. While I don't like the language, I don't think it's going to be much different from Python or Ruby in how it runs other than the syntax. I really like Haskell, but Spock still has some warts that I end up working around. Rust is pretty promising, but it's in a more turbulent state than Haskell. Even with their problems, I have been able to get stuff done with both; it takes some digging into library source code at times though. I would judge the language separately from the web use, finding a framework you like can be done in almost any language, even C though I wouldn't recommend C for web programming.
    Laptop: Lenovo ThinkPad T410, CPU: Intel Core i5 520M, Ram: 8GB DDR3, Hard Drive: 320GB, Graphics: Intel HD, OS: Windows 7 / Arch Linux x86_64
    Desktop: Motherboard: ASRock Fatal1ty AB350 Gaming K4, CPU: AMD Ryzen 3 1200, RAM: 8GB DDR4, Storage: Samsung 850 Pro 256GB, Graphics: Asus Radeon RX 550 4GB, OS: Arch Linux x86_64

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
  •