A few days ago I pushed to GitHub a sample web application written in the MVC style with Dancer2 and DBIx::Class. In this very first post about it, I'd like to highlight
how a route block that processes and validates form data can be made short and neat with the help of HTML::FormHandler.
Consider this HTML form from the application which creates a new user:
Rotor. The word makes a mechanic think about brakes, an electrical engineer about motors, and a fan of Red Letter Media YouTube channel about poorly executed films. But to a Perl 6 programmer,
.rotor is a powerful tool for list operations.
Break up into chunks
At its simplest,
.rotor takes an integer and breaks up a list into sublists with that many elements:
say <a b c d e f g h>.rotor: 3
>>>OUTPUT: ((a b c) (d e f))
We have a list of 8 elements, we called
.rotor on it with argument
3 and we received two Lists, with 3 elements each. The last two elements of the original list we
not included, because they don't make up a complete, 3-element list. That can be rectified, however, using
:partial named argument set to
Social Media Meta Tags
Social media meta tags are HTML tags that allow you to make the most out of the content you share from a URL. You can determine what information is displayed from a post in Twitter, Facebook, LinkedIn, Pinterest and beyond. It gives developers control over the experience their content produces, as it shows up on these social networks.
I recently had to do some quick search/replace on a bundle of Windows XML files. They are all encoded as UTF-16LE, with the Windows \n\r line endings encoded as 0D 00 0A 00.
Perl can handle UTF-16LE just fine, and it handles CRLF endings on windows out-of-the-box, but the problem is that the default CRLF translation happens too close to the filehandle- on the wrong side of the Unicode translation. The fix is to use the PerlIO layers :raw:encoding(UTF-16LE):crlf - the ":raw" prevents the default CRLF translation from happening at the byte level, the UTF section translates between characters and the encoded bytes, and the final ":crlf" handles the line endings at the encoded-as-UTF16 level.
Knowing that is half the battle. The other half is applying those layers. This was a one-time, quick-and-dirty command-line edit, along these lines:
perl -pi.bak -e "s/old-dir/new-dir/gi" file1.xml file2.xml file3.xml
No, this is not about holy war ! I do respect other tools (-: , really
But rambling on stackoverflow I found quite interesting question about web tests automation. The author started using curl for quite simple test automation task and then changed to selenium web driver, the reason was quite obvious - curl has request oriented design which make it hard to use it when making complicated, sequential requests in a whole test story.
But curl is still cool stuff to get rid of , but you don't have to ... if you use swat PLUS curl.
So here is my answer ...
EDIT: Just a note for PAUSE admins, as some emailed me, any module listed on this post can be given away to anyone who wishes to take it, without any need to ask me first. I do not wish to retain a co-maint either, so please just go ahead and transfer the ownership :) Thanks!
Today's Thursday, and if you regularly read blogs.perl.org, you know today is the first day of my plan to combat bit rot.
Happy Bit Rot Thursday, everyone!
The first step I'm undertaking is reducing the number of projects under my wing by means of deleting them entirely or putting them up for adoption. In total, there are about 107 modules I made adoptable, although some of them are a bundle deal.
Occasionally, the need to write a web service client comes about. For example, when the decision gets made to move away from a piece of software that you run in-house to a suite of hosted apps.
The hosted apps offer RESTful APIs for communication that you will need to use to transfer your data. Let's pretend that there isn't yet a Perl client implementation to fit our needs. So, the first thing that needs to be done is to write a client for these web services (using Mojolicious) to handle the few API methods you'll need.
You end up with an overly simplified client library that might look like this:
Perl 5 has become pretty stable, but there is always room for small
improvements. I would like to discuss yet another "missing" operator.
Its purpose is to make expressions handle some edge cases more gracefully.
It could render some other extensions that have been suggested before