Frozen Perl 2011: Perl and Arduino

Robert Blackwell gave a good intro to the world of Arduino and Perl.

It was mostly how one would work with Arduinos's and the Perl interface to them.

There is a variety of vendors, arduinos and extensions that let you do all sorts of fun things.

It's probably the first open source hardware that is widely available and accessible.

Very cool and interesting stuff.

Dancer FOSDEM fuel, first report

Friday and Saturday have been very productive days for Dancer. We wanted to write up this blog post yesterday night but we were waaaaay too tired for that. Instead, you get it this morning while we're sitting at a great Perl 6 talk by Gabor Szabo.

Friday we met up. I tried to wait for Franck at the train station and got lost... several times. He found me in the end and we went to our hotel room with his co-workers. Sukria and Dams arrived later. It was very exciting to meet the guys I've been working closely with for a while and haven't even met in person yet. Free software sure is nuts! :)

We couldn't fix the internet at the hotel (one cable, no wireless) so we spent a lot of time on discussions about important things. While we do not like bureaucracy, some things had to be sorted out and talked about. Here is a short list of things we've settled:

The New #email Epistles

<rjbs> I need to add the _raw and _str variants for everything, so not having them will always be wrong, or at least a mystery
<confound> This is a great mystery. But I am speaking of MIME and delimiters.
<rjbs> Email: the E is for Ephesians?
<confound> Therefore, since we are surrounded by such a great cloud of RFCs, let us throw off every feature that hinders and the proprietary extensions that so easily entangle.
<rjbs> confound: Where were you when I divided the tokens from the whitespace?
<aristotle> confound++ # ephesians
<rjbs> thus marking the first time anyone on IRC was ++'d for Ephesians
<rjbs> Encode always; lookahead without ceasing; in everything, be strict, for this is Postel's will for you.
<confound> Then he will say to those on his left, "Depart from me, you who are marked as spam, into the limitless bitbucket prepared for penis enhancement and chain forwards. For I was using mutt and you sent me a Word document, I sent you mail and you greylisted me, I wrote to the list and you vacation autoreplied, I made an announcement and you clicked 'reply all'."

Vienna.pm TechSocialMeet today

Vienna.pm TechSocialMeet tonight (19:00) at MetaLab!

The following "presentations" (probably rather free form and informal (at least mine..)) are planned:

  • daxim: Plat_forms
  • daxim: OpenBio-Hackathon im Juli
  • domm: iCal-Aggregier-Web-Projekt (http://kalender.stuwart.at)
  • rho: RDF und AllegroGraph-Plauderei

rafl tried to talk is into streaming the talks, so maybe we'll try to set something up (keep up to date on IRC #Austria.pm)

If you don't trust all those modern technologies, are in/near Vienna & interested in Perl, just drop by in person!

Frozen Perl 2011: ‎Wrapping Installed Subroutines: Wear a Raincoat in Someone Else's Perl

Wrapping installed subroutines

Steven Lembark gave a talk about wrapping installed subroutines.

It was noted on irc that this was the cotinuation/sequal of another talk. The jumping off point is having to work in some code and it has the following at the top of every program/module

use warnings;
$SIG{ WARN } = sub { die };

Now think about what that does...

Yes, you are now screwed.

Especially if you want to do any benchmarking or deal with some other modules.

You can muck about with the symbol table and such but one solution is the Symbol module.

Lembark chose this because it is part of the core/standard libraries (a predication of his talk). It cleans up some of the mess of dealing with globs/symbol table weirdness.

It was noted on irc that Package::Stash is a bit cleaner to use (at least its API is better).

Regardless it was yet more of Lembark showing some of the weird things that you can do (and some times have to do) and why it is better to find a module to give you some distance from that mental mayhem.

As always, he shows off interesting bits of the Perl solution space.

The Beauty of a Perl Quicksort

Yet Another Misleading Title. :)

