Method modifiers, roles, and state

Note this bug report for Mouse. Because of formatting issues with code, I'll repost the code here.

Padre 0.70 has been released.

My apologies for the late release announcement. Typically once the release has been done I then get on with the real work of stringing together enough words and sentences to convey the great work done by the volunteers within the Padre project.

However this time I've been a bit distracted with the closing down of vox.com and finding a new location for announcing Padre releases.

It makes sense that since Padre is an IDE written in Perl, that blogs. perl.org is where I've come to.

I'm not sure about previous announcements being exportable and imported into the new home, so we'll just have to hope that the history isn't completely lost with the closure of vox.

Release 0.70 is our first release without the "Unstable" tag.

Telling you about my not-yet-acute-enough itches.

This was going to be a reply to cyocum, but I've promoted it to a full post in its own right.

Given my desire to eliminate Microsoft Word from my life as much as possible, pandoc the round trip markdown to pretty much any other markup format parser written in haskell is of great interest to me. However, I haven't got around to using it with citeproc-hs, the haskell implementation for for the emerging standard Citation Style Language, due to lack of comprehensive enough documentation - and the itch isn't strong enough for me to scratch it yet, and likely won't be for the next eighteen months or so.

Here are two further related itches that are also not going to be scratched by me in the near future:

  • A round trip arbitrary-markup-formatter in perl like pandoc is for haskell.
  • Possibly of interest to the bioperl guys would be perl bindings for the emerging standard Citation Style Language

Just putting it out there in case anyone else is feeling itchy ;)

Email::MIME::Kit is cool!

While looking into better, easier, more maintainable ways of doing email, I came across Email::MIME::Kit. It thought it was so spiffy I had to tell somebody!

I'm used to doing things the old way, with Net::SMTP and MIME::Entity, which is not pretty, but neither is it difficult. Well, Email::Simple and Email::Sender::Simple make it much prettier and quite a bit easier, too. But great as they are, I am most pleased with another product of the Perl Email Project: Email::MIME::Kit.

This module lets you abstract away all of the dirty internals of email composition, templates, and attachments, and put them in a neatly packaged directory of 'kits'. The various components that work on a kit to produce a well-formed Email::MIME message are Moose classes, which you can extend* or replace using roles. RJBS did a presentation on this back in early 2009, but I missed it somehow. In a nutshell:

Inline::C optimizations

At the last (first, actually) Glasgow.pm meeting last week, I mentioned to a couple of the people present an instance in which I've used the wonderful Inline::C module to replace a chunk of Perl code I couldn't quite get to work fast enough.

Maisha, now with OAuth support

A project I started back last year is Maisha, a command line client to interface to social micro-blogging networks, such as Twitter. On 31st August this year, Twitter depreciated the Basic Authention method of allowing applications to login users with a simple username and password combination. In its place they now use OAuth. (See also the blog post by Marc Mims - author of Net-Twitter).

On the face of it, OAuth seemed a bit confusing, and even the documentation is devoid of decent diagrams to explain it properly. Once I did get it, it was surprising to discover just how easy the concept and implementation is. For the most part Marc Mims has implemented all the necessary work within Net-Twitter, so Maisha only needed to add the code to provide the right URL for authorisation, and allow the user to enter the PIN# that then allows the application to use the Twitter API.

Perlito Perl6 in .NET

There is a new article about the Perlito Perl 6 compiler, published by the São Paulo Perl Mongers. The article is mostly focused on the Javascript backend, and all code snippets can be run in the browser. There are also instructions on how to install the Perl 5 backend from CPAN. The article finishes with an overview of the compiler internals.

In the development front, Perlito now passes all it's tests in .NET, using the IronPython backend:

$ /usr/local/bin/prove -e "perl perlito.pl -Bipy" ... t/16-var-redeclare.t ....... ok t/21-test.t ................ ok All tests successful. Files=30, Tests=125, 77 wallclock secs ( 0.17 usr 0.14 sys + 48.15 cusr 2.53 csys = 50.99 CPU) Result: PASS

qw() in list context deprecated

Someone decided that using `for var qw()` should be forbidden, you have to write explicitly now `for ... (qw())` instead of `qw()` beginning with 5.14. WTF

5.14 seemed to be a fine release for me, the first in a long time which is actually faster then most of the previous ones. And there were not too many languages policists.
But this new qw() deprecation warning is just pure nonsense.

`qw` used in for list where only list-context can be used should still be allowed.
Why should I be forced to update all my code to add `()` around `qw()` only because it seems to be "right". perl has let you use handy shortcuts forever.

for my $a qw() {} => for my $a (qw()) {}
How awful!

Writing Large Systems in Perl is a Privilege Not A Right

I have had an experience which has caused me to reevaluate my relationship with Perl. Members of my local PM have also had to deal with this for the last six months or so. After a post-pub conversation with pozorvlak the other night, I have come the conclusion that while writing large systems in Perl is possible and sometimes even desirable, this is a privilege of showing that you can be disciplined and not a right.

Perl 5, at least, allows you to have many different ways of attacking a programming problem. This can be a benefit but it comes with two large problems. First, if your programmer is not disciplined, Perl is almost guaranteed to give you spaghetti code. Second, if your programmer is inexperienced, Perl will give you something that works but will be unmaintainable by either the programmer themselves or an experienced programmer. Perl does not teach nor require good programming practice.

