Tag Archives: perl

Lexical Attributes

A week or two ago, I took an idea from Aristotle about “shortcut” functions and made it into a little module: Attribute-Shortcut. Aristotle pointed out in the comments that the attributes should also work on coderefs as well as named subs. i.e.

sub basename :Shortcut { s!.*/!! for @_ };
my [...]

Constant Pain

Trelane was complaining about Image::Imlib2 the other day. Apparently, it accepts any method call without error. i.e. it’s a blackhole object.
A quick inspection of the source revealed two things:

An AUTOLOAD() method, to resolve unknown method calls.
A constant() function in the XS to resolve names to constant values. This was being called [...]

XML::Genx 0.21

I’ve released a new version, which fixes a blindingly obvious error: you couldn’t pass in characters between \x80 and \xff unless they had the UTF-8 flag turned on. I don’t know how I missed that.

XML::Genx 0.21

XML::Genx Plans

I was talking to Mark Fowler yesterday and XML::Genx came up. He had a couple of good points:

It’s not absolutely clear in the documentation that any valid Perl string will work correctly (be it UTF-8 encoded or not). I need to double check the tests for this and amend the docs.
The API is [...]

New Releases

I’ve just done a couple of new releases of my modules:

JavaScript::JSLint 0.04, which is just renaming from Lint to JSLint to more accurately reflect where it’s come from (pointed out by Matthias Miller).
subatom 0.07 which switches from the baroque XML::Atom api to the much nicer XML::Atom::SimpleFeed (thanks, Aristotle).
subatom 0.08 because I am a doofus and [...]

JavaScript::Lint 0.02

I’ve just put together a new version of JavaScript::Lint. The main new thing is that you can now specify options to control how the lint works. You probably want to enable the undef option, for instance.
I also fixed a problem where I was covering up errors when the lint couldn’t do anything more [...]

JavaScript::Lint

After whinging gratuitously about how cruddy non-browser JavaScript is, Mark Fowler kindly pointed me in the right direction to get Perl integration working: JavaScript.pm.
So now I’ve wrapped up JSLint into a small command line tool (and Perl lib), JavaScript::Lint.
It’s fairly simple at the moment. I plan to add support for the options in jslint [...]

mod_perl 2 not ready yet

I’ve spent nearly three days this week trying to port one of our sites to Apache 2.2 and mod_perl 2.0.2 (from Apache 1.3.33). It should be a relatively simple exercise thanks to the porting notes available:

Upgrading to 2.2 from 2.0
Upgrading to 2.0 from 1.3
A Reference to mod_perl 1.0 to mod_perl 2.0 Migration.

Yet sadly, there’s [...]

Perl List Slice Weirdness

A colleague at work just found this little gem in File::Copy::Recursive:

my $two = join ‘-’, ( stat $cur )[0,1] || ”;

That should pick out the device and inode, join them with a hyphen and set $two to the empty string if the stat failed. However, there’s a precedence problem:

# Intended [...]

Java Leads To Great Libraries

Tim Bray wrote Having Done Java about how writing Java leads to better quality libraries. Needless to say, I disagree. I originally sent this by mail to Tim Bray, but I don’t think that there’s any reason to not publish it here as well.
I’m afraid that I’m going to have to disagree with [...]