Perl in small devices

I’ve participated in some discussions about running perl on small devices during the Perl Reunification Summit and YAPC::Europe.

The targets would be java/dalvik, objective-c/ios, and arduino. There is some work going on by Martin Berends (mberends++) on arduino, and Claes Jakobsson (claes++) on the jvm. Claes is working on reading and writing .class files.

We’ve discussed how they could use one of the Perlito parsers to implement a prototype, using either the ast-perl5 or ast-perl6 output:

$ node perlito5.js -Cast-perl5 -e ' print "hello, World!\n" ' > hello.ast5

Reini Urban (rurban++) showed me how to add type information to perl5 code:

$ perl -e '$int::; my int $x'

Type information would help the generated code to perform better and use less memory.

First Post

So, why don't you write a blog? A question I have been asked many a time in the past years.

I guess I mainly felt that I didn't have to tell the world much. And I was busy with $work.

Then you stop $work and start with $sabbatical. And start acting on the strange ideas that you developed over the years. Then you're asked to really start a blog this time. Really. And then you commit to that.

So here's my first post on blogs.perl.org. Not a lot of content yet. But it's a start. And more will be coming shortly.

Forgive me, for I have sinned

I uploaded a new module to CPAN, because none of the existing options were right to me, and then I subsequently found a good few more modules.

While working on my review of modules for getting dependency information, I came across a few modules which take the path to a module and parse the source to extract information. In writing my synopsis style scripts, it would be much easier to pass a module name. So I started hacking on one of the modules (Module::Used). I needed a function to take a module name and return the path for the first module found in @INC. Previously I've written such a thing, using File::Util::SL to get the right directory path separator. Time to look on CPAN.

First I searched metacpan for 'module path', but didn't immediately find anything. After a bit more digging I found Module::Filename:

So, Kiev 2013

Hi,

It was officially announced a few days ago that the next YAPC::Europe will be held in Kiev, the capital of Ukraine. Have you also heard that Kiev is the best city in the world? :-)

Let me share some basic information we've got today about the conference, almost a year before it.

There are three main persons behind the conference: Yaroslav Korshak, Viacheslav Tykhanovskyi and me. Together (in different combinations) we've organised about 30 Perl workshops and conferences in 7 countries. In 2007, I started the YAPC::Russia series and in 2011 I received the White Camel Award because of doing that. The recent conferences in Kiev, including YAPC::Russia codenamed Perl Mova and the Black Perl are the ones organised by these two guys, Yaroslav and Viacheslav. They did an excellent job this year gathering ~200 attendees and inviting a few foreign speakers.

UsePerl and Other Stories

I've just released new versions of my use.perl distributions, WWW-UsePerl-Journal and WWW-UsePerl-Journal-Thread. As use.perl became decommisioned at the end of 2010, the distrubutions had been getting a lot of failure reports, as they used screen-scraping to get the content. As such, I had planned to put them out to pasture in BackPAN. That was until recently I discovered that Léon Brocard had not only released WWW-UsePerl-Server, but also provided a complete SQL archive of the use.perl database (see the POD for a link). Then combining the two, he put up a read-only version of the website.

#perl6 summary for week ending 2012-08-25

First time reading one of these summaries? Please glance at Notes.

2012-08-19:


2012-08-20:

Which tag to use for YAPCs?

discuss here in my blog:
http://domm.plix.at/perl/2012_08_25_yapc_tag.html

(as Perl Iron Man doesn't let me update my blog URL, I have to crosspost here. sorry for that..)

What I liked about YAPC::EU 2012

Disclaimer: This list is no ways complete. It does not mean that I didn't like what I forgot to mention. :-)

The Streuselkuchen. The coffee. The snacks. The drinks. THE ICECREAMS.

How the essential things worked like charm. The Germans are winners. :-) This is no news to the fans of the English Football Team. Thank you very much, organizers. (bow)

The lunch break in the city park.
frankfurt_city_park.jpg

The Talks. The broad range of interesting topics. The "informativeness" of the talks. (I have not attended one single talk where I had the impression that the speaker gave the talk to hear himself speak.) I used the feedback forms for individual feedback, and so should you, I think. It's about talking to people rather than about them (publicly). Nice things can always be said, so again: Thank you, speakers! ;-)

The cool air in the Frankfurt.pm auditorium which escaped from a bunch of holes in your front neighbour's seat. Put your fingers inside and feel the cool breeze!

My YAPC

It was a good YAPC although I already knew FFM and their slightly musty University, so it lacked the excitement of a new unknown place. But I guess its part of the joy to meet the class of Perl again, greet domm here, say hai to karen there and so on.

Highlight was to me Stevan Littles presentation (no keynote was utterly important), even if I extracted the crucial infos before. I was especially sceptical to declare one line to get the getter/setter like in Moo/s/e. But combined getter/setter are not always right, you might follow the damian or even (god forbid) your own taste. So to declare that and not deliver that part by default seems to be very perlish and sane. And I got the impression that there is not much uprise against it and that and that it might even arrive in 5.18.

Fun With Fuse

FUSE (Filesystem in USErspace) is a useful kernel module with an API which allows file systems to be implemented in user space applications, mounted and fully integrated into the system's VFS. Originally implemented for Linux, FUSE API-compatible kernel modules are now available on *BSD, OpenSolaris and MacOS. That said, this was written on a Linux machine so there may be assumptions made about the tools available, their output etc. Feel free to submit info on other *nix-like systems for inclusion if you encounter any inconsistencies. This also goes for corrections and suggestions - if I get the details plain wrong or the code stinks and so on...

