Tatsuhiko Miyagawa's blog to discuss mostly tech and nerdy stuff.

2010.03.31

I started developing cpanminus one night in February when i got stuck with running CPAN.pm on linode VPS, and you may have noticed from its name, it's rather some kind of toy/fun project that's not meant to be serious. I was even considering to put it under Acme:: namespace.

But in a few days, it turned out people got really excited and think it's really a great idea. That was my surprise as well as a pleasure. One week later I started implementing more features such as local::lib bootstrap and a plugin system, which is still a developer-only easter egg feature (you need to look at the source code how to enable that :)).

So I guess there are two use cases, or major interests to cpanminus. One is that they want a CPAN client that is tiny, config-free, deps-free and just works with sane defaults for 99% of the users. The other is a CPAN client that is easy to understand, hackable and can be extended.

Conflicts

I think those two use cases will conflict eventually. Although the plugin system is written carefully, adding features like growl notification or cpanratings integration to a tool that is meant to "just work" is very weird. Features such as "checking out the code from github and build using dzil" shouldn't be used by 99% of the people. There've been criticisms on cpanratings as well as on IRC that cpanminus SLOC is now getting bigger than CPAN's CPAN::Dist which i think is fair.

Plans

So here's a quick strawman proposal.

1) I will fix the remaining tasks and wishlist for cpanminus such as "proper mirror configuration support" or "prompt when the installation fails", and drop cpanminus current plugin architecture and make it a 1.0 release, then freeze the features.

2) A separate tool that meets the purpose of "cpanm for hackers" will be created. Let's call it foo here because that obviously won't be the official name. foo will inherit the existing plugin features of cpanminus and actually uses cpanm (as a command line or with scripting API interface, not sure yet) when building things.

foo can be of course bootstrapped by cpanminus, but won't have the restrictions that cpanminus has -- youcan use LWP or JSON, and can assume perl 5.8.1 etc. However it should still be kept as lightweight and has as minimal dependencies as possible. Features such as cpan-outdated or uninstalling modules would become a subcommand for foo.

The biggest change i want to make for it actually is to make the subcommand system the default -- so it will be `foo install Plack` rather than `cpan Plack`. (and of course plugins can register its own sub commands).

I guess if there's a criticism against this plan, that'd be "So you're now REALLY reimplementing the rest of CPAN.pm/CPANPLUS. Why not contributing them back?", and i think it's a fair argument. But at the same time that's exactly the reason to separate out foo from cpanminus and keep it as simple as possible.

Let me know what your thoughts are -- i plan to work on these changes at the QA hackathon next weekend in Vienna.

2010.03.26

HTTP::Server::PSGI - core in Plack. Should work on all systems with perl 5.8.1 or later. No preforking nor keep-alives. Best for the quick development with plackup and testing with Plack::Test.

HTTP::Server::Simple::PSGI - only dependent on HTTP::Server::Simple which is absolute core-only and should work back to perl 5.6. Best to write PSGI embedded web server application even without Plack.

Starman - High performance preforking web server with HTTP/1.1 and UNIX domain socket support. it's based on Andy Grundma's Catalyst::Engine::HTTP::Prefork, and works exactly like Rack's Unicorn. nginx's best friend.

Starlet - HTTP::Server::PSGI + Server::Starter + Parallel::Prefork. Much simpler than Starman and less features, best to run behind proxy.

Personally I recommend Starman for the production use, running it behind nginx, Varnish or lighttpd. Starlet would be great if you don't need Starman's fancy features like dynamic server pool configuration or HTTP/1.1 support, and if you're a big fan of Kazuho Oku's software, which I myself am :)

All of them have Plack adapters so you can change the backend easily with plackup -s Starman etc. to test your application in your system.

2010.03.25

There is no main project on github that gathers people, even though we can see a fair amount of MooseX:: projects. Most of the developers will work on different modules, that may not have the same purpose. Lately we have seen a fair amount of work on various Plack stuff, mainly middleware, but also HTTP servers (twiggy, starman, â¦) and web framework (dancer).

Plack has now its own (re)Blog where I will microblog and reblog what's been hot around Plack.

No worries, It doesn't mean I would stop talking about Plack here - instead I will talk (probably more) about my thoughts here while lightly reblogging people's great stuff on Plack's own dedicate blog.

