Installing Dancer, a perl web framework, on Debian Wheezy

February 19, 2011

This post is going to describe what I did to get Dancer up and running on Debian Wheezy. Dancer is a web development framework and as such aims to help you develop web applications more quickly. Dancer also supports psgi, or “Plack”, which is a tool to glue together your web application with your web server, making the two more interchangeable. Contrast this with mod_perl for example which is tightly coupled to the Apache web server.

I use Debian Testing (codename Wheezy) on my workstation at home, but Dancer is not yet available for Debian Testing although it should be showing up in testing in a day or two. I’m going to drop into a sid chroot to install Dancer since it isn’t in testing. A sid chroot is a chrooted version of Debian which is very useful for testing and writing software. A chroot essentially creates a separate root file system and encloses that root file system in a separate directory. If something goes wrong in this separate root file system it often has no impact on the other parts of your file system, at least if you are careful. This makes it ideal for setting up new tools or testing software. Setting this up is a little beyond what I had intended to talk about so I’ll leave it to the other very good sources of info about Debian chroots on the web to explain.

Like all good Debian perl packages you can install Dancer on Debian with this simple call;

sudo apt-get install libdancer-perl

Now what?

But what happens next? Well, if all else fails, read the documentation. In this case, there is plenty. One of the great things about Perl is that there is so much good documentation that comes with it and often the same can be said for Debian. Usually when I want to learn about a particular perl module on my Debian system I do;

perldoc Foo

And in this case I did perldoc Dancer and up came the perl documentation. There are also Debian specific documents and examples in the usual Debian location; /usr/share/doc/libdancer-perl/. I didn’t even bother looking in the examples directory which is included amongst the documentation, but rather I cut and pasted the code right from ‘perldoc’. I mean, if it is as easy as the author claims, I should be up and running without issue right?

And sure enough, I was. Dancer is remarkably easy to set up. I’ll go through the remaining steps I took to test a web app on my machine. Firstly, I cut and pasted the example code in the perl documentation which is a simply hello world program;

    # webapp.pl
    #!/usr/bin/perl

    use Dancer;

    get '/' => sub {
        "Hello There!"
    };

    get '/hello/:name' => sub {
        "Hey ".params->{name}.", how are you?";
    };

    post '/new' => sub {
        "creating new entry: ".params->{name};
    };

    Dancer->dance;

Once I created the perl file called mywebapp, which contained the code above, I ran

dancer -a mywebapp

Then all you have to do is to run the resulting web app like this;

perl ./mywebapp

which will handle all of the web serving for you. This truly saves a lot of time and headache.
You can change the last “Dancer->dance” bit with the more simple “start;” if you think Dancer->dance is silly. There is also a micro blog called dancr which may be of interest. Anything more sophisticated that what I’ve show here is most likely going to be better explained by the official documentation. Point your browser to the pod on CPAN and there ought to be something helpful there.

Dancer is simple to set up and get running.

3

Nokia’s white flag of surrender

February 5, 2011

While we wait for the new Nokia CEO to come out and explain his plans for the struggling phone giant, we get to wildly speculate. This speculation hasn’t been bad for Nokia’s share price but it will be a bit embarrassing for Nokia if some of the speculation proves true.

The speculation, even reported in the NY Times, is that Nokia is going to abandon their software platform(s) for a new one, at least in North America. This speculation has some basis, after all the new CEO, Mr. Elop, has a background at Microsoft and surely the Finns on Nokia’s board were looking at that when they hired him. The departure of Ari Jaaksi to HP and the WebOS is another sign that homegrown platforms like MeeGo won’t be getting as much attention inside Nokia.

Nokia is a business, and they are wise to revamp their operations that have won them only a two percent market share in North America. But if they move to Windows Phone 7 platform, or even to Android, it is an admission that they cannot compete in software in the world’s largest and most lucrative market. This would be the first time that Nokia would run someone else’s software on their phones. Furthermore, it calls into question their other strategies: what happens to MeeGo, what happens to Ovi, what happens to Symbian?

