Introduction - From Perl to Rust
Many introductions to Rust already exist. Most of them are aimed at C++ programmers. That makes sense, but lots of folks are coming to Rust from other languages now.
My current1 day job is mostly Perl. It occurred to me that an introduction to Rust aimed at people who already know Perl could be useful.
Types in JSON | Choroba | The Perl Conference in Glasgow - Day 1 - 2018
Join us for the first day of TPCiG, in the cPanel Theatre.
Schedule: https://act.perlconference.org/tpc-2018-glasgow/schedule?day=2018-08-15
Live Chat: On IRC at irc.perl.org #yapc
How should we deal with numbers vs strings in JSON? Perl doesn't care!
Cpanel::JSON::XS::Type to the rescue! I'll explain its motivation, show usage and possible traps, describe the implementation, and discuss related problems in other modules.
Thomas Klausner. Deploying Perl Apps using Docker, Gitlab & Kubernetes
PerlCon 2019 Rīga — Day 1 — 7 August 2019
Some time ago we had the glorious idea to deploy our code into the cloud. The Google cloud, to be specific. This means we had to learn Kubernetes (to manage and scale our apps), Docker (to pack the apps into containers), gitlab CI (to automate the deployment process) and a whole lot more.
In this talk I'll explain the basics of Kubernetes, Docker and CI; describe how to make your app code cloud ready; and show you our current deployment pipeline.
Be prepared to see Perl, YAML, bash, Makefiles and other horrors required for smooth sailing in the clouds.
Day 3: Zoopla Theatre: Mark Overmeer - Apache in Pure Perl
From its start, Perl comes with most (Unix) core operating system trickery like forks, events and signals. So, you can implement real performing daemons for interesting tasks.
We will get into various features which show how straight-forward it is to implement an Apache-like webserver, with VirtualHosts, proxies, etc.
But we start by discussing many options how to set-up servers: processes, event-loops, and so on... before we reach to HTTP-servers processing requests.
Any::Daemon
- Use Apache as your front end ~30:00
GitHub - learnbyexample/learn_perl_oneliners: Example based guide for text processing with perl from the command line
Example based guide for text processing with perl from the command line - GitHub - learnbyexample/learn_perl_oneliners: Example based guide for text processing with perl from the command line
Day 23: One-Liners for Fun and Profit
Mojo one-liners are just Perl one-liners. You will use -E (or -e) to write the program. You might use -n to loop over input, or -p to do the same while printing $_ after each item, just like normal one-liners.
To get the extra Mojo goodness, add -Mojo. The name itself is a cute hack. Since -M is what loads a module on the command line, the module name is therefore ojo.
[doc] Is there a way to open FH with :utf8 flag? · Issue #19059 · Perl/perl5 · GitHub
Where IO::Handle Description I did not find how to open file with :utf8 flag.
https://perldoc.perl.org/Encode#UTF-8-vs.-utf8-vs.-UTF8
https://www.effectiveperlprogramming.com/2011/08/know-the-difference-between-utf8-and-utf-8/
Unicode::Tussle - Tom's Unicode Scripts So Life is Easier - metacpan.org
Tom's Unicode Scripts So Life is Easier
Perl Advent Calendar 2022 - Create Professional Slideshows with Mojolicious::Plugin::RevealJS
Santa's elf had a problem. He had to write a presentation very fast and show it to a bunch of new elves. The email assigning this to him was sent by Santa himself. The elf started to look on MetaCPAN and found this module: Mojolicious::Plugin::RevealJS
PDF document creation with Markup languages | PMPERRY [blogs.perl.org]
New, powerful features have recently been added to PDF::Builder and PDF::Table, enabling faster and easier high-level generation of PDF documents. The versions are respectively 3.025 and 1.005, and are available on CPAN.
As well as the ability to "pour" text into a document's defined page areas, and have it flow easily over pages, this new version also enables high level text formatting with markup languages, as well as much-enhanced font management. The markup supports Markdown (via Text::Markdown) and a large (and growing) subset of HTML/CSS, as well as simple paragraphs-only markup, and for the first time can be used to format cells in PDF::Table. This is far from the final version, as many improvements are in the pipeline for this functionality, and are expected to be released over the coming one to two years. These will include, among other things, proper word hyphenation and probably some form of paragraph shaping, such as Knuth-Plass. The full list (at this time) is at https://github.com/PhilterPaper/Perl-PDF-Builder/issues/195 .
Perl Testing in 2023 - DEV Community 👩💻👨💻
With my open source work, I’ve historically taken an approach which relies more on integration... Tagged with perl, tdd, test2suite.
Test2::V0 provides a good base to work with, so we add that to our project’s requirements list straight away.
We’ll round that out with:
Test2::Require::AuthorTesting to skip certain tests when run on the end user’s machine, and require the AUTHOR_TESTING environment variable to run. This is useful for tests which are very slow or require a highly specific environment to run in.
Test2::Require::Module to skip certain tests when optional modules are unavailable.
Test2::Tools::Spec to better structure our unit tests.
Test2::Plugin::BailOnFail for when your tests simply cannot carry on. Use sparingly.
Announcing Date::Parse::Modern
I'm a big fan of PHP's strtotime() so I wanted that same functionality in Perl. If you have a date/time string and need a unixtime, then strtotime() is the way to go.
I just released the first public version of Date::Parse::Modern, which is a modern replacement for Date::Parse. Not only does it support more formats than Date::Parse, it's also significantly faster.
In a perfect world this functionality (strtotime) should be in Time::Piece. It's very common in my work flow to read a log file and need to parse the date/time part of the line to a Unixtime.
Perl Advent Calendar 2022 - The Christmas Time Machine
use Feature::Compat::Try;
try {
deliver();
} catch($e) {
print "Failed to deliver\n";
}
Perl Advent Calendar 2022 - A Perlmas Tree - pEFL
Nowadays you can create a Christmas tree with perl. There was a wonderful module by Dave Cross in the Perl Advent Calendar 2018. But to find the perfect fitting tree, you have to hack the code. Therefore a GUI is needed. And why not to try the new module pEFL?
pEFL is an object oriented binding to the Enlightenment Foundation Libraries. And even if it is a very young module, the Elementary part (the widget toolkit) is already very usable. But let's see:
But before take a deep dive into pEFL we make a global hash for the settings to SVG::ChristmasTree with nice defaults on top of our code:
Input Validation and Errors — Swagg::Blogg
I used to use the flash() helper in Mojolicious for reporting errors back to the user but recently discovered I can just use Mojolicious:...
Fast perceptual image hashing with Perl - Dimitrios Kechagias
Talk slides, images & code used: https://github.com/dkechag/ImagePHash-Talk
This talk will take you through a novel Perl implementation of perceptual hashes for “similar image” searches. I'll start with the basics, if you don't know what a Discrete Cosine Transform is, you'll find out with a visual demo - no math required (although math is always encouraged!). After DCTs and p-hashing basics, I will go through the implementation’s new features that make it efficient and easy to integrate with our large MySQL-based image database.
At SpareRoom, the world’s largest roommate finding service, we handle tens of millions of images, mostly of customer rooms/properties. When tasked with adding an internal ability for a “similar image” search, I first looked at existing solutions and found out that some did not work as expected, while others were either slow or required changes to our infrastructure (mainly Perl, with the data - including the image index - on a large MySQL database).
In the end, I went with a solution initially based on Image::Hash, but with p-hashes reimplemented to fix collision issues and add speed (over 10x faster than pHash.org’s equivalent DCT-based hash). Then, I added features such as support for mirroring, as well as “index/reduced” hashes, in order to effectively use MySQL indices (and thus easily fit in our existing setup).
After an intro to the theory behind the DCT and perceptual hashes in general, I will discuss the abilites of this implementation and the experiences from developing and using it. The module will be released to CPAN before my talk, although the XS part responsible for the fast DCT calculation has been available for a while as Math::DCT.
What's In That String? | Tom Wyant [blogs.perl.org]
local $Data::Dumper::Useqq = 1;
print Data::Dumper::Dumper( $_ );
$VAR1 = "\30\31\32\e\34\35\36\37 !\"#\$%&'";
$VAR1 = "\30\31\32\e\34\35\36\37 !\"#\$%&\x{100}";
How much is that BLÅHAJ in the (terminal) window?—The Phoenix Trap
Using one line of Perl, you can grab the price and even a picture of IKEA’s iconic cuddly shark toy!
https://phoenixtrap.com/2022/04/12/how-much-is-that-blahaj-in-the-terminal-window/
$ perl -Mojo -E 'say g("https://sik.search.blue.cdtapps.com/us/en/search-result-page", form => {types => "PRODUCT", q => "BLÅHAJ"})->json->{searchResultPage}{products}{main}{items}[0]{product}->@{qw(currencyCode priceNumeral)}'Max Maischein. What I learned about SQL in 2018
PerlCon 2019 Rīga — Day 2 — 8 August 2019
~20:00 - Window functions
~33:45 - CTE
~43:00 - Recursive CTE
This talk shows how to use SQL Window Functions (ISO SQL:2008) and how to use Common Table Expressions (CTE, ISO SQL:1999).
Using these two techniques, you can often avoid munging the query result afterwards. This potentially saves roundtrips between the program and the database.
The presentation assumes an intermediate familiarity with SQL. To get the most of the presentation, youshpuld be familiar with SELECT and JOIN. The Perl level is suitable for the beginner, but there will be very little Perl.