Sleep Sort with POE

Sleep sort is described in this silly 4chan thread. I don't guarantee work safety.

It's essentially an insertion sort into time itself. A timer is created for each numeric value to sort, and the order in which they occur determines the outcome.

I've implemented a parallel version using POE.

My First Twitter App

Today I finished my first twitter app. My main point in posting this entry is to talk about how wonderful is Perl, and in particular how fancy is Net::Twitter. If you already know these things you can safely stop reading now.

My completed application is two programs each of which appear to be 67 lines long. In addition to providing a feed into Twitter I also threw in a CGI component, just for giggles.

The First Test I Always Write

Nothing fancy, I just find myself copying this test into t/ directory of every new project so I thought others might find it useful, too.

Basically, it just runs Test::More's use_ok() on every file in the package's blib/lib directory to ensure that everything is building okay.

file: 000use.t

use Test::More;
use File::Find;

my @classes = ();

my $root = 'blib/lib';

File::Find::find(
    sub {
        return unless $_ =~ /.pm$/;
        my $path = $File::Find::name;
        $path =~ s|^$root/||;
        $path =~ s|.pm$||;
        $path =~ s|/|::|g;
        push @classes, $path;
    },
    $root
);

ok( scalar( @classes ) > 0 );

foreach my $class ( @classes ) {
    use_ok( $class );
}

done_testing( scalar( @classes ) + 1 );

What's the first test you always write?

Net::VNC update

I've added an interesting feature to Net::VNC: sending key events. You can now use it to automate tasks on remote machines...

What's new in Perl 5.14

An English version of my presentation given at YAPC::Russia a few hours before the release of Perl 5.14.

Perl 5.14.0 benchmarks and RPMS

I've been struggling for a while with the issues of deploying Perl applications in enterprise setups for in house Perl applications. So I rolled a couple of RPM spec files for 5.12.3 and 5.14.0 with the eventual goal of being able to deploy Perl applications on RPM based distributions (Fedora and Centos) without needing the system perl binaries to run the app.

I built a couple of RPMs and ran PerlBench on them, 5.14.0 has some nice results:

http://www.redhotpenguin.com/fredperl_bench/

I dubbed my effort 'fredperl' for lack of a better name. If you run Centos or Fedora and have been banging your head against maintenance issues with your app because you are using the system perl binary, I'd love your feedback on my initial effort here:

https://github.com/redhotpenguin/fredperl

Perl 5.14

I've only now realised that Perl 5.14 had been released this weekend. Yay!!

After reading perldelta I'm quite impressed with all the new features etc. I especially like these three:

I'm looking forward to installing the new version in the next few days! (why not now, you might ask: because I sort of broke my left ring finger while doing some shadow boxing with my son, which makes typing a bit complicated)

Why Perl 6 should be spelled roman

Yes it should spelled Perl vi (no pun intended). Just stays for vision. Perl 6 is the most visionary language i know of.

My Main Perl5 Project Is Also My Main Parrot Project

I've been trying to find time to work on parrot-handler, a parrot management tool in the spirit of perlbrew and rvm, for several months now. It's written in Perl 5, and could be very useful indeed. I've just been so busy ...

Well, okay. I've been busy playing World of Warcraft, dabbling with languages that are not based on Parrot, and messing about with my laptop. Oh, and doing work stuff. Still, that's kind of busy.

But there are some Parrot things that I'd like to do, and a working parrot-handler could make those things easier. I think maybe a little less WoW and a little more code tonight.

I will (probably) be attending the French Perl Workshop!

At school we had the opportunity to decide on a third language to learn, either Arabic or French. I opted for French (though my mother speaks Arabic as a second language) because it seemed interesting. School, as usual, makes you hate learning. I was kicked out of the class more than I actually attended it.

A few years ago I decided to take another shot at it. This was after I had already started working on Dancer with Alexis Sukrieh (sukria), Franck Cuny, Damien Krotkine (dams) and Philippe Bruhat (BooK). I took French classes, and started reading, writing and speaking. Going to Belgium gave me an opportunity to immerse myself more in the language. I stayed with Franck, Dams and Sukria, and a bunch of fun people from Linkfluence! It was a lot of fun, and I enjoyed it very much. It was then that I decided I'd love to attend the French Perl Workshop sometime.

Look away Now: Java questions (Debian/Perl)

Hi Folks

I'm going to use The State Machine Compiler (SMC to generate some Perl modules.

The docs say I need the "javac", "java" and "jar" executables.

My machine runs Debian stable 6.0.1. java is in the path. The question is:
What do I need to install to get javac and jar?

TIA.

Yet Another Perl Podcast #5: Интервью с Peter Rabbitson

В гостях у YAPP и/о “бензопильщика” самоего популярного ORM в perl - DBIx::Class - Peter Rabbitson.

В комментариях к этому посту вы можете задавать свои вопросы, на которые Peter постарается ответить.

Cсылки: RSS и лента на rpod.ru
Следите за анонсами в twitter

Bovicide 6: The Final Requirement

half_yak.jpg This post in one of a series inspired by a web discussion about what it would take to replace yacc and its cousins as the industry standard for parser generators. My interest in the question grows out of Marpa, my project to take the many improvements made over the decades to Earley's algorithm, and turn them into a practical parser generator.

