Is 230 % 5 == 4? Sometimes it is.

I don't want to give this away in this post, but see if you can suss out this problem:

 my $value = 200 * 1.15;      # 230
 print "Value is [$value]\n";   # Value is [230]
 my $result = $value % 5;     # 4

When you give up, read my answer on O'Reilly Answers.

Thank you, Anonymous Benefactor!

I got home this evening to find an Unexpected Parcel waiting for me, full of books. I have no idea who it's from, but I'm guessing that it's from someone who finds CPANdeps useful. Thank you, Anonymous Benefactor! Your generosity is much appreciated!

TIMTOWTGTDV!

I previously wrote a post called "Get the damned version". This post is tentatively entitled "There Is More Than One Way To Get The Damned Version" and speaks about the plethora of applications and modules to get versions. Brace yourself!

So, apparently I'm not the only one who hates how you cannot distinctively get the version of a specific module. We have various trickeries such as loading the module and printing it, trying to load an unknown - yet hopefully - non-existent advanced version and failing thus showing the version and a few other such odd possibilities... and then there are the modules and applications.

While use.perl.org proves yet again to suck (and this time by not being able to continuously supply the simple CPAN module uploads RSS stream), I've gone to the original stream (which shows every single module upload as an RSS item), I noticed that a new module and application surfaced called App::Mver.

I reckon this is time to recap:

Getting slightly lazy with Beamer

I’ve recently moved away from s5 as my presentation framework of choice - mostly because they’re hard to share on sites like SlideShare should I ever choose to.

I’m currently playing with Beamer to generate PDF-based presentations.

As ever it’s a bit of a learning curve. I’ve managed one company-internal presentation so far, and intend to write my YAPC::EU 2010 presentation using it.

Being inherently lazy, I got bored manually running the voodoo required to regenerate the PDF from the .tex file(s).

Here’s my self-howto for using make to increase my laziness coefficient. It’s not perfect, but seems to do the trick.

cpanm --makepl_args ?

As a follow-up to one of issues I raised in Installing Deviant OpenSSL XS Modules, I sought out to determine how difficult it would be pass makepl_args (arguments for Makefile.PL) to cpanminus.

Here is what I came up with.

CPAN Testers Summary - June 2010 - Elysium

With the big announcement on Monday, that we are now live with CPAN Testers 2.0, the next couple of months are likely to be interesting to say the least. We now have the task of helping people set up their smoker clients to use the HTTP submission process, rather than the current SMTP defaults. In most cases it will just require some changes to existing configuration settings and the possible upgrade to the latest smoker tools. Part of the setup process does involve registering with the Metabase submission service, which initially will be a little bit of a manual process, although will be a more automated process once the web site is up and running. Once correctly configured, you should then be able to continue testing as before.

Static and Dynamic Typing

Pursuant to an idiotic discussion that I'm just not going to link to, I have formulated a general rule about type discussions:

Computer scientists have reasonable disagreements over the meaning of "static" and "dynamic" typing. Computer programmers have unreasonable disagreements over the meaning of "static" and "dynamic" typing.

Unicode in Perl, FTW (Я очень рад, ведь я, наконец, возвращаюсь домой)

Found on my hard drive. I love that it's source code that's literally in UTF-8 and it all just looks "right" or whatever that Russian says.

use utf8;
use Encode 'encode';
print encode("ascii", 'Я очень рад, ведь я, наконец, возвращаюсь домой', sub{ sprintf "", shift });;

BTW:

Installing Deviant OpenSSL XS Modules

Installing XS modules that link to OpenSSL can be tricky if you don't have OpenSSL installed in the normal place. I'm using Solaris 10, and I have OpenSSL installed in /usr/sfw.

I was having a problem getting Crypt::OpenSSL::Random, Crypt::OpenSSL::RSA, Crypt::OpenSSL::DSA and Crypt::OpenSSL::Bignum to install.

~> /usr/bin/perl Makefile.PL

Anybody working on OAuth2?

I'm working on some apps lately that require some extreme single sign on, and also a little Facebook integration. Since Facebook now supports OAuth 2.0, I'd like to kill two birds with one stone. However, I don't like duplicating functionality if I can help it. Is anybody working on a module for the OAuth 2.0 spec? If not, I'm probably going to throw a little effort into it. If you are, and would like some help, please let me know. Or if it interests you and you want to help me, let me know that as well.

The Marketing Of Perl

During YAPC::NA, we held a BOF to discuss the future plans for marketing both Perl and TPF. While part of our goal is to promote TPF and the services that it provides, our main goal is to promote the language and the community. There are a few easy ways that we can start creating some of the "buzz" that we've lost over the years. Our current goal is let people know that Perl is alive and thriving (check out Chris Hardie's lightning talk from YAPC::NA).

What are the easiest ways that we can spread the word of modern Perl and eliminate the misguided preconceptions and stereo types that have grown over the years?

