use strict;
use warnings;
use experimental 'smartmatch';
use Data::Dumper;
use JSON::XS;
use LWP::UserAgent;
use HTTP::Request;
my $json = JSON::XS->new->utf8->allow_nonref;
my $request = HTTP::Request->new(GET => 'https://rdrama.net/marsey_list.json');
my $ua = LWP::UserAgent->new;
$ua->agent("Mozillacels stay losing");
my $response = $ua->request($request);
die "Failed to fetch" unless defined $response;
sub contents_to_file($$)
{
my ($filename, $content) = @_;
open(my $fh, '>', $filename) or die "Couldn't open file $filename: $!";
print $fh $$content;
close $fh;
}
# Get emojis
my $emojos = $json->decode($response->content);
my %pack = (
'files' => {},
# empty?
pack => {},
files_count => 0,
);
# Case sensitive: 'Marsey', 'Misc', 'Wojak', 'Classic', 'Tay', 'Wolf', 'Marsey Alphabet', 'Platy', 'Marsey Flags', 'Rage', 'Flags', 'Sets'
my @categories = ('Marsey');
foreach my $emojo (@{$emojos})
{
if ($emojo->{class} ~~ @categories)
{
$pack{'files'}->{$emojo->{name}} = $emojo->{name} . '.webp';
}
}
$pack{files_count} = keys %{$pack{files}};
my $output = $json->encode(\%pack);
# Write content to file
contents_to_file 'pack.json', \$output;
I wrote it because I setup an Apache Reverse Proxy where I created a "fake" emoji-pack, where all the requests where Pleroma expects them just redirect to /e/{emojiname}.webp here
Just felt like sharing, incase any of you want to read Perl
It allows me to steal emojis here without manually submitting them all like I was before.
Jump in the discussion.
No email address required.
Jump in the discussion.
No email address required.
More options
Context
The '90s never ends.
Jump in the discussion.
No email address required.
More options
Context
can you rewrite it in Rust?
Jump in the discussion.
No email address required.
More options
Context
Seeing perl code bring in a JSON library is something, like a boomer riding a skateboard
Jump in the discussion.
No email address required.
You've clearly never written json using C, writing in Perl feels super nice, like it's done in Python
Jump in the discussion.
No email address required.
More options
Context
More options
Context
I’m sorry I don’t speak webshit
Jump in the discussion.
No email address required.
Perl isn't webshit r-slur, it's not even the shit of the web that makes it shit
Jump in the discussion.
No email address required.
Jump in the discussion.
No email address required.
More options
Context
More options
Context
More options
Context
Jump in the discussion.
No email address required.
Perl OOP is a cheesy hack based on a concept of "Blessings" (object properties), ->new is a function that takes no args, it's just a general standard
the
->
actually means to call generalizednew
subroutine (function), as in, it's just a function callednew
but the -> makes the first argument of the subroutine the actual name of the data type (if blessed).It's a shitty concept (funny concept, but still kinda weird) although I barely write OOP in Perl at all and I haven't worked in this language much so I may be wrong, but it sure is quirky
History fact: the term "blessed" is indeed as funny as it is, it basically "blesses" (gives blessings to, makes it stand out, i.e) a regular datatype (perl hash in 99% of cases since its similar in design to OOP) with special properties.
Jump in the discussion.
No email address required.
More options
Context
More options
Context
perl my balls lmao
Jump in the discussion.
No email address required.
More options
Context
why are people calling this "gay"? as a white man, this proud tradition is part of my heritage. the buck breakers are no different to the pionnering men who tamed a horse for the first time, or built a bridge across a raging current. these are the stories of how we overcame nature, and while outdated to some, they are part of a proud history of conquering the wild which allowed us to have all the modern amenities we have today. buck breaking is a complex and beautiful tradition and im happy to say my ancestors broke bucks.
Jump in the discussion.
No email address required.
Perl is actually very anti-biboc
https://arstechnica.com/gadgets/2021/08/the-perl-foundation-is-fragmenting-over-code-of-conduct-enforcement/
Jump in the discussion.
No email address required.
More options
Context
More options
Context
Is there any market for perl devs? I've had to learn it to maintain ancient backend scripts and don't mind it that much but for some reason it seems to make s absolutely assblasted. Deciphering old boomer runes nobody else wants to touch doesn't seem like the worst job in the world to me.
Jump in the discussion.
No email address required.
There still are in some places but you'll probably be maintaining an ancient backend nobody cares about while all the new devs are using le NodeJS angular kubernetes React.js ULTRA Cloud service AWS biboc race Rust libc coreutils Microsoft AWS Linux
Jump in the discussion.
No email address required.
More options
Context
More options
Context