News for hackers. Stuff that matters.
Re:Perl 5.38 Released by drumhead on Monday July 03, 2023 @04:51AM (#36570416)
Why did Perl never maintain its popularity?
Re:Perl 5.38 Released by gpvos on Monday July 03, 2023 @05:01AM (#36570482)
Because PHP (heavily inspired by Perl, but not as well thought out) came with all the glue to directly use it to generate web pages. Then came Ruby (also inspired by on Perl, but with a more mainstream syntax, and nicer in some ways), and Ruby on Rails conquered that space even more. Also, Python came along which is indeed a bit more suitable for larger projects needing structure.

Meanwhile, Perl was being badmouthed by people who couldn't handle its flexibility and thought it was unreadable and unmaintainable. But that wasn't the main issue, after all PHP was worse in those two respects, yet it flourished.

Re:Perl 5.38 Released by Klonoar on Monday July 03, 2023 @05:20AM (#36570613)
PHP is "worse" in these respects when compared to other mainstream languages, yes - we can probably grant that, although it's not as bad as it once was.

Perl is just one big game of code golf. There is absolutely an entire era of developers who looked at that and ran far away (and I do not blame them at all).

Re:Perl 5.38 Released by mikelovenotwar on Monday July 03, 2023 @10:30AM (#36573435)
> Perl is just one big game of code golf.

With respect that's just not true.

Re:Perl 5.38 Released by nrdvana on Monday July 03, 2023 @01:43PM (#36576372)
"one big game of code golf" would probably be a decision by the author, wouldn't it? I know a person or two who could fall into that category, but it's hardly the fault of the language.
Re:Perl 5.38 Released by Klonoar on Tuesday July 04, 2023 @01:55AM (#36582716)
No, this is specifically a comment on the syntactical choices often found in Perl codebases and the penchant for brevity that is common in that community.
Re:Perl 5.38 Released by midoridensha on Monday July 03, 2023 @05:06AM (#36570512)
I think the other problem was that Perl 6 came out and was totally incompatible with previous versions. Python did something similar with 2->3 and it caused huge problems.
Re:Perl 5.38 Released by gpvos on Monday July 03, 2023 @05:08AM (#36570527)
That was later though. Interest in Perl was already declining a bit then. And the problem was more that the design and implementation of Perl 6 (now Raku) took extremely long, and attention to Perl 5 suffered from that, as Perlistas thought Perl 6 would be the Next Great Thing.
Re:Perl 5.38 Released by ZuLuuuuuu on Monday July 03, 2023 @05:53AM (#36570813)
Perl 5 -> 6 was much more comprehensive than Python 2 -> 3. Perl 6 is almost a completely new language.
Re:Perl 5.38 Released by lloeki on Monday July 03, 2023 @06:38AM (#36571086)
Not "almost", it is a completely new language with a passing ressemblance and IIRC was by and large advertised as such from the get go; the name "Perl" was kept as it was a spiritual successor, which they realised made it confusing so they changed it to Raku.

Perl 5 and 6/Raku have as much in common than Perl 5 and Ruby have.

Re:Perl 5.38 Released by chromatic on Monday July 03, 2023 @04:53PM (#36578668)
IIRC was by and large advertised as such from the get go

It was not. For many years it was advertised as the next version of Perl (with the intent being perhaps a Perl 5.10 release and then no more major releases with the 5 version number), then years later a "sister language", and then finally now (but not retroactively) a "completely new language in the Perl family".

Re:Perl 5.38 Released by lloeki on Tuesday July 04, 2023 @08:07AM (#36585580)
Hmm, that's not what I recall.

Very early (2000) the goal was for Perl 6 to be a rewrite[0]. There's no way this would have been a 5.x, especially given how the Perl 5 parser works and the class of warts that were aimed to be addressed:

> Perl 6 To Be Complete Rewrite (But Not What You Think)

> Perl 5 will not be abandoned, but will primarily be concerned with bugfixes both major and minor.

> The meeting for members of the perl5-porters mailing list was the result of an earlier, smaller meeting of Wall, Nathan Torkington, Chip Salzenberg, and others who basically decided that Perl needed to be fixed in certain ways, and that a rewrite was the best way to do it.

Quickly, being free from backwards compatibility gave room to try stuff out, and given the length of that design process, this resulted in features that they found out could be immediately useful if backported in some way to Perl 5:

> First, Perl 5 isn’t going anywhere. If anything, the rate of patches and changes to the code has increased. Cleanups from Ponie and the Phalanx project continue to improve the design and implementation, and new features from Perl 6 are making their way into Perl 5.

> Second, the opportunity to do the right thing without fear of breaking backwards compatibility opened up a lot of possibilities for impressive new features.

Granted, there's the following bit in the 2000 post:

> have a clear and automated migration path, which may include a backward compatibility mode

But back then (ca 2002-2005) I was only a Perl apprentice and a very junior developer yet it still struck me that the discussions highlighted differences that were expansive and fundamental enough that "next version of Perl" meant Perl 6 would be to Perl 5 what e.g Mac OS X† was to macOS 8/9 and (in retrospect since that happened only later) significantly different in class from e.g Python 2 to 3 or MRI to YARV.

That was my perception of it anyway; probably they weren't entirely clear what was the actual goal, hence a lot of bits were open to interpretation, and it got refined and bounced back and forth around a general baseline direction over 5-10 years.

[0]: https://developers.slashdot.org/story/00/07/19/203221/larry-...

[1]: https://www.perl.com/pub/2006/01/12/what_is_perl_6.html/

† which had classic mode to run the previous one's apps

Re:Perl 5.38 Released by adolfoabegg on Monday July 03, 2023 @07:11AM (#36571320)
Yes, this was my case, I started with Perl and then I moved to PHP.
Re:Perl 5.38 Released by mst on Monday July 03, 2023 @08:00AM (#36571704)
Ruby is very cool as an easier, shinier, more ergonomic and elegant Perl but the lack of block-based lexical scoping with compile time checking (use strict + my, duplicated as "use strict" and let in ES6, much to my happiness when using javascript) and the fact that while Ruby's core OO is much easier to use than bless() it's horrifyingly limited when you're used to Moose/Moo means I've always bounced off it when I've tried to learn.

Perl's sheer flexibility means there's a gulf between baby perl and good complex perl during which the developer doing the learning tends to make a complete mess (I definitely did this for a while) and some people never get past that stage so a lot of pre-existing perl code is awful and much though I love perl myself the language is definitely at least partially to blame.

Re:Perl 5.38 Released by mekster on Monday July 03, 2023 @09:08AM (#36572347)
I was there during the transition. Even rewrote a site from perl to PHP.

For newbies, not having have to write the "magic" string,

  print "Content-Type: text/html\n\n";
before being able to output anything probably felt quite friendlier and being able to mix HTML into the code, though it's not a good practice.

And the PHP standard library has quite a few things built in and combination of MySQL as LAMP was the hot word then, so I guess that's how it got traction and perl was gone from the web development.

I do like the Unix heritage of perl though. It does make you feel like a hacker when it feels the language has the shell syntax half baked in.

Re:Perl 5.38 Released by mikelovenotwar on Monday July 03, 2023 @10:17AM (#36573224)

    print $q->header();
From CGI is better in most cases. Modern web development with perl is lots of fun with Mojolicious:

https://mojolicious.org/

Re:Perl 5.38 Released by arunix on Monday July 03, 2023 @10:42AM (#36573603)
The CGI module is no longer shipped with Perl (as of 5.22)

https://metacpan.org/pod/CGI::Alternatives

Re:Perl 5.38 Released by mikelovenotwar on Monday July 03, 2023 @10:47AM (#36573682)
And nobody starting web dev now with perl should even consider it. Modifying an existing script that otherwise 'just works' sure. In my various other posts here I've recommended Mojolicious.
Re:Perl 5.38 Released by knightcrusader on Monday July 03, 2023 @02:40PM (#36577171)
You saying nobody starting web dev should use CGI.pm? Or CGI in general? Because CGI itself has its uses even today. It's much easier to understand and get off the ground than something like Mojo or Plack (I've used them all), and has its strengths compared to the others.

However, if you are saying no one should use CGI.pm, then I agree. That module is a bloated mess. Much more efficient ways to use CGI without that thing.

Re:Perl 5.38 Released by mikelovenotwar on Tuesday July 04, 2023 @04:57AM (#36584027)
CGI.pm, it's in response to the CGI::Alternatives post above.
Re:Perl 5.38 Released by anonzzzies on Monday July 03, 2023 @10:23AM (#36573327)
Many of us wrote our own 'php' in those times. Just some (fast)cgi blurp that read a vanilla perl file and wrapped it (via Apache pre-script/post-script) in the tooling to get the $_GET/$_POST, print "Content-Type: text/html\n\n", set/get cookies etc and returned the output of the script as something like XML. We stuck with Perl for a long time because of cpan and it was, especially then, a much better language when used in the right way. It was often abused (and I still do, because slightly complex scripts are still really easy to do in perl), but so was php. So I'm guessing the ease of php deployment if you didn't have access to the Apache of the server running would be a big thing.
Re:Perl 5.38 Released by thesuperbigfrog on Monday July 03, 2023 @04:59AM (#36570471)
>> Why did Perl never maintain its popularity?

It is usually installed by default on most Unix and Linux systems. It also rides along with most MinGW-based toolkits like Git for Windows. If you do software development, there is a good chance you might have Perl installed and not even know it.

Some people like to make fun of it despite its wide-spread use and utility. Most of them probably know little to nothing about Perl and have not written or maintained any Perl code. There is a good chance that they are using Perl code without knowing it.

Re:Perl 5.38 Released by cutler on Monday July 03, 2023 @06:47PM (#36579802)
Amazon.co.uk was built in Perl and Booking.com is still a Perl shop.
Re:Perl 5.38 Released by thesuperbigfrog on Tuesday July 04, 2023 @01:00PM (#36589384)
>> Amazon.co.uk was built in Perl

Yes. All of the Amazon retail web sites used Perl Mason running on Apache mod_perl:

https://metacpan.org/pod/Mason

http://www.masonhq.com/htmlmason

Re:Perl 5.38 Released by doctor_eval on Monday July 03, 2023 @05:32AM (#36570691)
IIRC, early Perl was missing little things like named function arguments. So a lot of perl code was really inscrutable. I think “scrutability” is a huge driver of adoption… it’s why HTML and JavaScript became popular - and I reckon it’s why Perl burned out. It’s certainly the reason I never adopted it.

Well, that and CPAN…

Re:Perl 5.38 Released by housecarpenter on Monday July 03, 2023 @11:13AM (#36574055)
> early Perl was missing little things like named function arguments

It's still missing those :)

(To be clear for people unfamiliar with Perl, it probably will never have them, because it doesn't need them. In Perl, all functions effectively have a single parameter of array type. The standard convention is to assign each array entry to a variable at the start of your function definition, and the names of those variables then effectively act as parameter names. But that's just a convention and you can do something else if you want.)

Re:Perl 5.38 Released by cygx on Monday July 03, 2023 @11:40AM (#36574494)
Nowadays, sub signatures can be enabled via

    use feature 'signatures'
which is implied by

    use v5.36
Re:Perl 5.38 Released by elcaro on Wednesday July 05, 2023 @07:50PM (#36608918)
I know cygx already replied, but to be clear, function signatures have been available in Perl since 2015. They were added (as experimental) in 5.20, and are now enabled by default with `use v5.36` or later.

All new features must now go through an experimental phase after the smartmatch debacle. Signatures stayed in experimental status a little longer than most new features due to an unfortunate change with respect the order of function signatures and function prototypes. Provided you weren't using prototypes (which you almost never need) then they've been largely stable since 2015.

Most distro's under current support ship with at least Perl 5.24, so you can use them almost anywhere.

Re:Perl 5.38 Released by cutler on Monday July 03, 2023 @06:49PM (#36579819)
"Unrolling @_" is still a Perl ritual.
Re:Perl 5.38 Released by wlonkly on Tuesday July 04, 2023 @10:51AM (#36587515)
<ok, let's see..>

@_

@_____

@________

<wow, this thing is long>

_____________

<success!>

Re:Perl 5.38 Released by knightcrusader on Monday July 03, 2023 @08:41PM (#36580707)
I wouldn't say its "missing" named function arguments. Treating arguments and return values as lists is very powerful. Perl is very Lisp-like in that aspect.

Also, CPAN is considered one of Perl's strengths. How did CPAN cause Perl to burn out?

Re:Perl 5.38 Released by doctor_eval on Monday July 03, 2023 @11:59PM (#36582067)
In terms of arguments, there's no reason that Perl couldn't have had named arguments and still passed lists around behind the scenes. But the lack of arguments really makes it hard to understand what those arguments are supposed to be. The question is why Perl didn't continue to dominate the scripting landscape and I simply offer this as one possibility.

My recollection of CPAN - and we are talking a really long time ago now - but it was just very much the same kind of dependency hell that we now have with NPM. In fact now that I mention it, I think there are strong comparisons to be made between Node and Perl. CPAN was great until it wasn't, and after a while - in my experience - it was mostly not great.

Re:Perl 5.38 Released by gorgoiler on Monday July 03, 2023 @06:07AM (#36570903)
For me, Perl’s tight syntax let you get a lot of stuff done but lacked the consistency of simpler, more verbose languages better suited to multiplayer teams.
Re:Perl 5.38 Released by xupybd on Monday July 03, 2023 @06:10AM (#36570917)
One possible factor is the cost of backwards compatibility.
Re:Perl 5.38 Released by lmm on Monday July 03, 2023 @07:06AM (#36571287)
It was always easy to write unmaintainable code in. As time went by other languages caught up with the things Perl did well (dependency management with a large base of libraries available, automated tests that you could have confidence in because they ran by default as part of installing any package, lightweight syntax that makes easy things easy, easy to make available in a shared hosting environment), whereas Perl's biggest problem was inconsistency which was essentially impossible to fix (except with a big rewrite of the whole language, which they did try, but...).
Re:Perl 5.38 Released by autoexec on Tuesday July 04, 2023 @01:34AM (#36582584)
> As time went by other languages caught up with the things Perl did well

except regex handling which is still somehow way more awkward in other languages.

Re:Perl 5.38 Released by pravus on Monday July 03, 2023 @07:07AM (#36571295)
From my perspective (over a decade of Perl programming now doing Go):

  * It has no concurrency primitives that are anywhere close to other popular languages
  * Tooling is good and works but is archaic, slow, and cumbersome
  * The community hasn't positioned itself to be anything other than lightweight backend services and small webapps (smaller than rails)
  * The community isn't really all that inviting or fun to be around
Basically Perl offers me nothing that Go doesn't. I'm just as fast in Go as Perl and it's much easier to get stuff done. It's sad because it has some really good features that I miss but I just rewrote a final project from Perl to Go and am never looking back.
Re:Perl 5.38 Released by mst on Monday July 03, 2023 @08:13AM (#36571809)
> It has no concurrency primitives that are anywhere close to other popular languages

I can switch between writing async/await based $other_language and

  use Mojo::Base -signatures, -async_await;
for my p3rl.org/Mojolicious code and keep all the same concurrency based patterns just fine. Trivial example of the sort of code I can write given that 'use' line:

  async sub url_body ($self, $url) {
    my $tx = await $self->ua->get($url);
    return $tx->res->body;
  }
It's fair enough if you prefer go's lightweight threading plus channels CSP model but async/await is IMO a perfectly reasonable approach.

(the -async_await feature flag is powered by p3rl.org/Future::AsyncAwait which works fine with p3rl.org/Future and p3rl.org/Future::Utils as well as p3rl.org/Mojo::Promise in a single process - and since p3rl.org/Mojo::IOLoop and p3rl.org/IO::Async will share an event loop I often find myself using things based on both since it's all await-able)

p3rl.org/App::cpanminus plus p3rl.org/Carton (or my p3rl.org/App::plx) doesn't tend to be archaic or cumbersome to me (classic CPAN.pm, sure, but since cpanminus and plx are both distributed as p3rl.org/App::FatPacker bundled script s via github you can bootstrap them without ever loading CPAN.pm) - I generally find it less of an aggravation to deal with than most other languages' approaches (go's isn't bad at all, but e.g. virtualenv is very much not my cup of tea).

As for slow, the main thing that makes installation from CPAN slower is that our tooling tends to run tests by default - I'm aware that these days "verifying your dependencies actually work at install time" has gone out of fashion in favour of faster installs, but if you're happy with that trade-off pretty much everything has a 'notest' flag available.

Re:Perl 5.38 Released by pravus on Monday July 03, 2023 @08:36AM (#36572031)
Yay, more bolt-ons. Like I said, I left all this behind.
Re:Perl 5.38 Released by mst on Wednesday July 05, 2023 @11:03AM (#36601405)
Far too late to edit now but I'd note that Future::AsyncAwait is implemented using only public APIs - it adds the keywords using the pluggable keyword API that was added in 5.14 and 5.16 (though while code written against the 5.14 version continues to work AFAIK given we're on verion 38 of perl5 now I wouldn't bother even looking at it except out of historical curiosity).

So, basically, adding new keywords to perl via CPAN is a first class citizen and has been for over a decade now and we've gotten pretty good at it in that time (see also http://p3rl.org/Object::Pad - which has acted as a proving ground for a lot of the ideas that have gone into Cor - for another good example) and while I wouldn't at all object to F::AA eventually migrating into being a core feature, from a user POV it would just mean a slightly different 'use' line and maybe a few percentage points' speedup.

As such, I personally believe that while I understand that some environments have unfortunate issues with having dependencies, every other reason I've heard articulated for treating a keyword module as an inferior bolt-on as compared to a core keyword has proven unsupported in actual use.

Generally I code to (a) core perl only, mostly for one-liners embedded in shell scripts and occasionally for really small stuff, (b) pure perl dependencies only so I can easily deploy a single file with App::FatPacker or no file at all with Object::Remote, and (c) this project is best done using XS stuff and I'm willing to accept the trade-offs.

I'd note that Future::AsyncAwait itself sits in an interesting middle-ground because with a little help from my http://p3rl.org/Babble source transformer (needs more documentation though the current release manager has improved a lot of things over the 'just enough to do what I needed at the time' I originally released) I wrote http://p3rl.org/PerlX::AsyncAwait which rewrites most F::AA using code successfully to pure perl for fatpacking, at the cost of you ending up with an implementation that's mildly bizarre at first look and will be substantially slower on microbenchmarks.

(I say 'most' because I presume there's at least one bug and I'm certain that F::AA has added support for additional perl syntax constructs since that I've not gotten around to going back and adding yet, but so far in the situations where I want a fatpacked async/await using script badly enough PerlX::AsyncAwait has worked well -enough- overall that I've yet to feel the need to give it an overhaul even if I'm happy to admit it would probably benefit from one)

Re:Perl 5.38 Released by cutler on Monday July 03, 2023 @06:51PM (#36579843)
Comparing Go to Perl is apples to oranges.
Re:Perl 5.38 Released by krylon on Monday July 03, 2023 @09:04AM (#36572315)
I got the impression back then that Ruby on Rails ate a lot of Perl's use cases. And the Perl 6 thing probably didn't help either. And it might have acquired a bad reputation due to the fact you can easily write really terrible code in it.
Re:Perl 5.38 Released by wazoox on Monday July 03, 2023 @10:36AM (#36573515)
I've made a presentation about it in 2013[1]. Back in 2000, when Perl was riding high and 13 year old, Larry Wall announced "Perl 6". However Perl6 (now Raku) was hugely ambitious and not production-ready until 2015 ...

So for the best part of the naughties, people said things such as "don't bother learning Perl 5, Perl6 is coming"... Then the 2010s came and people got on the RoR and PHP and Python trains in the meanwhile instead.

https://www.slideshare.net/eflorac/perl-presentation-2013-pa...

Re:Perl 5.38 Released by cygx on Monday July 03, 2023 @11:50AM (#36574646)
Back in 2000, when Perl was riding high and 13 year old, Larry Wall announced "Perl 6".

Rinding high is something of an overstatement: The Big Thing at the time was Java, and PHP was already chewing away at Perl's market share. Some people thought the writing was an the wall, hence the mug-throwing incident that launched the Perl6 effort...