Convert Markdown to HTML
https://perlmaven.com/convert-markdown-to-htmlI have lots of documents written in Markdown format and I was looking for a way to convert them to HTML.
I have lots of documents written in Markdown format and I was looking for a way to convert them to HTML.
My son works at a company where they analyze source code and report on potential data privacy violations. For this they need to parse source code in various programming languages. He mentioned that one day they might need to support Perl too. I thought about the difficulties in parsing Perl and one case came to my mind was the strange implicit return from a function that Perl has.
Then I also thought that Rust also has some strange ideas. BTW Do you know that I have a new web site called Rust Maven where I write about Rust? Now you know.
Anyway, back to Perl:
I recommend always turning warnings on from the beginning of each Perl file.
However sometime we might want to avoid some warnings. We can selectively turn off warnings inside lexical scopes, that is, till the end of the current pair of curly braces.
GitHub Actions is a system provided by GitHub to automate virtually any process you like. Including the possibility to create Continuous Integration (CI) systems for CPAN distributions.
While Perl developers who upload their code to CPAN will greatly benefit from the volunteers behind CPAN Testers setting up a CI system has a number of benefits even for CPAN developers.
In a project creating a Ladino dictionary in which I have a few thousands of YAML files. They used to include lists of values, but a while ago I split them up into individual entries. I did this because the people who are editing them are not used to YAML files and it makes it a lot easier to explain them what to do.
However the previous change left me with 1-item lists in each file. I wanted to clean that up.
At a client we have a networked disk with millions of files. I was trying to list the first few files to see what's going on.
ls -l | head takes ages, but here is a Perl one-liner to make it work:
Perl has several modules on several levels of abstraction to interact with web sites using HTTP requests. One of the nice modules is WWW::Mechanize that is built on top of LWP::UserAgent. In this example we'll see how to set the header in the HTTP request using WWW::Mechanize.
We'll use the service provided by the httpbin.org web site to see the headers we set.
It has many end-points. We use the one that will send back the header the client sent as its content. It makes it very easy to see what was in our header.
There are several modules on CPAN that help your read an Excel file. In this article we'll look at handling dates that are in Excel files.
The CPAN Digger provides a list of recently uploaded Perl modules and indicates, among several other things, if they have some kind of a Continuous Integration configured. That's how I arrived to App::Puppet::Environment::Updater and it took me quite some time till I noticed that it has GitHub Action configured, but not in the default branch.
Part of the Dancer2 video course.