This week I got around to rebuilding all my local Perl module packages for the Perl 5.14.1 now in debian testing. Because that replaced the 5.12.4 that was previously running, I've rebuilt that into my homedir with perlbrew.
Added to the 5.10.1 I previously had, that's still one system and two custom installed perls I have. I try to remember to test everything before releasing it to CPAN on all these three.
At this point, I can't really be bothered to look after 5.8 as well, so effectively I'm no longer testing anything on 5.8. I'll still keep an eye on smoke-test results and see if they're passing or failing, and if I see a failure that looks easy to fix I might have a go at it. But no promises now.
If I manage to break anything on 5.8 in a module of mine and anyone actually cares about it, feel free to raise me a bug on rt.cpan.org. But apart from that, I hope I don't have to think too much about 5.8 any more.
My thoughts, ideas, and sometimes rants, on Perl, C, Linux, terminals,...
2011/11/24
2011/11/15
LPW2011 Talk Slides
If anyone wants to see the slides of the talks I co-presented with Tom this year at LPW, they're at
Though, at least the latter talk was mostly a series of code demos, so the slides alone won't make much sense.
Though, at least the latter talk was mostly a series of code demos, so the slides alone won't make much sense.
2011/11/03
Perl - Tiny lightweight structures module
$ cat struct.pm package struct; use strict; use warnings; sub import { shift; my ( $name, $fields ) = @_; my $caller = caller; my %subs; foreach ( 0 .. $#$fields ) { my $idx = $_; $subs{$fields->[$idx]} = sub :lvalue { shift->[$idx] }; } my $pkg = "struct::impl::$name"; no strict 'refs'; *{$pkg."::$_"} = $subs{$_} for keys %subs; *{$caller."::$name"} = sub { bless [ @_ ], $pkg }; } 1; $ perl use struct Point => [qw( x y )]; my $p = Point(10,20); printf "Point is at (%d,%d)\n", $p->x, $p->y; $p->x = 30; printf "Point is now at (%d,%d)\n", $p->x, $p->y; $p->z = 40; __END__ Point is at (10,20) Point is now at (30,20) Can't locate object method "z" via package "struct::impl::Point" at - line 6.
It's specifically and intentionally not an object class. You cannot subclass it. You cannot provide methods. You cannot apply roles or mixins or metaclasses or traits or antlers or whatever else is in fashion this week.
On the other hand, it is tiny, single-file, creates cheap lightweight array-backed structures, uses nothing outside of core. And I defy anyone to even measure its startup overhead with a repeatable benchmark.
It's intended simply to be a slightly nicer way to store internal data structures, where otherwise you might be tempted to abuse a hash, complete with the risk of typoing key names.
Would anyone use this, if it were available?
Subscribe to:
Posts (Atom)