Subject: | What about the accumulator ? |
Hi,
from the HQ9+ specification I found the command '+' should increment the accumulator. However, in the Perl5 implementation an empty sub is executed.
This looks incorrect to me.
A patch is attached.
CU, Bernhard
diff -r -u HQ9PLUS-0.4/Makefile.PL HQ9PLUS-0.5/Makefile.PL
--- HQ9PLUS-0.4/Makefile.PL 2003-06-04 21:28:27.000000000 +0200
+++ HQ9PLUS-0.5/Makefile.PL 2004-11-21 23:44:11.000000000 +0100
@@ -4,7 +4,7 @@
WriteMakefile(
'NAME' => 'HQ9PLUS',
- 'VERSION' => '0.4',
+ 'VERSION' => '0.5',
'EXE_FILES' => [ 'lib/hq9p' ],
Nur in HQ9PLUS-0.5/lib: hq9p.
diff -r -u HQ9PLUS-0.4/lib/hq9p.PL HQ9PLUS-0.5/lib/hq9p.PL
--- HQ9PLUS-0.4/lib/hq9p.PL 2003-06-04 21:28:59.000000000 +0200
+++ HQ9PLUS-0.5/lib/hq9p.PL 2004-11-21 23:44:02.000000000 +0100
@@ -28,8 +28,8 @@
__END__
-use vars qw[$VERSION %COMMANDS $PROGRAM $SRC];
-$VERSION = (qw$Revision 0.4$)[1];
+use vars qw[$VERSION %COMMANDS $PROGRAM $SRC $accumulator];
+$VERSION = (qw$Revision 0.5$)[1];
%COMMANDS = (
'h' => sub { print "Hello, world!\n" },
@@ -54,13 +54,14 @@
}
print "No more bottles of beer on the wall.\n";
},
- '+' => sub { },
+ '+' => sub { $accumulator++ },
);
die "Usage: $0 [program | -]\n" unless @ARGV == 1;
$PROGRAM = shift;
$SRC = '';
+$accumulator = 42;
if ( $PROGRAM eq '-' ) {
*PROG = *STDIN;