2010.03.19

"Modern Perl" people usually focus on stuff like Catalyst, Moose and DBIx::Class -- they're awesome modules and Web/ORM thing you should look at, but here's another take to show off what "recent" perl would look like to Ruby/Python web developers who are familiar with Rack and WSGI.

This is a PSGI application that connects to Twitter streaming API and displays the recent 10 tweets received from the firehose.

Note for Perl developers: Original script was using perl5i to enable autoboxing, which should make my code slightly more similar to Ruby/Python code where everything is an object, because otherwise they'd pick it up and say "Argh look at that ugly array slicing syntax!" which nukes the entire point of this post. However perl5i has some global side effects to interfere with some AnyEvent code if you're using perl 5.10.0 - i updated it to use autobox::Core directly.

2010.03.16

Japan has been known as a country where a shiny new technologies such as weird USB gadgets, cellphone TV/wallets or RFID devices are introduced first and adapted in a really early stage. Plack is not an exception.

Yesterday at the DeNA's technology seminar two of the biggest social networking sites in Japan, mixi and mobage-town (both articles on TechCrunch) revealed and explained that they are running their OpenSocial providers on Plack, using Starman and Twiggy (*1).

Think Facebook, MySpace, Digg and Google Reader all use Perl, Plack and deploy their apps on all of those PSGI web servers. That's what's happening there!

Oh just in case you're curious: livedoor uses Sledge, the framework I developed 7 years ago while mixi, mobage-town and Hatena use their own in-house web frameworks rather than the ones on CPAN like Catalyst.

[1] Technically they're deploying the old Plack::Server::* versions on production but they consider switching to the new versions soon.

I've been toying with Plack and PSGI URL dispatching a little bit and wanted to see what those dispatching modules on CPAN and PSGI/Plack frameworks are capable of and how the code would look like.

This github repository contains a bunch of examples PSGI applications using dispatcher modules on CPAN such as Path::Dispatcher or HTTP::Router to impelment the same functionalities.

This is to serve as a "cookbook" style of quick comparison as well as a basis of my improvement against Plack::Request and Tatsumaki's URL dispatchers i've been planning to do before making a Plack 1.0 release.

2010.03.12

Just watched the Disappearance of Haruhi Suzumiya movie at Tokyo Shinjuku Wald9 yesterday.

It was awesome. It's a long movie (2h42m) but i'd dare say it's totally worth it, and the quality of the movie is totally worth watching in a theater.

I'm not a deep fan of Haruhi series so I only know about the TV and DVD anime series (haven't read any of those light novels) but this disappearance story is probably the best for filming. It's somewhat related to most of the scenes you're familiar with and explains some missing pieces (but adds more as well) from "Sasanoha Rhapsody".

There were some scenes that actually made me cry. I'll give it 9.5 stars out of 10, which is probably the highest rank for an anime movie i've ever seen -- as good as "The girl who leapt through time".

There were two british girls next to me watching the movie and after the movie I talked to them; they apparently enjoyed the movie i.e. the quality of moving pictures but without a proper Japanese skill it's hard for them to grasp this complex story.

It might take some time before it gets a non-JP release with subs but I totally recommend this if you enjoyed the first season and the Sasanoha Rhapsody episode. (All other eps from season 2 are just crap - you can ignore them :))

2010.03.02

The Perl community seems abuzz about the cool new cpanminus client by Tatsuhiko Miyagawa. After about two weeks of development, this is a reasonably functional CPAN client with just a fraction of the overhead, complexity and verbosity of the CPAN and CPANPLUS clients that come with the Perl core.

I've been working on yet another CPAN client cpanminus and it's got a lot of attentions and great feedbacks so far. I don't have yet much time to write about it but David Golden who maintains a lot of CPAN ecosystem infrastructure such as Module::Build, Test::Reporter and CPAN.pm, has kindly written a great post reflecting the views from CPAN toolchain people. You must read.

Also, I appreciate your excitement and kind words on cpanminus but please do not just trash CPAN(PLUS). Criticism is fine, but calling them bloated is just too lame. They have reasons for their flexibilities and verbosities to make sure it works everywhere everytime, which cpanminus can fortunately ignore.