start | find | index | login or register | edit
2008-10-01
by earl, 3655 days ago
Let's ignore worldwide financial tumults and regional political mumbo-jumbo for a few minutes and explore some more parts of Helma NG instead. Quite a few things changed my last post on 2008-09-05, and today I'll concentrate on a few changes I contributed to :) Welcome to vanity fair!

Let me start by repeating the warning from last time: Helma NG is rapidly developing work in progress, if this gets you interested, you might want to join the Helma NG mailing list. That said, let's dive right in.

Packaging, Installation

For convenience, Helma NG now comes bundled as a binary-only Debian package as well. Until there's an official place to download ready-made packages from, you'll have to build the .deb yourself, by invoking ant dpkg. As a result you'll have a shiny and fresh helma-ng_0.2.deb (the version number obviously might change in the future) which you can install on Debian-based distributions with dpkg -i helma-ng_0.2.deb. Once that's done, invoke helma from your shell, enter 21 * 2 and you'll be closer to truth.

You might want to have a look at a shell transcript of these steps.

Shell Integration

If you've worked in Unix-land even for only the shortest of times, you'll have come across the infamous shebang line used to execute scripts written in e.g. Bash, Perl, Python or Ruby. If you installed Helma NG via the Debian package, you can use helma as script interpreter (via /usr/bin/env).

So a simple "Hello, World" example would now be:
#!/usr/bin/env helma
include('helma/shell');
writeln('hello, world!');
Save this as hello.js, flag it as executable via chmod +x hello.js and then execute it:
$ ./hello.js
hello, world!
Nice, ey? As hinted at in the last post, Helma NG is gearing up to becoming a general-purpose server-side JavaScript framework. And the most important part of that are the libraries shipped with Helma NG. So to wrap this up, let's have a look at ...

Skinning

One of those nice libraries is helma.skin, a quite advanced templating system that goes well beyond what was provided in Helma 1. The demo webapp shipped with Helma NG provides a showcase of skinning features.

For now, here's a quick teaser that shows how to use skins in shell apps:
#!/usr/bin/env helma
include('helma/shell');
include('helma/skin');

writeln(render(createSkin('hello, <% name %>!'), {name: 'world'}));
Amazing, isn't it?

Fin!

Well, I hope you enjoyed this run-through. I'm sure you noticed the different ways modules were loaded in the two examples here compared to the example from last time. As Helma NG's module system is one of the many things to get excited about, maybe I'll run you through its capabilities in a future post.

Updates

2008-11-07: Updated to reflect recent changes to the module system.
2009-05-19: Adapted to the changes in the module system that shipped with Helma NG 0.3.
powered by vanilla
echo earlZstrainYat|tr ZY @.
earl.strain.at • esa3 • online for 6652 days • c'est un vanilla site