Number::Phone 1.8 released

I wouldn't normally bother to blog about an update to an existing module, but this has an incompatible change.

Previously, if you tried to create a Number::Phone object but didn't have a module installed that knew about the numbering plan of the country that number was in, then the constructor would fail and return undef. This was silly. Now, it returns a minimal object that knows what country the number is in and not a lot else.

Working For Bletchley Park

This might not seem like a perl blog post. However it is...
Back in the second world war Bletchley Park was the focus of the allied code breaking operations, and the equipment and techniques devised there were the direct ancestors of modern computers and algorithms.
Perl builds on foundations laid at Bletchley.
After the war the role of Bletchley was treated as a state secret, and to the shame of the UK the whole history and site was allowed to crumble; only in the last few years have serious efforts been made to preserve the site and its history, but more work and money is still needed.
So, if you are in the area, why not visit Bletchley.
And, if, like me, you have a good career in computing, why not consider donating something back to the birth place of the modern computer.
At least 100 others have joined me and pledged 1 day's salary to the Bletchley Park Trust - we would love it if you could join us.
You can find more details at http://www.work4bletchley.org.uk or donate at http://www.justgiving.com/workforbletchleypark

Kephra 0.4.4 and release cycles

In the next days, Kephra 0.4.4 will arrive.
New features are mainly about basics editing. Things that are easier with mouse like selecting word, line (double or triple click) or or selected some content items are now as easy with keyboard as with the mouse. And things that are fast with keys like cut copy paste and find string are now available with simple mouse clicks, without context menu (even if its still there - timtoday) (left click on selection - copy, middle click inserts selection like in emacs, right click while selecting-cut). Most of that I borrowed from Acme. Some little tools where added too. All in all easy to understand things. So what readers may wonder most, is calling it a "testing release" like 0.4.3 two month ago.

On CPAN it was marked as stable because there you have only a 2 way distinction. And testing releases are optimized on stability as dev releases are optimized on freshness. So why introduce a third level release cycle?

Translating LaTeX to Word: Pandoc

As some of you might notice from my old tech blog, I often have problems with my colleagues in the Humanities because they use Word and I use LaTeX. This cause me recently to have a lost day as I had to translate a PDF by hand into Open Office so I could send it in Word to my editor.

In my search to make this process much less arduous, I believe that I have found the panacea: pandoc. I tried it on my XeLaTeX file for my current article and it worked very, very well. It outputs in OpenOffice format and from there, it is easy to translate into Word.

There are two problems (as there always are). First, it does not handle BibTeX at all so you must copy and paste that information by hand from your PDF. Second, it mangled the Greek that I had in the file which means that pandoc does not handle UTF-8 very well at some point in the process of producing the Open Office file. I will need to file a bug report. Other than that, however, I am very impressed

Equinócio de Setembro

O equinócio é um evento que foi criado pela comunidade Perl Mongers de São Paulo para gerar conteúdo sobre a linguagem em português, o qual é realizado nos meses em que o Sol cruza o plano do equador, publicando um artigo por dia durante o mês.

Em março deste ano aconteceu a primeira edição do evento, e na edição deste mês já foram publicados dez artigos:

Todos os artigos do evento podem ser encontrados no site do São Paulo Perl Mongers.

YAPC::Europe 2010 Conference Survey Results

The results from the Conference Survey for YAPC::Europe 2010 in Pisa, Italy are now online.

This year YAPC::Europe had 245 registered attendees, with 153 of those attendees (amounting to 62%) submitting their responses. Many thanks to the 153 of you who took the time to take the survey, and all those who submitted 1048 evaluations for the speakers. It really is very much appreciated.

I now plan to work through the feedback for the organisers, and prepare the raw data, as well as the raw data for previous surveys. After that I hope to release all the code used to administer the surveys, so that if anyone wishes to use this code for their own purposes they can. However, as the YAPC Conferences Surveys can interface to the Act system, if you are organising a YAPC or Workshop using Act and wish to run surveys, please feel free to ask me to set up an instance for you.

If you have any feedback regarding the surveys, or suggestions for questions, or have any questions regarding the surveys themselves, please feel free to contact me at barbie@cpan.org. For previous surveys please visit the YAPC Conference Surveys website

Showcasing Test::TinyMocker

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


mock 'My::Object'
=> method 'run'
=> should {
isa_ok( $_[0], 'My::Object' );
};

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 {
...
}

I hope this helps you as much as it helps us!

use.perl refugee

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.

PDX.pm videos

When I'm in town during a Portland Perl Mongers meeting, I livestream the event with UStream, and record the presentations if the speakers permit it. Last night, I taped Michael Schwern talking about Test::Builder2 and Chromatic regarding Modern Perl. Check them out!

Birmingham.pm 10th Birthday

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.

106-dscf1220.jpg

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.

Here's to the next 10 years.

Perl Event of the Summer

For one reason or another I have had to delay giving a talk at my local Perl Mongers group for the past few months. And one of the regulars accused me of hyping it so much that it will no longer be able to stand up to expectations. So I responded by writing a long email to the mailing list explaining why nobody will want to miss this presentation. Not to be outdone, he then wrote a script for a commercial for this talk in the form of a movie trailer. I couldn't just let it go at that, so I actually created the commercial for his script!

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.