by catchclose8919 · 4y ago · 0 comments
Also, if they wouldn't have made it too-weird-for-math-and-physics people, Perl would've probably filled Python's niche too.
And with that kind of resources focused on it, Perl 6 could've actually turned up into a clean nice new language that would've unified us all by also supporting nice compile-to-wasm.
</alternative-reality>
<html><body>
<?php echo 'Hello World'; ?>
</body></html>
Whilst the equivalent Perl at the time would be: #!/usr/local/bin/perl
print "Content-Type: text/html\r\n\r\n";
print "<html><body>";
print "Hello world";
print "</body></html>";
or possibly... #!/usr/local/bin/perl
use strict;
use warnings;
use CGI;
my $q = CGI->new;
print $q->header('text/html');
print $q->start_html();
print "Hello world";
print $q->end_html();
...if you were being a bit more more fancy.In other words, there was no standard templating; Template Toolkit eventually became a relatively defacto standard, but PHP had already won - and even then, TT had to be manually invoked rather than just going and freestyling <?php> tags everywhere in your HTML and "it just working".
In every other respect Perl is & was superior to PHP, and it's really sad to see Perl fade, despite (or because of?) its crazy flexibility and power.
I am not sure how much of a standard it was, but Perl Mason was a superb web site templating system.
Amazon and many other websites used it for years because it was flexible, high performance, and had fewer security problems compared to PHP.
The biggest problem for Perl was that PHP was almost built for the web, while Perl was "just a normal programming language."
I wonder where Perl would have been if there had been a packaged and easy to install version of Apache with Perl, mod_perl, HTML::Mason etc. pre-installed in some way in late 90s.
The big thing for PHP was how easy it was to go from "I've got a static HTML document that looks like what I want!" to "I've just added a tiny bit of dynamic content by sprinkling in a special tag!" on the majority of unix-based hosts. Deployment was uploading via FTP, just like it was with HTML. There's just so little conceptual distance or friction between static HTML and dynamic document/app, the pit of success is right there to fall into (granted, the peak of further success has some rocky roads out of that pit, but by then you've got momentum!).
On commodity hosting, Perl got typecast as a CGI tool instead. Which had its own power (CGI is kinda the OG serverless)... but not as easy a jumping off spot for anybody who was doing HTML.
Installing any major work built in Perl back then was a nightmare of installing all the underlying dependency modules, often into the system directories. It didn't have a clean, standardized way to package up a script + dependencies easily, and dependency management was hellish, especially with many key modules needing platform-specific C compilation.
At that time commercial "shared" hosting was still common: many customers sharing one linux webhosting box and uploading scripts to via FTP, with no access to or control over the underlying system. If the webhost supported PHP, you could upload a php script and it Just Worked. Not so with Perl!
Perl was by far the superior language, but it just wasn't the superior experience for a beginning web developer who mostly just wanted to embed a tiny amount of CGI functionality in a static HTML page, and then upload and run it pretty much anywhere with no fuss.
PHP really exploded in popularity when web hosting took off. It had a safe mode that made it possible to for several customers to co-exist in the same web server, without having the ability to read each other's files.
As I understand it, PHP became popular before CGI.pm was ready.
CGI.pm was created long (...) before PHP was released.
You could even get modules that would allow you to inline Python just like PHP, although the interaction between that and mandatory indentation could get a bit "interesting".
Also perhaps ironically, this style of mixing code and HTML has generally come to be regarded as an antipattern. PHP may still be able to do that, but woe unto the project that wants to write tons of code that way. But it's still the foothold PHP used to wedge its way into at least the B tier of languages.
Tell that to the React world :P
I think ColdFusion was briefly popular for the same reason (though I think that one fell out of favor largely because it cost a ton of money).
I started programming web systems in ‘96, with Perl because it was on every machine and every web host. Apache mod_perl was a thing, and it was a bad thing, because it had to be restarted all the time because of memory leaks.
On the other hand, mod_php was much more solid, and additionally, at the time, MySQL was the main thing for many websites. The Perl database bindings were wordy and obtuse, but PHP was a breath of fresh air. I was able to start using it in environments in ‘99 and honestly, I’ve never looked back at Perl as a web application language, just a systems one.
That simple difference was enough to make me fully switch over, and it set me on the path of a career programmer, so I look back on that time very fondly.
One other thing: I don’t recall Perl scripts allowing C-style pre-processing inclusion the way PHP did. I worked at Linux.com around then and we used all sorts of templating and other library reuse via this inclusion.
By that I mean, a mod_perl program was expected to change the execution state for future executions, global variables would remain, etc. There are ways to make that happen in mod_php, but it isn't the default and I don't know if they were available initially. This made it easier to share a mod_php server with many users... A mod_perl really should be suexeced per user (or something) and that's hard. Really, you want to do per user php servers too, but it wasn't obvious back then.
Conversely, PHP was trivial to set up for safe shared hosts.
The end result was that Perl hosting was expensive and had a higher barrier to entry than PHP.
But I do like its Unix feeling. Too bad no one uses it anymore and have to move on.