I can’t imagine a move like this will be successful for Nokia. Windows phone software has a tiny market share and combined with Nokia’s tiny market share you get . . . a still tiny market share. While the move may please shareholders, it is bound to disappoint a much more important constituency: Nokia’s customers. Nokia does make great hardware, and an Android phone from Nokia would most likely be pretty cool, but how are they going to compete? On price? Yikes. That won’t be good for the profit margins. And people are staying away from Windows phones in droves, they can’t get rid of the things despite a marketing budget that would pull some countries out of their deficit. Nokia phone buyers are pretty loyal, will this brand loyalty be in jeopardy if they get some cruddy phone that doesn’t even compete well with Symbian?

I’m not unbiased here, I believe in MeeGo and its future. It has a more open model than Android and that helps development scale. If Nokia abandons their investment in MeeGo it is a white flag of surrender, a way of saying “we can’t compete.” That seems like bad business to me.

Comments Off

maemo.org turned over to the community

September 17, 2010
Tags:

In a bit of very good news, Nokia has released maemo.org governance over to the Maemo community. There already is a maemo community council so they will be the governance body (vote ongoing now).

While Maemo is sadly an officially “dead” OS, it may be given new life if the community can take over and run it. There are still lots of excellent and quite dedicated hackers and members in the community so I see no reason why this shouldn’t be a vibrant project. It can also share source code with other projects like MeeGo and Linaro and can potentially help Maemo keep pace with MeeGo. I do have some concerns with the OBS but there are other ways to build packages.

This is good news and I look forward to being more active again in a more open community.

3

Adobe becoming more open?

August 1, 2010

I noticed in a recent SourceForge update email that Adobe has set up a site on SourceForge for their open collaboration initiatives: http://sourceforge.net/adobe/

This is a great idea. Adobe should leverage the power of the Free Software community to make Flash perform better on Linux, these improvements will surely be able to make Flash overall a better netizen plus an overall better performer – even on non-Free platforms like the iPhone, er iOS, thingy. I think Adobe would be wise to brag about this site a little bit and market their openness a bit more, it binds them more tightly to the community and positions them as an alternative to closed, proprietary pseudo standards like Silverlight.

Comments Off

DebConf in NYC

July 15, 2010

I'm going to DebConf10

Yay!

Comments Off

Incompetence and falsehood from American industry

February 27, 2010

It is perhaps comforting to know that some believe American Empire is not doomed to irrelevance. But much of American Industry seems bent on trying. Aside from their usual shabby treatment of their customers with lawsuits and wholesale purchase of politicians through lobby organizations, they love to write law that suits their complacency, hoping to snuff out competition through litigation.

Now that American Industry has seen that other nations can catch up, many companies are trying to change the rules to keep their advantage. One way they do this is through trying to force the US Trade Representative to ban trade with other countries because they have no use for crappy software from Microsoft. Now, they don’t mind if the country doesn’t pay for the software as long as they use it because they know at some point these foreign governments and companies will get caught out and be forced to pay Microsoft for some license or other. What these trade organizations, like the International Intellectual Property Alliance (IIPA), do not want to see is a choice in the marketplace. Choosing something other than a product from one of these organizations threatens the high paid lawyers and ex-CEOs who can’t find work from earning a handsome living making fools of themselves in the press.

Recently the IIPA, whose members include the BSA, RIAA, and MPAA, (litigious hobgoblins all), issued a report trying to strong arm the USTR into banning countries that use “Open Source” software. The report is conveniently available in pdf (a proprietary format of course) on their web site. A quick gander at that didactic screed brings us some useful nuggets, also highlighted by the Gaurdian. Of course the Guardian, like any good news organization, got it’s news from a blogger, who deserves the real credit.

I point out the Guardian article because they have a useful quote from the report so you don’t have to go through the whole thing:

“The Indonesian government’s policy… simply weakens the software industry and undermines its long-term competitiveness by creating an artificial preference for companies offering open source software and related services, even as it denies many legitimate companies access to the government market.

Rather than fostering a system that will allow users to benefit from the best solution available in the market, irrespective of the development model, it encourages a mindset that does not give due consideration to the value to intellectual creations.