err...I have to say, (I can't remember the exact time I met this version of quicksort), ever since the Haskell version was born, there were (and still are) various implementations available in various languages. This version of quicksort is a very nature "translation" of what the algorithm is:

function quicksort(list) {
    select a pivot;
    return (quicksort([x|x<pivot]), pivot, quicksort([x|x>pivot]));
}

Today, I met this version again in here (reddit.com). For convenience, let me repost the Lisp code:

(defun quicksort (lis) (if (null lis) nil
  (let* ((x (car lis)) (r (cdr lis)) (fn (lambda (a) (< a x))))
    (append (quicksort (remove-if-not fn r)) (list x)
      (quicksort (remove-if fn r))))))

I wonder if I could reinvent(port, steal, rob, grab...whatever) it to Perl...and this is what I did:

SF.pm February meeting - Learn Python The Hard Way

Zed Shaw will turn the tables on our usual Perl centric meetings by giving us a few lessons in learning Python the hard way. Zed is a well known software developer who is noted for developing the Ruby webserver Mongrel, the successor Mongrel2, the Lua based framework Tir, and autho.me.

Learning Python the Hard Way - http://learnpythonthehardway.org/index

Zed Shaw - http://zedshaw.com/

Announcement posted via App::PM::Announce

RSVP at Meetup - http://www.meetup.com/San-Francisco-Perl-Mongers/events/16408904/

MetaCPAN Status Update

Lots of great stuff is happening with MetaCPAN. Here's a quick (and incomplete) list.

First off, Yanick Champoux has been doing some excellent work to add module up and downvoting to the MetaCPAN API. His work is on Github He has also created a Greasemonkey script to allow module voting to begin on search.cpan.org. We plan on incorporating it into the cpan-mangler as well, so that you can vote on search.cpan.org without needing GreaseMonkey.

Yanick's work will pave the way for module commenting, bookmarking etc. The great thing about this is that we'll be able to collect data on most loved and hated modules/distributions without being tied into any one particular search site or application. This is the sort of data which can make getting an overview of CPAN much easier. Yanick will likely post about his work in greater detail, but it's pretty cool stuff. It could change how you approach your search for new modules.

Frozen Perl 2011: Keynote

Keynote = 5 things I hate about Perl

brian d foy gave the keynote this year. He talked about his talk from two years that was sort of based on Better Off by Eric Bende, his reading of Skeptic magazine and what this means regarding Perl.

As part of this he touched on the fashionable memes of why some hates or loves a languages, Perl in particular. Sometimes it's misinformed or ignorant hate or just as a way to validate their choice.

So he was thinking about why there is some much love, or hate, for Perl?

This led into an interview question, "What are 5 things you hate about Perl?"

This shows 3 things: real experience, depth and reach of knowledge, and workarounds used for those things.

This also relaxes the interviewee because it shows it is ok to criticise language being used/talked about.

brian then talked about what he hates about Perl. His list was things like: CPAN, licensing or reusability. He didn't go into any real detail about those.

Lacuna Expanse Status Report

It's officially been 4 months since we launched the Perl based MMO: The Lacuna Expanse, so I wanted to take this opportunity to update you on its progress.

First, thank you. Without you Lacuna wouldn't exist. Many of you are playing it, and many others of you have built modules, techniques, and technologies that we used to build it. So thanks!

Three new jobs were created after launch to help serve the community. One of them was even a Perl job! So Lacuna has already started helping increase the Perl-based economy. This may not matter much to you, but it tickles me.

Today we launched our second server. This one is a tournament server, where the speed is greatly increased, the map is greatly decreased, and there is an end game.

Padre 0.80 has been released.

Padre has hit version 0.80. I guess it's not a big deal, but you need to lead with something.

Adam Kennedy is by far the most prolific contributor for this release, clearly there are a few things that need scratching.

It seems though that this release was rolled out just in time for him to injure his wrist skating, not sure if it was roller skating or roller blading, so we may see a slow down from Adam for a while. Time will tell of course:

Show Perl subname in vim statusline

I asked on the vim mailing list how to see the name of Perl's current sub/method in the status line and Alan Young, the author of PPIx::IndexLines has a great suggestion which unfortunately relied on PPI. I'm working with very large modules and PPI ground to a halt for me. As a result, I took his suggestion and worked out the following.

First, make sure that your .vimrc has set laststatus=2 in it. That will ensure that you always get a status line, even if you only have one window (i.e., don't have split windows). Then drop the following into your .vim/ftplugin/perl.vim:

CCAN heads past 50 modules

Several years ago at OSDC::AU I was lucky enough to run into Rusty Russel three breakfasts in a row. He was at the conference to deliver a keynote on why C is awesome and all us scripter types should learn it.

I mentioned that I'd tried a few times to switch to C but I'd found the lack of any kind of CPAN pretty much crushed my soul each time I tried, because I kept wanting to make one because C and Perl are very similar languages (to me at least, compared to things like Python or Java or Haskell).

By the end of the conference he was hooked on the idea, had taken over development of libtap and written 8 or 9 patches for it. A week later we had mailing lists, and a basic design.

Today, CCAN represents what I consider to be the closest cousin of the CPAN.

perl references in a while loop

while (0..25) {

$x++;

$d[$t++]=\$x;

until ($x < 25) {
lable:
print "hello::","\n";

$in = STDIN;

print ${$d[$in]};

goto lable;
}


}

## now this should print 1 when i type 1
## and 2 when I type 2 at
## and 3 when I type 3 instead it types 25
## for 1 to 25 typed in

## plese help

How Perl helps me read

I like to read. Over time, I've become quite a rapid reader - I remember a project at school where you would get a dignoria (star) for writing a book review during the summer holidays... and I had read 26 books.

During my short commute on the tube I like to read something. I used to bring paperback books and magazine on the tube. Before going on a weight-restricted holiday I had bought.a Sony Reader PRS-600 e-book reader.

This was quite neat, fairly small. Not a great screen or battery life and it would only charge on a computer's USB socket, not a generic USB one. There are a wide range of public domain e-books or you can create books with your own content and the useful Calibre e-book management software can scrape news sites.

DateTime and Excel difference

Seems that DateTime module thinks 29.2.1900 didn't exist while Excel 2008 does. Which one is correct ? Well DateTime is OpenSource while Excel is payware. Think payware would be correct ? nope, DateTime is !

So the correct DateTime object for dates starting 1.3.1900 when using values from Excel is :

DateTime->new(year=>1900, month =>1, day => 1)
        ->add(days=>$THEVALUEFROMEXCEL-2)


Excel-- !

mod_perl2 & Devel::NYTProf

This week I’ve been trying to switch us over to using mod_perl2. I wanted to cache database handles as much as possible so one of the first things that I did was edit my startup.pl and add:

use Apache::DBI;

Most stuff just works. When I find something that is only slightly broken, I fix it. When I find something that is horribly broken, I just create a Location in httpd.conf to tell Apache to run that as plain CGI and I’ll update them later.

The entire application suite feels faster. I suspect much of the speed up is due to caching database handles but I’d like to profile it. I have no problems profiling CGI with Devel::NYTProf. When I configure httpd.conf to use Devel::NYTProf::Apache like this I get issues.

PerlSetEnv NYTPROF trace=2:file=/tmp/mm-nytprof.out:addpid=1:start=begin:use_db_sub=1
PerlModule Devel::NYTProf::Apache

JavaScript: The Good Parts

This is very brief review of a marvellous book on JS, JavaScript: The Good Parts, by Douglas Crockford.

It’s a somewhat thin book, given that JS has quite a few features, but the author’s contention is that you should stick to a small subset of those features.

Some extracts from the Preface:

  • This is not a reference book.
  • It is not exhaustive…
  • This is not a book for beginners.

These mean he’s not trying to teach JS, but rather to guide us readers as to what components of the language we should restrict ourselves to, that we may write programs of much higher quality than would otherwise be the case.

For your entertainment, he’s called the appendices (which are worth the price of the book):

  • Awful Parts
  • Bad Parts
  • JSLint
  • Syntax Diagrams
  • JSON

Regrettably, JS has many parts which are very badly designed indeed, and the so author steers the reader away from those.

Highly recommended for all of us who sail on the JS Titanic.

Perl 5.12.3 released

Perl 5.12.3 is now live...

http://dev.perl.org/perl5/

Full announcement.

Fennec Testing Framework - 1.0 Released

Over the weekend I overhauled my personal project Fennec. Fennec is a testing framework for Perl that was originally meant to solve the shortcomings of Perl's other solutions. This release is a major simplification of Fennec, largely as a nod to the fact that Test::Builder2 will solve a majority of the "results should be objects" problems that Fennec formerly addressed.

Fennec solves the following problems:

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.