サクサク読めて、アプリ限定の機能も多数!
トップへ戻る
インタビュー
blog.woobling.org
Stevan has always characterized Moose as a disruptive technology. Pre-Moose metaprogramming has a long history, but you were pretty much stuck rolling your own metamodel back then. Moose changed this by providing extensible class generation. It tries to create a metamodel in which several specialized metamodels can coexist and work together, even on the same class. Case in point, a little over a w
Option configuration is a classic example of when I prefer a purely functional approach. This post is not about broken semantics, but rather about the tension between ease of implementation and ease of use. Given Perl's imperative heritage, many modules default to imperative option specification. This means that the choice of one behavior over another is represented by an action (setting the optio
<record type="broken">I'm a big fan of purely functional programming</record>. Another reason I like it so much is that purely functional software tends to be more reliable. Joe Armstrong of Erlang fame makes that point in an excellent talk much better than I could ever hope to. However, one aspect he doesn't really highlight is that reliability is not only good for keeping your system running, it
The one thing that I almost always notice when playing around in non Perl languages is how well Perl handles scoping. There is one place in which Perl got it totally wrong though. The value of the current package is lexically scoped: package Foo; { package Bar; say __PACKAGE__; # prints Bar } say __PACKAGE__; # prints Foo However, the notion of the current package during compilation is dynamically
After my last post about Sub::Call::Tail melo and jrockway both asked me whether I was aware of Clojure's recur form. I wasn't. Shortly afterwords I wrote Sub::Call::Recur, which implements that form in Perl. The recur operation is a tail call to the current subroutine. It's a bit like Perl's redo builtin, but for functions instead of blocks. Here is a tail recursive factorial implementation: sub
I've just released Sub::Call::Tail which allows for a much more natural tail call syntax than Perl's goto built in. It provides a tail keyword that modifies normal invocations to behave like goto &sub, without needing the ugly @_ manipulation. Instead of this horrible kludge: @_ = ( $foo, $bar ); goto &foo; You can now write: tail foo($foo, $bar); And much more importantly this method call emulati
Today I wanted to install a simple module on a production machine. I used the CPAN utility, as usual. Unfortunately that also pulled in an upgraded dependency which was not backwards compatible, breaking the application. I hate yak shaving. But not nearly as much as I hate surprise yak shaving. I want to fix compatibility problems in my development environment on my own time, not hastily on a live
I spent most of today and yesterday bikeshedding event driven PSGI with miyagawa on #http-engine. We seem to have converged on something that is both fairly portable to different event driven implementations, without being too yucky for blocking backends. For example, if you don't yet know the response code or headers and are waiting on some other event driven thing, it's sort of like continuation
Ovid writes about the distinction between responsibility and behavior, and what that means in the context of roles. He argues that the responsibilities of a class may sometimes lie in tangent with additional behaviors it performs (and that these behaviors are often also in tangent with one another). Since roles lend themselves to more horizontal code reuse (what multiple inheritance tries to allow
Perl has a very confusing set of behaviors for treating filehandles as objects. ADHD Summary Globs which contain open handles can be treated as objects, even if though they aren't blessed. Always load IO::Handle and FileHandle, to allow the method syntax. Whenever you are using filehandles, use the method syntax, regardless of whether it's a real handle or a fake one. A fake handle that works with
My friend miyagawa has been championing PSGI and its reference implementation, Plack. This is something we've needed for a long time: a clean and simple way to respond to HTTP requests without the cruft of CGI and %ENV. The PSGI specification requires the body of the response to be represented using an object similar to IO::Handle. I've released IO::Handle::Util, a convenience package designed to
This is a small trick I like to use when defining callbacks. Instead of invoking callbacks as code references: $callback->($data); I always write the invocation as a method call: $data->$callback(); or if $data is not a natural invocant for the routine, then I invoke it as a method on the object that is sending the notification: $self->$callback($data); This works in more cases than just plain cod
During the YAPC::Asia::2009 hackathon I refactored a bunch of XS modules out of some other code, both rafl's and mine. XS::Object::Magic This module provides an alternative to the standard T_PTROBJ approach to creating C struct based objects in Perl. The traditional way creates a blessed scalar reference, which contains an integer value that is cast to a pointer of the right type. This is problema
I'd like to thank to everyone that made my trip to Asia so great thus far. To list but a few: thanks to the JPA for organizing YAPC::Asia, especially Daisuke for being so accommodating when it wasn't clear if I would make it till the end, gugod for organizing YAPC::Tiny, Kenichi Ishigaki and Kato Atsushi for translating my talks (though only one was presented in the end), clkao and audreyt for bei
I just released Try::Tiny, yet another try { } catch { } module. The rationale behind this module is that Perl's eval builtin requires large amounts of intricate boilerplate in order to be used correctly. Here are the problems the boilerplate must address: $@ should be localized to avoid clearing previous values if the eval succeeded. This localization must be done carefully, or the errors you thr
In my last internals post I mentioned that most of the data in Perl revolves around the SV struct. The excellent PerlGuts Illustrated describes these structures in great detail, and of course there's the two main documents in Perl's own reference, perlguts which tells you about them and perlapi which tells you what you can do with them. This post is sort of like PerlGuts for dummies, intended to l
It's well known that while Moose competes well with hand written code at runtime. However, Moose code still needs to pay a lot at compile time, due to the comprehensive extensibility of the metamodel. We've previously made fairly successful attempts to optimize startup but there's always room for improvement. Thankfully Goro Fuji has received sponsorship to optimize Moose's startup time, and even
CouchDB is lots of fun. It's really easy to install on a mac using the CouchDBX package. It comes with a nice web UI so you can play around with it straight away. It leverages REST and JSON to provide a simple API that you can use from virtually any language. It has a great transactional model which lets you have full ACID semantics in a very lightweight way. So why don't I use it? Well, several r
Using KiokuDB with Catalyst is very easy. This article sums up a few lessons learned from the last several apps we've developed at my workplace, and introduces the modules we refactored out of them. Let's write an app is called Kitten::Friend, in which kittens partake in a social network and upload pictures of vases they've broken. We generally follow these rules for organizing our code: Catalyst
このページを最初にブックマークしてみませんか?
『nothingmuch's perl blog』の新着エントリーを見る
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く