As such, it fails to build respect for intellectual property rights and also limits the ability of government or public-sector customers (e.g., State-owned enterprise) to choose the best solutions.

There is a distinct and glaring lack in these paragraphs from the report. In fact I would say there is a complete absence of truth. Let’s help the author(s) with some corrections shall we?

The first paragraph goes off the rails early with the claim that recommending open source software weakens the software industry. Far from it – it strengthens the software industry, particularly the software industry in Indonesia. Because you are allowed to study and modify Free Software, you can learn about programming and become a better programmer. You can create innovative products and sell them. Perhaps even to the United States? It follows that the long-term competitiveness of the industry would be furthered by the use of Free Software in Indonesia, at least the Indonesian software industry. And call me crazy but I believe sovereign nations have a right to their own software industry.

What the heck is an artificial preference they refer to in the first paragraph? Is that the opposite of the “natural preference” of Microsoft software? Somebody better run and tell the busiest web sites in the world, along with two-thirds of the rest of the web, to stop using the apache web server – it just ain’t natural. They follow that odd statement up with claiming legitimate companies will lose access to the government market. Here is where the arrogance that borders on pathological rears its pointy head. Closing a market by allowing only proprietary software denies access and competition – in short free trade – not the other way around. Their statement is transparent falsehood so contrived you’d have to be dense as a lead cupcake not to see through it.

Now in the second paragraph we begin to see the real incompetence that American jurisprudence has so sweetly bestowed upon the world. Rather than say, research their topic, they inform us of what it isn’t, setting up a straw man cum sock puppet. Fortunately this straw puppet is highly flammable – let’s set it alight; Free Software is built upon copyright.

Boy that was easy. Easy because it is so damn simple. Free Software relies on copyright law for its existence. You assign a copyright when you write software, often that copyright goes to a company if you are working for them, but sometimes it goes to individuals and organizations. They can license their software as they see fit if they possess the copyright. Many companies see a strategic advantage in using Free Software licenses like the GPL because it allows them to re-use high-quality software from other large companies, like Intel, IBM, Red Hat, Sun, Oracle, (stop me if this is boring you) Novell, Nokia, Microsoft, oh yes – even Microsoft has released Free Software. Presumably because it allows them to make money. But I’m just guessing here.

Clearly the IIPA lawyers either do not understand the law or they lie to protect their business. Free Software is directly built upon copyright law and to say “it fails to build respect for intellectual property rights” is to babble illogically. How can copyrighted works undermine copyright? How can you claim that following law does not respect the law? You can’t of course, these are logical impossibilities. You would think it would also be a bit illogical to rail against “open source” software and then go ahead and run your web site on that self-same open source, but this is precisely what the IIPA does; their ranting nonsense web site is hosted on a Solaris machine. Did I mention they were incompetent?

Free Software is a material product which lends itself to capital markets. It is an efficient use of capital and brings with it huge return on investment. Companies large and small use Free Software daily to help them grow and prosper, that is a fact that IIPA fails to mention and one cannot help but wonder why.

Comments Off

MeeGo’s impact

February 17, 2010
Tags: ,

The impact that MeeGo will have on the mobile computing world should not be underestimated. It is a shot across the bow from two of the biggest names in computing. The message is simple: those who can develop, deploy, and market the best, win.

Why would Intel and Nokia bundle up some of their most crucial “intelectual property” and give it away to the Linux Foundation? Why else would they let in fierce competitors? Why else would they let in applications and frameworks and not keep complete control? The reason is that these companies feel they can compete with their competitors on a level playing field and win. They may in fact be right.

There are some losers in the whole switch from Moblin and Maemo, specifically those who have a lot at stake with keeping things as they are. As someone who’s worked with Maemo technology, the move from a debian environment to a rpm environment is a big move. I’ve worked with rpm previously however and have been working with the Moblin toolchain for a couple months now so I don’t feel like the rug has been pulled out from under me. Community and governance issues will be big though – there is an established Maemo community that just does not exist in Moblin. Moblin is software mostly, designed to run on Intel’s Atom chipset, there are not many devices that have inspired a loyal following like the Maemo devices have. It remains to be seen if Intel, the Linux Foundation, and Nokia can handle this community transition. I suspect they are not so interested in the community per se, as long as they can attract developers who in turn attract hardware buyers.

