
Acme::DarmstadtPM::TieHash - a module that shows that Perl can do all the Ruby things ;-)

1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5 use Test::More tests => 2;
6
7 use constant ADT => 'Acme::DarmstadtPM::TieHash';
8
9 use_ok(ADT);
10
11 tie my %hash,ADT,sub{$_[0] + $_[-1]};
12
13 is($hash{[1,5]},6,'Check [1,5]');
14
15 untie %hash;

Test

Ronnie Neumann sent a mail to the mailinglist with some good Ruby stuff. I said, that all these things can be done in Perl, too. So this module is a proof how smart Perl is...

copyright 2006 (c) Renee Baecker <module@renee-baecker.de>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.