While things over at use.perl get sorted out, I have decided to move my technical blogging over to this space. I know I am not the most prolific tech blogger out there but I like from time to time to post a few things here and there about tech stuff.
For a while we've been using in Dancer a few mocking subroutines that we've put together quite elegantly as TinyMocker in our 't/lib' folder to assist us in tests.
However, with time we've been asked (okay, Sukria has been asked) to separate this so others could use it outside of Dancer. Sukria has released this as Test::TinyMocker.
Test::TinyMocker allows to mock subroutines (be it in object oriented or basic packaged subroutines). Here is how it will look:
use Test::More tests => 21;
use Test::TinyMocker;
use My::Object;
mock 'My::Object::run' => sub {
isa_ok( $_[0], 'My::Object' );
...
};
my $object = My::Object->new();
isa_ok( $object, 'My::Object' );
$object->run(); # will run some tests instead of the actual method
A nice aspect of TinyMocker is that it tries to also be expressive (which we also enjoy in Perl-world) and allow you to write in a way that is easier for people to read (albeit a bit longer for you to write):
If you use an arrayref, it automatically understands you want to mock several methods at once. It also provides "methods" for readability:
mock 'My::Object'
=> methods [ 'run', 'walk' ]
=> should {
...
}
On the 8th September 2010, Birmingham Perl Mongers celebrated their 10th birthday. While there are several other groups around the world who have been in existence longer, I think we are the second longest (uninterrupted) running group in the UK.
Mike Bissett (who was our special guest last month, when he paid us a visit while on holiday, as he now lives in Australia) and I started Birmingham Perl Mongers on our return from OSCON in 2000. We sent off the necessary forms and got ourselves setup on the perl.org servers during August, launched a website, and had our first official meeting in the Hogshead on Newhall Street, on Wednesday 13th September 2000.
Since those early days our numbers have grown, we've been involved with several different projects, hosted a YAPC and a QA Hackathon, held many technical meetings with numerous special guests and generally had a great time.
For our Birthday, JJ and his wife Penny, baked us a cake, decorated appropriately. Photos from last night are now online.
MongoDB's replica sets are very similar to a normal master-slave setup, except they are self-monitoring: if the master goes down, the slaves will band together to promote a new master automatically.
It's easy to try this out and fun to watch the automatic failover (or perhaps I'm easily amused). You'll need to download MongoDB and the MongoDB Perl driver (cpan MongoDB). Once you unzip the MongoDB binaries, you're ready to spin up a replica set (there's no install necessary).
Change to the MongoDB directory you downloaded and start up three MongoDB servers. Each database server needs:
Somewhere to put its data (a directory).
A unique port to listen on (it's a server).
The name of the replica set it's a member of. Each replica set needs a unique name, so for this example I'll use mongoMonger.
In the "real world" (production), you'd have each member of the set on a different machine, but I'm setting them up locally in case you only have one machine to work with.
I spent several hours debugging a catastrophic test suite failure today. As our test classes take over an hour to run and the failure takes place near the end of the test run, it was a very annoying issue to debug. Unfortunately, the test class in question passed when run by itself, but not when run in the entire suite. That usually means the global state had been altered in an unexpected way, and boy had it! Seems the test was failing because it was trying to run a method that a completely separate test class had -- and those classes weren't related by inheritance. It was very confusing until I finally realized that someone had mistyped a package name at the top of the test class. A few minutes later I had a new test which verified the package name ... and found ten other misspelled package names (out of 325 packages).
I have just sent out the evaluations for all the talks and tutorials given at YAPC::Europe 2010 in Pisa. If you haven't received yours, first check that it hasn't got lost in a spam filter. If it hasn't arrived by tomorrow, let me know and I'll resend a copy.
There were 153 survey responses received and 1048 talk responses received. With 245 attendees, that gives a 62.44% response rate, so thank you to all who took the time to complete all the surveys.
The official conference survey results will be published within the next few days, on the YAPC Conference Surveys site.
Awhile ago I moved my How can I troubleshoot my Perl CGI script? to StackOverflow. I'm just getting around to telling everyone about it because it was pretty far down on my to do list.
I think this has almost pushed the old location on SourceForge out of the googlebrain, but it wouldn't hurt for people to link to it in a blog post, tweet, whatever to encourage Google to find this one. Someday SourceForge will disappear and we won't have to worry about it anymore. How is it even still alive? StackOverflow has pretty good googlejuice though, maybe because Google likes StackOverflow.
Since it's on StackOverflow, this also means that I'm basically letting go of it. StackOverflow encourages people to revise the questions and answers of other to improve them, and I've given it wiki status to encourage that even more. Take a look, see what I've left out (or left in), what's new and exciting (or old and boring).
It's the end of an era. After 11 years from the first official CPAN Testers test report submission, the cpan-testers mailing list has finally closed its doors. From now on, anyone sending a test report via SMTP, will receive a bounce-back email. Most have already upgraded and reconfigured their smoker clients to use HTTP/S. For those that haven't or are new testers wanting to start afresh, please read the Quick Start page on the CPAN Testers Wiki, and join the cpan-testers-discuss mailing list to ask for help and advice.
This Lambda-the-Ultimate entry is about a study on the efficacy of Transactional Memory (TM). Apparently, TM proponents often claim that it makes concurrent programming easier (I've seen those claims), but that claim is often not backed up by citations. So they refer to this TM study (pdf) designed to test this assertion. The results:
On average, subjective evaluation showed that students found transactions harder to use than coarse-grain locks, but slightly easier to use than fine-grained locks. Detailed examination of synchronization errors in the students' code tells a rather different story. Overwhelmingly, the number and types of programming errors the students made was much lower for transactions than for locks. On a similar programming problem, over 70% of students made errors with fine-grained locking, while less than 10% made errors with transactions.
I hope to showcase and talk about a great Perl project every once in a while. Hope this lasts beyond one post. :)
We recently added emailing capabilities to an in-house application. Unfortunately sending the emails adds roughly 1 minute to the runtime. I decided to take a gander at swaks and see how it's being done there.
Swaks (SMTP transaction tester) is a great application for all systems administrators. It takes the pain away from testing email setups. Instead of echo msg | mailx -n -t ... and thinking of whether it's heirloom mailx, mail, nail or which version of mail it is, or whether you're using sendmail or exim or qmail or postfix (and in comes the headache...) - you can just write swaks -t addr -f addr. You don't even need the from field, but it's just as easy to add.
A couple of years ago I put together a list of The Perl Journal articles I could find on the Dr. Dobbs website. They changed some of their URLs, so I updated those to avoid all of the redirects and in the process found several more articles. My TPJ index is on Perlmonks. You can see some of the beginnings of popular projects, such as Moose, in some of the articles.
Personally I think that Microsoft word is the worst, most widely deployed piece of software ever, and I despise it with a vengance. Over the years I've learned to use it in such a way that it doesn't egregiously waste my time, but I'm never going to like it.
One of my many many annoyances is that track changes sucks, and it doesn't work well with the bibliographic software that I use. Unfortunately all my colleagues use word, so I don't really have a choice. But I've just started a new major piece of writing, and I want to be able to diff it properly.
So here's a little pre-commit hook that I made to commit plain text versions of my word docs in a separate tree off the root dir of the git repository. The only downside is that it's OS X specific because I use the built in textutil command to do the .doc to .txt conversion, but antiword or catdoc would probably be better.
Update: I decided I was not terribly happy with the output of textutil, so I changed it over to antiword, which works much better, both for layout, and with the field codes that my bibliographic manager uses. I also fixed a rather nasty bug that stopped it working with modified files.
Update: when I wrote on Twitter "Dear lazyweb: please write this code and drop me an email when you're done.", I was kidding. I'm not so silly as to think this is a trivial task (though I'd be delighted to be proven wrong).
I keep thinking about taking a stab at this, but I never quite seem to have the tuits. Essentially, I want a "reporting ORM", but then it wouldn't be an ORM, but it could leverage the metadata of a good ORM to pull off creation of an awesome reporting system.
So imagine your boss comes in an says "I want a report of total sales per salesperson in London". How would you write that? Think about an ORM solution versus SQL.
As of this weekend, the final switch to turn off the SMTP gateway for CPAN Testers was flipped. You can no longer post anything to the old cpan-testers mailing list, and any attempts now will result in a bounce message.
Our thanks to Robert and Ask over at the Perl NOC for looking after us all these years, and for being very patient with us while we got the HTTP gateway up and running over the last 9 months.
As a consequence, anyone wishing to still be a part of the CPAN Testers community, now needs to upgrade their test environments, to use the latest smokers and associated libraries. In the main this will involve a simple upgrade of your smoker client and the installation of 4 specific modules (which in turn will install any additional prerequisites needed). You will then need to acquire a metabase profile. For full details of the steps necessary please see the Quick Start page on the CPAN Testers Wiki.
Event: Birthday Social Meeting
Date: Wednesday 8th September 2010
Time: 6pm onwards
Venue: The Dragon Inn, Hurst Street, Birmingham, B5 4TD
Details: http://birmingham.pm.org/meet/next
INTRO
This month the Birmingham.pmSocial Meeting is something rather special. We'll be celebrating TEN years of Birmingham.pm. While there are several other groups around the world who have been in existence longer, I think we are the second longest (uninterrupted) running group in the UK.
Last month we had a special guest in our midst, when Mike Bissett came to visit, who I co-founded Birmingham.pm with after our trip to OSCON in 2000. We started small, and have since ebbed and flowed over the years. We are still have a core group of regular attendees, several who pop along when they can, and around 80+ members on the mailing list. Thanks to everyone who has helped to keep Birmingham Perl Mongers interesting over the years, and we'll raise a toast to all those that can't make it this Wednesday.
We're starting our usual monthly DC Perl Mongers meeting a bit early this Tuesday (September 7th) to have a little pizza and celebrate Rakudo-Star! Arrive at 6:30pm at the Starbucks at 18th and K Street NW (call me, Brock, if you miss us and need to be let in, number on the website) if you want food. But feel free to wander in any time thereafter, we usually stay as late as 10:00pm. We'll swoop down and look for people at the normal 7:30pm time too :)
Other activities:
* Bring your laptop!
* Installing Rakudo-Star
* Giving hands-on tutorials
* Beginner and Advanced welcome!
* Never been to DC.pm before? No problem, come have some free pizza!
If you have any questions, email the list or me directly -- awwaiid@gmail.com will do :)
About Rakudo Star: "Rakudo Star" is a useful and usable distribution of Perl 6. Current releases are aimed at "early adopters" of Perl 6. We can tell you ALL about it when you arrive :)
I am still slowly working my way through Dist::Zilla attempting to get the config that works for me...
I suspect that the plethora of PluginBundles::
personid
are down to it being very hard to slightly modify a config other than by writing it out in full or by nasty filtering gymnastics...
For example I've been building a Task:: module for work - this pulls in everything I want as a base system on our servers. I started with an existing Task module, git cloned it, and modified it into the form I wanted - bringing along the initial Dist::Zilla config and changing that to suit as well.
The dist.ini file worked well for it - I just wanted to make 3 changes:-
Use my own timezone rather than the embedded configured one
Specify version numbers rather than using the AutoVersion
Not upload to CPAN - this is internal (and experimental) only