I am impressed to see a lot of the Maemo community joining in MeeGo immediately, they have sort of swamped the MeeGo infrastructure, but what role the Maemo council and the Maemo paid staff, such as myself, will play is going to be interesting to see. I think our role will be greatly diminished because I think the focus of the MeeGo project is going to be much more technical. I think sites like talk.maemo.org will live on but separate from the more developer-centric MeeGo.

1

MADDE – first impressions

January 21, 2010
Tags:

There is a pretty slick new development tool for the Maemo platform out now called MADDE. It is aimed at the Maemo sweetspot: Qt development. It works on the big three platforms, though I have only installed it on Linux.

MADDE is designed to make cross compiling and generally building applications easier, and it appears to be doing just that. Installation went smoothly and the documentation is concise and clear. MADDE even provides a debian directory, which is my particular interest at the moment, so let’s take a closer look there to see how MADDE can help you build debs.

The first thing you notice when using MADDE is that when you create a project with it, it creates not just project files, but debian files for you as well. In that debian directory you’ll see a bunch of example files – things you can use if you are going to create a debian README file, man pages and the like. For Maemo, we don’t use man pages, so you can simply remove any file that ends in .ex that you don’t want or need.

There are of course a variety of details of packaging you can go into, but what is very interesting with MADDE is that the package building is included. This means that you can call ‘mad dpkg-buildpackage’ and MADDE knows what to do and goes ahead and does it. You don’t need to fiddle with your environment, unless of course you want to, MADDE saves you a great deal of time by including all the needed tools for packaging.

I will discuss the implications of MADDE and packaging further, and I also hope to dive into some of the source code. (Dear Nokia, please consider releasing your perl modules to CPAN.) But my first impression of MADDE is that it is a huge time saver, and a great maemo development environment – try it out!

Comments Off

Two very good packaging resources

January 11, 2010
Tags:

Recently, while researching a blog post or two about how to package python apps, I’ve run across some really good resources on packaging that I’d like to point out. One is Ubuntu-oriented and the other is debian-oriented, but a deb is a deb so use which every one you prefer.

The first: https://wiki.ubuntu.com/PackagingGuide/Python is from the Ubuntu wiki which is a really good source for all things Ubuntu. The wiki entries tend to be clearly written and easy to read which is a blessing. This particular wiki entry takes one through packaging a python app from beginning to end in a straight forward manner – nothing really complex here. It should cover about 90% of the packaging requirements of python Maemo apps.

The second: http://www.debian-administration.org/articles/336 is from the site Debian Administration which is a great site. The site has an active community and some experienced admins post there so you’ll definitely find advanced topics like chroots, MTA configuration, etc. The article I pointed out is a fairly thorough discussion on packaging with some theory at the beginning.

The downside of the first article is that it describes using CDBS which requires more editing of files and is not as widely used as debhelper. The second article is a little older and doesn’t take advantage of the changes to debhelper that have come along in later versions. But between them I am sure you’ll find something useful and they are a great way to get started.

Comments Off

A call to arms! Maemo community arms that is.

December 29, 2009
Tags:

Gandhi said one has to become the change that one desires. To enable a change towards more openness, and make community generated bug fixes and improvements available to everyone who wants them, I’ve set up a community repository for updates to software that is not being maintained by anyone else. This repository hopefully can show that we are a committed group who can manage our own software distribution system and work together.

The repo is not yet public. It is currently set up on the new hardware that Nokia has generously provided us. I am looking for brave testers and for packages that might be suitable to put in our community repo. The discussion that was held at the Maemo summit in Amsterdam spoke only about SSU updates and that is all I think is really appropriate at this time, regular packages should of course end up in the usual place: extras. This does not mean that we should limit ourselves to just SSUs, but let’s start there and see what else needs to be added.

I thought I would set up a thread on Talk -> Development where we can co-ordinate our work.

Hope to see you there!

Comments Off