@bbatsov #Perl is alive and well. :D

Just noticed that #Perl got a new cool (somewhat official) logo https://perladvent.org/2024/2024-12-23.html

I haven't used it in ages and I'm guessing it's mostly dead these days, but it was one of the first languages that got me really passionate about programming and it will always have a special place in my heart.

My take on IO bound thread performance in #Perl and #Python.

@zimzat
I can't imagine OCR having that problem with #perl

@ramuuns

😪 Tired: “Perl, aka write-only code”, “Perl is write-only language”, et al.

🤓 Wired: I can produce write-only code in any language, not just #Perl 😅 However I choose not to 🤷­ Because best case I have to read it again, and worst case my employers and customers know where I live 🙃

🚀 Inspired: Maintaining an inherited large #opensource Perl project with 120+ contributors since 12 years, and intending to continue for the next 12 years too.

@nedbat
Deciphering the #perl code I wrote last week is one of my favorite things to do

seeing languages like #javascript and #php have complicated problems with type comparisons makes me think that perhaps #perl got it right by having one set of operators for numeric comparison (<,==,>,<=> etc.) and another for string comparison (lt,eq,gt,cmp etc.)

@alexander_schoch “At first glance, #Perl looks like PHP and bash had a child, which is not something I’d expect in a #programming language.”

What if I told you it was the other way around?

- Perl dates back a full two years before #Bash, originating as a better text manipulation option than #Unix commands while still looking familiar to #shell scripters
- #PHP dates from the mid 1990s, when it was heavily inspired by Perl, though with much more inconsistent syntax

For 2024, I solved Advent of Code in 25 different languages. Was a fun project, sometimes a bit (very) painful (*glances at Erlang and Zig*).

Code (bottom of post) and summary for each language:
https://blog.aschoch.ch/posts/aoc-2024

Keep in mind that I used most of these language for a few hours tops, so my judgement is very much subjective.

What's your favourite of the bunch?

You triggered one of my pet peeves, so here's how I built and installed AnyEvent::Discord on a new Debian 12 (stable, bookworm) virtual machine from scratch.

I start by installing the packages you listed:

sudo apt install libmodern-perl-perl libanyevent-irc-perl \
  libfile-slurper-perl libmojo-sqlite-perl libmojolicious-perl \
  libdatetime-perl libkeyword-simple-perl libtest-fatal-perl \
  libtest-requires-perl libdevel-callparser-perl libtrue-perl \
  libperlx-define-perl libperlx-assert-perl \
  libmoox-late-perl libmoose-perl liblexical-accessor-perl \
  libnamespace-sweep-perl libreturn-type-perl libmatch-simple-perl \
  gcc-aarch64-linux-gnu dh-make-perl

and then I also install these packages that I found were needed, and packaged in Debian, along the way:

sudo apt install perl-xs-dev libmoosex-mungehas-perl \
  libclass-tiny-antlers-perl libmoosex-types-common-perl \
  libtypes-xsd-lite-perl libtest-warnings-perl \
  libanyevent-websocket-client-perl

Whenever I can't find a Debian package of the Perl library I need, I do dh-make-perl --cpan Library, debuild, and then sudo apt install ./library.deb - when a dependency is missing, I branch out and make/build/install that first.

First dependency missing is Moops:

dh-make-perl --cpan Moops
cd libmoops-perl/
debuild

Ok, Parse::Keyword is missing, so build that and install it:

cd ..
dh-make-perl --cpan Parse::Keyword
cd libparse-keyword-perl/
debuild
cd ..
sudo apt install ./libparse-keyword-perl_0.10-1_amd64.deb

Now Kavorka is missing, so build and install:

dh-make-perl --cpan Kavorka
cd libkavorka-perl
debuild
cd ..
sudo apt install ./libkavorka-perl_0.039-1_all.deb

Finally we can build Moops and install it:

cd libmoops-perl
debuild
cd ..
sudo apt install ./libmoops-perl_0.038-1_all.deb

Trying debuild in AnyEvent::Discord again, we are now missing Algorithm::Backoff::Exponential, so build that:

dh-make-perl --cpan Algorithm::Backoff::Exponential
cd libalgorithm-backoff-exponential
debuild

ah, it depends on Test::Number::Delta, so build that and install it:

cd ..
dh-make-perl --cpan Test::Number::Delta
cd libtest-number-delta/
debuild
cd ..
sudo apt install ./libtest-number-delta-perl_1.06-1_all.deb

so now we can build and install Algorithm::Backoff:Exponential:

cd libalgorithm-backoff-exponential/
debuild
cd ..
sudo apt install ./libalgorithm-backoff-perl_0.010-1_all.deb

and finally we can build and install AnyEvent::Discord:

cd libanyevent-discord/
debuild
cd ..
sudo apt install ./libanyevent-discord-perl_0.7-1_all.deb

Let's try:

asjo@debian:~$ perl -E 'use AnyEvent::Discord; say $AnyEvent::Discord::VERSION'
0.7
asjo@debian:~$ 

It's a little bit tedious, but if you maintain your own local Debian package repository (I use reprepro) it's quite manageble, and you get security updates automatically from Debian for Perl, and all the packages you didn't build yourself, automatically.

