News for hackers. Stuff that matters.
Re:Actually Portable Perl by jb1991 on Thursday December 15, 2022 @05:31AM (#33997561)
Perl is really one of the best languages and in modern times is underrated. I've been using it in production for most of my critical services since about 2012. I've used many other languages since then but always keep coming back to perl. It's a true gem of a language.
Re:Actually Portable Perl by G3rn0ti on Thursday December 15, 2022 @05:44AM (#33997623)
It's grand child, Raku, also seems to be an impressive language actually. Hated by Perlers and non-Perlers alike, it actually would be a great environment to build powerful programs in:

https://www.oreilly.com/library/view/learning-perl-6/9781491...

Re:Actually Portable Perl by lizmat on Thursday December 15, 2022 @06:05AM (#33997774)
Re:Actually Portable Perl by kamaal on Thursday December 15, 2022 @07:30AM (#33998476)
>>Hated by Perlers and non-Perlers alike

Wrong. Perlers still cheer for it.

But for some reasons it hasn't wide spread adoption yet. We hope to use it some day in production.

Re:Actually Portable Perl by counterpartyrsk on Thursday December 15, 2022 @08:29AM (#33999198)
For me the the distain for Raku stems from comments like yours. Did you notice this isn't a Raku thread?

I had to block a Raku enthusiast on twitter because they chime in on literally every Perl tweet in my timeline with a "Raku too" comment, or "here's the Raku syntax"... News flash, nobody asked, or cares.

The sad part is you already know nobody cares, yet like King Solomon's ruling over the two mothers who both claimed the child as their own, you are the mother who would have the baby die to spite the other. If Raku can't win, Perl shouldn't either.

If this wasn't the case, you Raku'ers would just creat your own accounts and be happy in your own community and echo chamber, just as we once were.

Re:Actually Portable Perl by G3rn0ti on Thursday December 15, 2022 @08:39AM (#33999308)
That's what I meant when I said Perlers hate Rakuans. It's an intersting example of "The People's Front of Judea" vs. "The Judean People's Front".

I hope you gain inner peace one day again.

Re:Actually Portable Perl by spijdar on Thursday December 15, 2022 @08:42AM (#33999341)
This is a pretty remarkably bitter and uncharitable take, given that Raku is the original intended successor of Perl, created by Perl's author, and sharing a lot of the "spirit" of Perl.

That ship sailed, I won't argue it, and I'm not personally invested in either "camp", but in a thread saying "Hey, Perl is actually a pretty cool language!", I think a short mention of Raku isn't worth this reaction.

Re:Actually Portable Perl by 0x445442 on Thursday December 15, 2022 @10:30AM (#34001015)
Yeah I wish Raku would pick up some steam. It’s the only newish language I’ve looked at that’s made me say wow and it cleans up some of the thorny Perl5 sigil issues.
Re:Actually Portable Perl by yamtaddle on Thursday December 15, 2022 @11:54AM (#34002311)
I always liked the sigils :-)

When I was first learning to program and picked up Perl 5 (I was interested in Web programming, so... that was the thing to learn at the time) and then later read some books (yes, kids, we used to read books) on Java and C++, I wondered how the hell anyone could make sense of them. And hacking up early Javascript snippets (you know, for image rollovers, the only thing anyone used it for for the first few years) was so painful. It's just words! There's nothing to indicate what anything is! The examples in the books were so hard to read.

The answer, of course, was "they use syntax highlighting", but I'd not made that discovery yet.

Re:Actually Portable Perl by 0x445442 on Thursday December 15, 2022 @08:29PM (#34008358)
Oh Sigils aren’t bad. It’s just they’re more consistent in Raku, particularly with regard to arrays and hashes.
Re:Actually Portable Perl by justinator on Thursday December 15, 2022 @01:48PM (#34003840)
I don't think anyone hates it, but there were many people who were looking for a solid release that ran fast-enough. There was also... drama, which I feel no one cares for.
Re:Actually Portable Perl by weare138 on Thursday December 15, 2022 @04:02PM (#34005724)
I messed around with Raku and it is seriously underrated. If anyone hasn't yet I would recommend giving it a try. It still does all the cool stuff Perl 5 can do but with the features you would expect from a modern language baked in. Raku and the core modules are solid and can be used in production but unfortunately the overall ecosystem is still struggling. 3rd party modules can be hit or miss. I found several of them weren't well maintained or seemed abandoned.
Re:Actually Portable Perl by zaidhaan on Thursday December 15, 2022 @06:04AM (#33997766)
What do you typically use perl for? I thought it was most commonly used for scripting and running cgi scripts. I find bash to be much more readable and tend to use it or python for most of my scripts
Re:Actually Portable Perl by G3rn0ti on Thursday December 15, 2022 @06:47AM (#33998105)
> I find bash to be much more readable

Lol, you find bash readable? With all its weird ad-hoc constructs? I don’t pretend Perl looks pretty but at least its constructs seem to be consciously designed and do not look bolted on.

At my work place we still maintain a huge web application written in Perl 5. Most of the time if we are in trouble it‘s due to bad architectural designs that are not specific to Perl as a language or ecosystem. Only rarely I stumble over issues like implicit returns, or context sensitive sub routines. Also I hate Perl 5 allowing circular includes. The worst offenders among in-house modules are Perl modules written in a Java-esque style which mostly would have benefitted well from using native Perl features instead of trying to mimick Java programs.

Re:Actually Portable Perl by gl-prod on Thursday December 15, 2022 @07:04AM (#33998235)
What does Perl do in the web app?
Re:Actually Portable Perl by G3rn0ti on Thursday December 15, 2022 @07:16AM (#33998348)
Everything basically: Generating HTML, serving AJAX requests, communicating with other services, processing files, running DB queries etc etc. It even has a (questionable) feature embedding LuaScript using Lua::Inline and, hence, allows our clients to write little Lua scripts against our Perl API. Our application continuously runs over 20 years already and its user base kept growing ever since.

When I arrived I tried to move as much of the front end logic to JS but the backend remained in Perl as most business logic still lives there (and not in the DB). These days we try to implement new features in separate JS or TypeScript services and SPAs that, however, communicate with our REST API that is implemented in Perl/Mojolicious. This way we can hire cheaper JS devs (that never learned Perl) and people can still enjoy React and modern frameworks if they so wish. The most talented ones I try to sucker into little refactoring projects in Perl. Most JS developers that tried got fluent in Perl 5 only after a couple of weeks.

In the future we will try to move more business logic of the "Kernel" into the DB system since Postgres grew much more powerful compared to the time back when the application was invented. I believe this will be our only hope to actually shrink our Perl 5 code base eventually.

Re:Actually Portable Perl by gl-prod on Thursday December 15, 2022 @07:44AM (#33998643)
I thought it was just running some scripts. But that's interesting. Are there any performance differences between TS services and Perl ones?

What about develop time? how long does it take to deploy a feature?

Re:Actually Portable Perl by G3rn0ti on Thursday December 15, 2022 @08:32AM (#33999228)
Well, the heavy lifting is usually done by the Perl backend. So you cannot directly compare the performance between Perl and JS/TS services in this case. From my web dev experience so far I believe the language's execution environment rarely matters at all unless you're doing something stupid. That's because most webapps wait for their DB most of the time anyway. Native compilation like in golang or rust does not pay off unless you're writing a streaming service delivering videos.
Re:Actually Portable Perl by petre on Thursday December 15, 2022 @08:19AM (#33999070)
Adding new features to a Mojolicious web service is quite painless, at least compared to CGI, Mason and other Perl stuff. Also a lot of code reuse is possible. Now we also have Mojo.js, brought to you by the same authors. It's basically the Perl framework with the same name rewritten in TypeScript.

https://mojojs.org/

Re:Actually Portable Perl by gl-prod on Thursday December 15, 2022 @08:32AM (#33999235)
Yeah I started to play with mojojs after your comment. Looks cool, thanks!
Re:Actually Portable Perl by jerf on Thursday December 15, 2022 @11:21AM (#34001802)
"I thought it was just running some scripts."

Ah, how times change.

Perl was the original practical back-end development language for the web. There's a bit of opinion in that, but not a lot; there's not a lot of other contenders, unless you count writing raw C CGI programs which was never that popular.

Perl performance isn't great, but then I don't consider TS/JS performance all that good either. Perl is a cut below JS nowadays because of the JIT that JS has but it's not impractically slow. If it wasn't impractically slow in literally the late 1990s, when it was powering nearly every dynamic site that existed, it sure isn't today.

Re:Actually Portable Perl by yamtaddle on Thursday December 15, 2022 @12:03PM (#34002459)
I think you'll find that most older, popular (or once-popular) languages perform better than you might think. Perl couldn't perform too badly or it'd have been unusable on 1990s hardware. Early webservers often had single cores clocked at sub-100Mhz, mid-tens megabytes of memory, and tiny, spinning rust hard drives—a bunch of modern web server stacks would struggle to run at all on that hardware, let alone to serve even tens of requests per minute.

Go look up some real-world-(ish) performance benchmarks for various web frameworks if you want a real surprise. You might find it'd be hard to sell any scripting language other than PHP(!!!) for a project, if performance actually matters and for some reason you can't use a compiled language. Don't assume the new thing is better, or faster, even if that's its reputation. It may not be entirely earned.

Re:Actually Portable Perl by freedomben on Thursday December 15, 2022 @11:27AM (#34001872)
>> I find bash to be much more readable

> Lol, you find bash readable?

Note, they didn't say it was readable, just more readable.

Re:Actually Portable Perl by ptspts on Thursday December 15, 2022 @07:02AM (#33998228)
Depending on the task to be solved, a Bash script (using AWK, Coreutils etc.) executes much slower than the correspinding Perl or Python script, and having to run slow scripts often interactively can have a strong negative impact on developer productivity, especially on flow state (of mind).
Re:Actually Portable Perl by bloblaw on Thursday December 15, 2022 @11:44AM (#34002171)
BSD grep vs GNU grep has burned me enough times that when I do anything moderately complex in a bash script, I quickly move to Perl. And since Perl is installed most everywhere (or can be bundled up easily with PAR::Packer), it's an easy decision for me.
Re:Actually Portable Perl by mhd on Thursday December 15, 2022 @07:58AM (#33998819)
The sad thing is that once, a while ago, there was an attempt to compete with the new market of scripting languages (Perl, Tcl) from a shell perspective. The result being Korn Shell, especially ksh93, and tools like dtksh (which allowed Motif UI apps to be written in shell).

Compared to that, bash is really anemic.

Python took Perl's money a bit when it came to scripting, Ruby – clearly influenced a lot by Perl – made big grounds in web apps, once they outgrew CGIs, and of course then we collectively got Javascript Stockholm syndrome.

But seriously, they're all good dogs. We all revel in the Narcicissm of Small Differences, but in the end it wouldn't really matter if we used Perl instead of Python or any other algol-ish imperative OO language with some functional bits.

Re:Actually Portable Perl by lizknope on Thursday December 15, 2022 @11:41AM (#34002126)
I learned Perl in the mid-1990's. I'm in semiconductor design and most of our CAD tools use Tcl so I write a lot of that but for any text report processing or sysadmin type tasks I write in Perl. I've got nothing against Python. I learned enough of it and it is fine. If I was writing larger systems I would probably use Python.
Re:Actually Portable Perl by no_wizard on Thursday December 15, 2022 @12:06PM (#34002513)
I admit the only time I reach for Perl is when I need a really strong and dependable regex service. Still one of the best ways to parse text to this day. Perl text parsing capabilities are nearly unrivaled still.