Notes on porting to p5-mop

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…

On Starting a Perl Mongers group in the Philippines

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…

I'm back!

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 ;)

poor man's cfv/cksfv (CRC checksum)

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.)

Password Checkers

A colleague @$WORK found this: The Development of a Perl-based Password Complexity Filter. I was going to comment in the site about the presented Perl code looking rather like it was a straight shell script port (though the "use strict" pragma and lexicals indicate some safety, but I'm sure the more experienced Perl hackers here can smell worse.) Too bad it needs approved registration.

But that's not what I'm really wondering; are there more password checkers out there in the CPAN? I've seen ="http://metacpan.org/module/Data:…

About Zak B. Elep

user-pic Hacker, Gamer, Philosopher. Runs Slackware on laptops, OpenBSD on servers, and Perl on everything.