On the new laptop, I tried to build a module of mine that had all the dependencies in Debian packages except for one. Hey, dh-make-perl does this, right?

Well, kind of. Here's how far I got before I gave up with AnyEvent::Discord. Imagine an attempt to build stuff for every two or three items. And now more than an hour later I'm just angry and unhappy and have nothing to show for it except for this lousy post.

This is why the next time I want something built I will start with Perlbrew, installing Perl from scratch, into my home directory.

#Perl

sudo apt install libmodern-perl-perl libanyevent-irc-perl \
  libfile-slurper-perl libmojo-sqlite-perl libmojolicious-perl \
  libdatetime-perl libkeyword-simple-perl libtest-fatal-perl \
  libtest-requires-perl libdevel-callparser-perl libtrue-perl \
  libperlx-define-perl libperlx-assert-perl \
  libmoox-late-perl libmoose-perl liblexical-accessor-perl \
  libnamespace-sweep-perl libreturn-type-perl libmatch-simple-perl \
  gcc-aarch64-linux-gnu dh-make-perl
dh-make-perl --build --cpan Parse::Keyword
sudo dpkg -i libparse-keyword-perl_0.10-1_arm64.deb
dh-make-perl --build --cpan Kavorka
sudo dpkg -i libkavorka-perl_0.039-1_all.deb
dh-make-perl --build --cpan Moops
# fuck this shit
dh-make-perl --build --cpan AnyEvent::Discord
sudo dpkg -i libanyevent-discord-perl*

@gosha A quote from the book that I think you'll like, @ChristosArgyrop :

"If lisp is the result of taking syntax away, Perl is the result of taking syntax all the way." [p.342]
#lisp #perl

Perl camel.

@rmloveland I really like @oalders’s new logo too! Sorry, @kraih, I think your #Perl5 raptor is out.

/ @perl

I like the proposal for a new #perl logo!

I need #perl help for a minute. I have files in /tmp/ of the pattern "poster-123456.jpg" where 123456 is a random number of digits.

I want to remove all those files older than one hour.

Does this short routine do it (safely)?

sub removeOldPosters
{
my $keep_as_of = time - 3600 ;

my @old_files = (
grep{ !-d
&& /poster-[\d]+\.jpg$/i
&& ( stat( $_ ) )[9] < $keep_as_of
}
glob( "/tmp/*" )
);

unlink @old_files;
}
@tewha

#Perl @PerlWChallenge 296 Task 1: String Compression
#noxp
```
perl -E '
for(@ARGV){$x=$_; $x=~s/(.)(\1+)/$1.(1+length $2)/ge; say "$_ -> $x"}
' abbc aaabccc abcc
```

@tychotithonus @philsplace I do it in #Perl as well. In #BBEdit, this is my current open documents list. ONE python script cos #Plex tools are few and far between...and that build.sh? That's to build FFMPEG and associated libraries. The rest? Perl. 🤷‍♂️

Also, please don't criticize my naming convention(s). I don't have one...😂

When I want something to keep working ... I write it in Perl.

Legible¹, modern, simple ... Perl.

Every other language is a never-ending hellscape of "stop thinking about the problem because you're making me think about the tool instead".

I do not have time to constantly refresh my mental-model cache of ten layers of your platform's installation abstractions.

I do not have time to perpetually chase a sliding window of backwards incompatibility, nested dependencies, inscrutable errors, curl|sudo bash-isms, and dead-end / WONTFIX help threads.

I do not have time to PR your GitHub README to supply the seven implied assumptions missing from your "quick start".

I have work to do.

#Perl

¹Yes, you can do that. Damian Conway's "Perl Best Practices" is definitive.

Happy new year, #CPAN! 🎂

The Comprehensive #Perl Archive Network, CPAN, has been online publicly since 1995-10-26. By now it hosts over 250,000 modules in 40,000+ distributions by 6,700+ authors.

I publish solutions there since 2014, and I intend to continue for at least another decade.

Join the occasion by registering your account, upload your first module, or release a new version of your existing distribution!

How do you celebrate this year?

So I wrote a #Mojolicious #perl fortune telling tarot card app that uses openai to interpret the card spreads. I myself don't care about fortune telling at all, but I want to find someone who does and knows about Tarot, to beta test. Anyone know of anyone? 😅

2/
So first, I was like, ok fine i dont have time for this, but i spent a few days shaving other yaks and i come back to this problem, i need some visibility on this layer. yeah, i could turn it on globally for the db, but i want to target just my activity, in a test. So I decide to dive in. I’m not super experienced with the #perl #debugger but i should be able to figure this out.

(1/*) So, I’m working in an older #perl codebase. There’s a small home-rolled ORM using #DBI -- not fancy. I wanted to start understanding the data model, so I went looking for a logging module, found https://metacpan.org/pod/DBI::Log and inserted that into a test script i’m writing. And…
```
$ perl test.pl
-- Wed Oct 13 13:36:21 2024
-- /home/pyrrhlin/repo/path/DB.pm 160
SET NAMES 'utf8'

Segmentation fault (core dumped)
```

#fossangel's favorite brand