Archive for the ‘Programming’ Category

I’m looking for advice on developing a standalone web app for Windows. That is, the server side would be running locally.

So far I’ve got notes on Perl and necessary modules.

  • Strawberry Perl
  • DBI and DBD::SQLite
  • Plack and Mojolicious or Dancer
  • AnyEvent and Twiggy ?

I’m planning to remove MinGW / and the compiler to make the final package smaller.

Here is the list of installation software.

At the moment I’m leaning towards NSIS for no particular reason.

What I’m thinking is that the installation script will check for the existence of C:\Strawberry. Then it will run the Perl it finds there.

  • If it can’t find the directory, it can install it.
  • If the directory exists and the Perl is good, use it.
  • If the directory exists and the Perl is not good, abort with an error message.

Any input welcome.


Read Full Post »


(This is just a note for myself).

IPC::ConcurrencyLimit is a handy module for implementing a number of concurrency patterns.

Steffan Mueller mentioned it in a comment on my blog back in 2011. Since then, there have been a couple of articles about it on the Booking.com dev blog

Read Full Post »

Growing Perl

Chris Wellons has an interesting comment on Guy Steele’s classic Growing a Language which made me think of Perl:

  • The point about a more mature version of a language failing vs an earlier version can’t be right. For example, if Perl 4 and Perl 5 were released at the same time, which would people choose?
  • On the other hand, obviously Perl 5 would not exist, because of the lack of evolution, if it hadn’t been for Perl 4. I think I saw a speech by Larry where he said he had tried to lay grass down (e.g. symbol table hacking) for others to turn into sidewalks (e.g object orientation).
  • Perl 5 is nicely designed for evolution. Take the Try::Tiny module for example. How many commercially acceptable languages could you add Try/Catch/Finally too if it wasn’t already baked into the language?

Read Full Post »

Interesting discussion at lunch today. The Javarians asserted “Yes” (although I’m certain they didn’t think through the implications).

A good counterfactual would consider the result of the void left in 1996 without Java.

Smalltalk may have flourished. C# wouldn’t have been created and instead we would have seen VB7, VB8, etc. C++ would have been pressed into more unsuitable domains. Would there have been space for D… ?

However, this is not that article. We assumed the existence of C#, .NET and Mono. Clearly Java 1.0 would not survive if introduced into a 2013 world without Java

What about Java 7 or 8?

Without developers, even a great language is useless. You can’t hire developers for it. You don’t get third party libraries or people blogging (or writing on Stack Overflow) about how to solve various problems.

Enterprise developers from C++ would have migrated to .NET or Mono already depending on whether they were on Windows or Linux. Java wouldn’t be the great leap forward (for typical enterprise teams) that Java 1.2 was in 1998.

No, even Java 7 would not succeed if released today. A big part of what makes it successful is the huge number of talented and experienced Java developers.

What do you think? Do you agree or disagree?

Read Full Post »

Perl “Not Generators”

Reading through the Generators page on the Python wiki inspired me to knock up something almost completely unlike generators using closures (something Perl has that Python hasn’t…) just for fun.

Edit: correction, thanks Bernhard.

Standard preamble…

use strict;
use warnings;

The count() not-generator

sub count
    my $cnt = -1;
    return sub {
        return ++$cnt;

Helper function to make it easier to make not-generators

sub make_generator (&)
    my $sub = $_[0];
    my $finished = 0;
    return sub {
        return undef if $finished;
        local $_ = $sub->();
        $finished = 1 unless defined $_;
        return $_;

Composing not-generators

sub compose (&$)
    my ($op, $generator) = @_;
    return sub {
        local $_ = $generator->();
        return undef unless defined $_;
        return $op->($_);

Takewhile …

sub takewhile (&$)
    my ($match, $generator) = @_;
    return make_generator {
        local $_ = $generator->();
        return $match->($_) ? $_ : undef;

Foreach not-generator

I have to implement my own looping of course.

sub generator_for (&$)
    my ($fn, $generator) = @_;
    while (defined(my $ret = $generator->())) {

Whew. And finally, after all that I can do the squares thing.

my $squares = compose { $_ * $_ } count();
my $bounded_squares = takewhile { $_ < 100 } $squares;
generator_for { print @_, "\n" } $bounded_squares;

Read Full Post »

I finally got around to watching the Python keynote recommended by Steve. Two thirds of the “things we have that other people don’t have” is Python finally catching up with Perl features from 1995 and they were in other languages more than 10 years before that (is that ignorance or the Blub effect?). And we already have the rest in various libraries.

Oh well…

Read Full Post »

Stop me if you’ve heard this one:

A Perl programmer and a Python programmer walk into a bar.

Python dev says “why are you using Perl, Python is much clearer”

“What do you mean”, says Perl dev, “how is it clearer?”

“It’s obvious innit,” says Python dev. It’s cleaner and better It’s got, er, objects and stuff.

C/C++ integration aside, has anyone got anything more meaningful than “cleaner and better” ? I’m genuinely curious.

Read Full Post »

« Newer Posts - Older Posts »