Under the covers of perldoc

Sometime last year I had to go find out what happens under the covers when a user types a command like "perldoc strict." Here's the trace of which commands call which other commands. It's all in good fun.

I'd used strace to get a process-by-process trace of what happened to just the execve and clone syscalls.

strace -e trace=clone,execve -ff perldoc strict

And the eventual picture resolved:

Growl from command line

I am a Mac OS X user, and I like Growl. To see notifications can be irritating, sometimes. Irritating and distracting. But this doesn’t mean the tool is not useful.

And I find it useful when processing large quantities of data, and when this process is split in different small processes. In these cases, I like to have Growl warning me about what stage of the process is starting/ending and, when it finishes, to have a final warn about it.

While I can use Growl directly from Perl, that doesn’t work easily when using makefiles, for instance. Then, I wrote a small script that I put into my user binaries folder, and that reads the message from the command line, just like:

 growl Hello World!

In case someone finds this code useful, here it is:

#!/usr/bin/perl
use Mac::Growl ':all';
RegisterNotifications("Command Line", ["Note"], ["Note"]);
PostNotification("Command Line", "Note", "Note", join(" ", @ARGV));

Using App::cpanminus and PerlGcc to Install CPAN Modules on Solaris 10

If you have had the [dis]pleasure of deploying perl applications on Solaris, you probably have scores of tricks up your sleeve for installing pesky Perl modules. I find it necessary that application installations be scripted so I try to avoid anything that requires manual intervention.

Some modules on the CPAN will only install if you use gcc. Building CPAN Perl modules on Solaris 10 tells you how to use perlgcc to accomplish this. Pretty neat. I, admittedly, didn't know about perlgcc until today. It sure would have saved me a lot of headache over the years. I don't know how well it covers edge cases, and I'm sure there are pitfalls.

Let's take this a step further and see if we can get the perlgcc technique to work with cpanminus.

Spot the error

use Data::Rmap qw(:all);
use JSON;
use Data::Dump;
use Clone;
use boolean;

my $arg = from_json(q{{"1":true,"2":false}});
# convert JSON booleans to boolean's booleans
rmap_all { bless $_,"boolean" if ref($_) =~ /^JSON::(XS|PP)::Boolean$/ }, $arg;
dd $arg;

Hint: it's one character long.

In fact, this piece of code is full of Perl's traps (from Perl's lack of booleans obviously, to less obviously having to clone and rmap not working), it disgusts me.

Parsing Perl 3: Perl and Minimalism

One ring to rule them all, one ring to find them,
One ring to bring them all and in the darkness bind them.

One Idea to Rule Them All

Ever since the 50's, the fashion in language design has been minimalism. Languages were designed around paradigms, and paradigms were judged on elegance. If your choice of paradigm was lists, the result was LISP. If you decided on strings, you invented SNOBOL. Arrays, you wound up with APL. If your reasoning led you to logic, you ended up with Prolog. If you thought that descriptions of algorithms must be the basis of programming, then your fate was Algol.

Super easy editable html pages.

As part of an ongoing project to improve the woeful state of Qualitative data analysis software, I've already put together some tools to meet my needs. The tools are very much at the prototype stage, and will remain so for the foreseeable future, but I'm using them to prepare publishable work.

For the data management end of things I use a super-simple SGML format to tag chunks of text that I'm interested in, and use my Text::TranscriptMiner library to retrieve data. I use Git for version control, as a kind of high granularity lab book. I also have a web application which deals with the data visualisation side of things.

I'm looking for issues of The Perl Journal

If you have some hard-copy issues of The Perl Journal (Jon Orwant's magazine), I'd like to trade you something for them, whether that's money or something else. I'd especially like to take a complete set off someone's hands. Send me some email if you have some you want to get rid of.

Bricolage CMS hacking made easy!

After my last post about Installing Bricolage 2 on Mac OS X 10.6 "Snow Leopard," I realized that there are a few more important steps that should be documented for those that was to hack on Bricolage CMS vs. just running it. The following instructions link up your git clone with the application itself, making it easy to apply changes, test them, and push them upstream.

Announcing CPAN Testers 2.0

After 6 months of development work, following 2 years worth of design and preparation, CPAN Testers 2.0 is finally live.

With the rapid growth in CPAN Testers environments and testers over the past few years, the previous method of posting reports to a mailing list had reached a point where the scalability was no longer viable. This was recognised several years ago and discussions for a new system had already begun, with the view that reports should be submitted via HTTP.

At the Oslo QA Hackathon in 2008, David Golden and Ricardo Signes devised the Metabase, with the design work continuing at the Birmingham QA Hackathon in 2009, where David and Ricardo were able to bring others into the thought process to work through potential issues and begin initial coding. A number of releases to CPAN and Github followed, with more people taking an interest in the project.

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.