Using App::p Command Line Magic to Parse Vimperator History

I noticed today that my firefox has been really slow lately. I use a firefox plugin named vimperator which provides vim-like keybindings for firefox. I have it configured it to store 5000 command history entries, which is considerably more than the default (500). It has always been in the back of my mind that this might come back to bite me one day. So today I decided to check how many entries have so far been saved in the history file. I easily found that the history is stored in a json file located at ~/.vimperator/info/default/history-command. Running wc (word count) wouldn't help because all the data is stored on one line. I noticed that the file simply contains a serialized json array. To determine the size of this array, I used App::p and whipped up this simple one-liner:

    p 'p @{jl r "history-command"} + 0'

Thank You Sponsors!

We’d like to thank our sponsors for stepping up to support us. We really couldn’t do this without their support.

You too could sponsor YAPC.

Test::NoWarnings 1.04 - Immediate warnings with :early pragma

http://svn.ali.as/cpan/releases/Test-NoWarnings-1.04.tar.gz

One of the common gotchas with Test::NoWarnings is that the warnings are collected up and displayed in one go at the end of the script.

While this is strictly speaking the correct time to show them and has the least likelihood to result in a collision with some other test module resulting in an explosion, it makes debugging test scripts much more difficult.

Since I took over Test::NoWarnings a number of people have asked me to “fix” this problem.

After much thought, I’ve decided to leave Test::NoWarnings default behaviour the way it is and show everything at the end.

Instead I’ve added a specific debugging aid in the form of an :early pragma.

use Test::NoWarnings 1.04 ':early';

The :early pragma explicitly turns on emitting warnings at the time they occur instead of gathering them until the end.

GitHub-friendly README files with ExtUtils::MakeMaker and Module::Build

GitHub is a great place to host open-source projects and expose them to a wide community of developers, so it's not surprising that more and more Perl modules are making it their home.

One of the features of GitHub is that it checks if a repository has a README file in its root directory, and displays it on the home page of the repository. This makes the README file a good place to introduce your project to the public.

GitHub also understands a number of markup languages, such as Markdown and Textile, and if the README file is in one of these formats, it will be transformed into nicely formatted HTML. One of the supported formats is POD, which means that the standard documentation of a Perl module can be used as its README file and serve as the repository's home page (much like on CPAN).

How to Parse HTML

This is the first of a series of posts that will detail a Marpa-based "Ruby Slippers" approach to parsing liberal and defective HTML. As an example, let's look at a few lines taken more or less at random from the middle of the perl.org landing page. That page is exactly 400 lines long. Here is line 200 and some lines lines to either side of it.


</td>
<td>
<div class="module">
<a href="http://www.perlfoundation.org/">
<img alt=""
    src="http://mc-cdn.pimg.net/images/icons/onion.vee5cb98.png"
    width="45" height="45" />
</a>

<h4>
<a href="http://www.perlfoundation.org/">The Perl Foundation</a>
</h4>
<p>
The Perl Foundation is dedicated to the advancement
of the Perl programming language through open discussion,
collaboration, design, and code.

For readability, I've rearranged the whitespace, but otherwise the above is untouched. My more-or-less-random extract is part of a table, and captures the end tag of one cell and the beginning of another.

When you come to YAPC::NA, if you decide to stay at the rooms...



When you come to YAPC::NA, if you decide to stay at the rooms we’ve reserved at the Lowell Center (approximately $100 per night) then you’ll also get breakfast served to you for free each morning in the Lowell Center conference rooms just down the hall from the main lecture hall. We think it’s a super sweet feature to be able to roll out of bed, take the elevator down and get a nice hot breakfast, and then stroll 20 feet down the hall to attend the morning plenary session. 

I should note that if you choose to stay in the dorms, which will be about half the price, you’ll also get a hot breakfast, it just won’t be quite this convenient. 

No YAPC::Cuba

A very tiny handful of you may know that I was trying to push YAPC::Cuba. Later I expanded the idea to be a more general open source conference in Cuba as that would likely be a better fit. Sadly, it appears that it's not to be (or at least, not to be through me). There was a fair amount of excitement at the idea from those I spoke with. Quite a few said they wanted to be involved and would contribute time and effort to it, but as is often the case with volunteers, time is at a premium and dedicating volunteer time to a long-shot opportunity is understandably low on their priority list.

And of those who I spoke with who said they wouldn't attend? They were invariably not US citizens. They expressed concern about repercussions from the US government for attending a conference they were legally allowed to attend.

Isn't that sad? People are afraid of the US and it kills the chance to have an interesting conference at a time when it seems perfect for Cuba and the world to be talking.

Thanks to krimdomu and Rafael Kitover

Net::SSH2 (ssh client library based off libssh2) now has agent support, something that i've been wanting for a while and had just sat down to write. Very happy it had already been done! Thanks fellas!

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl and offering the modern features you’ve come to expect in blog platforms, the site is run by Dave Cross and Aaron Crane, with a design donated by Six Apart, Ltd.