Some examples of popular FUSE file systems are ntfs-3g, which provides full NTFS support for the Linux kernel, and sshfs, which mounts remote directories over SSH with SFTP support. FUSE also powers ambitious projects, such as the distributed filesystem, MooseFS as well as providing easy access to proprietary protocols such as MTP.

We can combine this power with the power of Perl using the excellent FUSE API binding.

Sugar for MooseX::Traits

Tomorrow morning I'll be needing to get up in the wee small hours of the morning to travel to the Moving to Moose Hackathon 2012. In the mean time, here's some sugar for the awesome MooseX::Traits...

package traits;
use MooseX::Role::Parameterized;
parameter namespace => (
    isa     => 'Str',
    default => '',
);
role {
    with 'MooseX::Traits';
    has '_trait_namespace' => (is => 'ro', default => shift->namespace);
};
1

Instead of this:

YAPC::EU::2012, what I missed

YAPC::EU is over. It was a nice conference, but there were a couple of things I've missed. The first one is obvious: air conditioning. We had a too hot weather. I understand that Germany is used to cold, not hot. Nevertheless, next YAPC::EU users, remind that 300 or more people in a room, half with their laptops and gadgets turned on, produce a lot of heat. So, be sure at least the main room has a decent air conditioning system.

post-yapc

So, I’m sitting in the car, while Jess is driving back to the UK (well, the chunnel … well, to Luxemberg to find cheap gas ) on the way back from the Perl reunification summit and YAPC::EU 2012, Frankfurt. I figure this is a good time to do the blogging thing again, and give some of my throughts about Perl (the programming language), perl (the implementation of the programming language), Perl (the city^Wtown), and other such things, and possibly even my role in them in the future.

Ocaml, Unicode, and Hashtables

So, Ocaml does not support Unicode out of the box. The “string” type is an 8 bit byte and that’s that. Some find this to be a major failing of the language in general and it is a pain in the ass. However, there is a unicode library for ocaml Camomile which fills the gap.

In the project that I have been working on, I had to read in a Unicode file into Ocaml and create a “seen” hash. Just as you would do in perl normally. However, because Ocaml doesn’t support Unicode natively, you cannot use the generic Hashtable type ”(’a, ‘b) t”, which stands for an arbitrary type for a key (the first ‘a) and an arbitrary type for the value (the second ‘b). The key value types will be filled in by type inference as you use the Hashtable based on what you do with it. This won’t work because the generic Hashtable depends on an equal function that will not conform to the Unicode standard compare.

Things I learned at YAPC::Europe 2012

...can be found on my blog

Slides for my YAPC::Europe 2012 Keynote

When I gave my keynote at YAPC::Europe 2012, I had not yet put the slides online because the talk was very much a work in progress. My intent was to repeatedly update the slides until I felt comfortable with them, but the talk was popular enough that people kept requesting the slides, so here are the slides for Agile Companies Go P.O.P.

A few notes:

  • Slideshare did an awful job of converting them
  • Slides are like subtitles: you can lose a lot of important information
  • There a few areas which need to be rewritten.

The basic idea of the talk is simple: just as having a powerful V8 engine doesn't mean you have a car, using XP, Scrum or similar agile project management methodology doesn't mean you're agile. An agile company goes P.O.P.:

  • People
  • Organization
  • Process

The process bit is what most of us think when we say "agile", but you need the right people and the right organizational mindset to get to truly have an agile company.

Going to Perl School

[This is a repost of what I wrote over here ]

Ocaml and Hashtables

Coming from a Perl background and seeing the Ocaml Hashtbl documentation for the first time, it can be really confusing. Especially since there is no keys, values, and each functions in the documentation. So, first of all while Ocaml doesn’t give you these functions out of the box and I would argue that it should, you can write them fairly easily yourself using the fold function.

let keys htbl =
  Hashtbl.fold (fun k _ accum -> k::accum) htbl []

As you can see above the fold function gets three params, the first two are the key and value. The third is the “accumulator” or in this case just a list where you will append the k variable. The underscore means “anything” and tells the compiler that you don’t really care about the binding and it is not then necessary.

The values function works similarly.

xsd:choice equivalence to individual xsd:elements

Just noticed this in XSD -- an xsd:choice with minOccurs=1 and maxOccurs=unbounded that contains 2 xsd:element(s) each with minOccurs=0 and maxOccurs=1 is roughly equivalent to just having 2 xsd:element(s), each with minOccurs=0 and maxOccurs=unbounded.

The only difference I see is that having the xsd:choice lets you alternate between the xsd:element(s). In many common processing cases (that I've seen), these 2 sub-schemas are completely equivalent.

Thanks to Olaf Alders for HTTP::CookieMonster

The old, horrible way, to get a cookie by name with LWP::UserAgent or WWW::Mechanize:

my $cookie = $a->cookie_jar->{COOKIES}->{".$SITE_DOMAIN"}->{'/'}->{$COOKIE_NAME};

The new way, with HTTP::CookieMonster:

my $monster = HTTP::CookieMonster->new( cookie_jar => $a->cookie_jar );
my $cookie = $monster->get_cookie($COOKIE_NAME);

Much better. Thank you. I’d love to see something like this built right into WWW::Mechanize.

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.