Requirement 6: Available as a Library

To be an adequate yacc replacement, an algorithm should be available as a library. In the Perl context, this means available as a module. I interpret this requirement loosely enough to regard the traditional implementations of LALR parsers, such as the yacc parser generator, as meeting this test. True, they usually generate the code for a custom parser, which then must be compiled as a separate step. But an LALR parser generator could be implemented as a library.

Lingering tragedies

Often times when we're mad, or get hurt, we keep it in. Unfortunately anything that isn't dealt with will soon surface to the ground, usually in the wrong time (since we fail to allocate an appropriate time), and in the wrong way.

When something hurts us - really hurts us - whatever bad experience it is, it changes our lives. It changes the way we interact with others: those that have done us wrong, those we've done wrong, those who stay behind while others leave, those who remind us of others gone, and mainly... ourselves. We ourselves change to accommodate a place for all of this pain, these lingering tragedies. Our lives become the sum of our calamities.

Take the time to deal with whatever ails you, for it, uncured, will cripple your life.

PGXN vs MetaCPAN

David E. Wheeler has done some great work with PGXN. It's an excellent example of how you can build something CPAN-like without being weighed down with design decisions from long ago. There's JSON all over the place and there are mashups just waiting to happen.

In his latest post, he has challenged MetaCPAN to duplicate some of the shiny, new PGXN functionality. Turns out we can do shiny things too. This solution uses a combination of our current (older) API and our (newer) beta front end.

To see the JS and HTML output in action, check out this fiddle, this even cleaner fiddle or this jQuery solution. Take that, PGXN! :)

edit_file and edit_file_lines


Have you ever wanted to use perl -pi inside perl? Did you have the guts
to localize $^I and @ARGV to do that? Now you can do that with a simple
call to edit_file or edit_file_lines in the new .018 release of
File::Slurp. Now you can modify a file in place with a simple call.

edit_file reads a whole file into $_, calls its code block argument and
writes $_ back out the file. These groups are equivalent operations:

perl -0777 -pi -e 's/foo/bar/g' filename

use File::Slurp qw( edit_file ) ;

edit_file { s/foo/bar/g } 'filename' ;

edit_file sub { s/foo/bar/g }, 'filename' ;

edit_file \&replace_foo, 'filename' ;
sub replace_foo { s/foo/bar/g }

edit_file_lines reads a whole file and puts each line into $_, calls its
code block argument and writes each $_ back out the file. These groups are
equivalent operations:

perl -pi -e '$_ = "" if /foo/' filename

use File::Slurp qw( edit_file_lines ) ;

edit_file_lines { $_ = '' if /foo/ } 'filename' ;

edit_file_lines sub { $_ = '' if /foo/ }, 'filename' ;

edit_file \&delete_foo, 'filename' ;
sub delete_foo { $_ = '' if /foo/ }

So now when someone asks for a simple way to modify a file from inside
Perl, you have an easy answer to give them.

Seeking: Module to plot Perl class hierarchy

Hi Folks

The Subject says it all. I tried a number of CPAN searches, but couldn't see anything.

Cheers
Ron

Tel Aviv Perl Mongers meeting on May 25th (next Wednesday!)

Hey everyone,

We're having another Tel Aviv Perl Mongers (TA.pm) meeting next week.
As usual, we're gonna have some people, some snacks, lots of laugh and fun. Come along!

Date: May 25th
Address: Shenkar College, Anna Franck 12, Ramat Gan. Room 323.
Hour: 18:30 - meeting, 19:00 - talks start

Scheduled talks:
* ABC Path solver, live demo -- Shlomi Fish
A short talk of Shlomi's ABC Path Solver, including a demo

* Unicode considerations in Perl -- Meir Guttman
Meir will help us understand how to work with Unicode better

* Moose!! -- Sawyer X
If you don't use Moose, come see why you should! If you do, come help convince others!

Hope to see you there! :)

12 Million Test Reports

Another milestone in CPAN Testers history was reached today, 11th May 2011, with over 12 million reports now stored within the database, as can be seen via the Interesting Stats page. Incredibly, as David Golden recently noted, we have submitted over 6 million via the HTTP API over the last year alone. At the current rate, I expect us to be close to 16 million reports by the end of the year.

Congratulations to Chris Williams for posting the 12 millionth report. It was a PASS for Weather-TW-0.33.

Cross-posted from the CPAN Testers Blog

Fun at the Dojo Rio

I went to Rio after the São Paulo Perl Workshop. Doesn't it look like fun? Don't you want to come to YAPC::Brazil to have as much fun?

Last night Breno took me to Dojo Rio. I had never been to a Dojo before, and it was a very cool way to socialize and learn about other languages. I don't think this meeting was typical because I gave a short TDD presentation first where I started with a new Perl module then slowly added some features to it. I should have screencasted it, but I forgot to set that up.

Some of the people weren't strong in Perl, but most of them knew the ideas. After they watched me make several mistakes, we eventually got through adding tests and implementing a new method. Part of the Dojo idea is that you have to let the person working in front of the group puzzle out the problem on their own.

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.