Read this article on zakame.net/blog
A bit overdue post, but I attended this months's Perl 6 Community Bug Squashathon last weekend and it was fun! I had a great time learning some more Perl 6 while making contributions at the same time. Definitely looking forward to next month's!
Here are a few little bits of Things I've Learned...
Just a follow-up to Stevan Little's On porting a Moose module (thanks Stevan, BTW for this software! :) I read Damien Krotkine's p5-mop: a gentle introduction yesterday, so I took p5-mop out for a spin and started porting my Hashids module to it; Hashids itself is a port of the JavaScript hashids.js library from Ivan Akimov, and…
Following up to szabgab's blogpost: a couple of years ago, I called out for people interested in getting together to make a new Perl group here in my country, the Philippines. I saw that there were already some registered Perl mongers groups in pm.org for Makati, Manila, and elsewhere, but all of their websites, and even the contact persons listed form, were simply inactive or unreachable. There were a few people responding to my…
Fast forward to mid 2013. I last wrote about some checksum one-liner, and it was also pretty much among the last few Perl things I did that year before getting distracted by $WORK (again.)
Now is the time to change that ;)
Lately I wanted to compute CRC-32 checksums for some videos. At first, I took a look at Digest::CRC and wrote this one-liner:
perl -MDigest::CRC=crc32_hex -E 'say crc32_hex <>' file.mkv
But of course that didn't work, since I was only reading a line off the first file in @ARGV. Realizing I need to read in the file, I added IO::All in the mix:
perl -MDigest::CRC=crc32_hex -MIO::All -E 'say crc32_hex io($ARGV[0])->all' file.mkv
That worked, but it was too slow since it read files into a string, and I was dealing with large (~1GB) file sizes. After a bit of looking around, I found the Digest::file module, so my one-liner finally becomes:
perl -MDigest::file=digest_file_hex -E 'say "$_ cksum: \U@{[digest_file_hex $_, q|CRC-32|]}\E" for @ARGV' file1.mkv file2.mkv files*.avi
Of course, I could have gotten something like cfv or cksfv from my Ubuntu repository, but curiosity got the better of me ;)
(edited: make use of perl's -E switch to implicitly enable features.)