diff -Naur old/lib/Business/AU/ABN.pm new/lib/Business/AU/ABN.pm
--- old/lib/Business/AU/ABN.pm 2008-07-10 16:49:43.000000000 +1000
+++ new/lib/Business/AU/ABN.pm 2011-05-18 21:12:56.000000000 +1000
@@ -77,7 +77,7 @@
# An ABN with a "group number" attached is 14 digits.
my $group = '';
if ( length $abn == 14 ) {
- ($abn, $group) = /^(\d{11})(\d{3})$/ or die 'Regex unexpectedly failed';
+ ($abn, $group) = $abn =~ /^(\d{11})(\d{3})$/ or die 'Regex unexpectedly failed';
# Group numbers are allocated sequentially, starting at 001.
# This means that 000 is not a legal group identifier.
diff -Naur old/t/02_main.t new/t/02_main.t
--- old/t/02_main.t 2008-07-10 16:49:44.000000000 +1000
+++ new/t/02_main.t 2011-05-18 21:16:36.000000000 +1000
@@ -8,7 +8,7 @@
$^W = 1;
}
-use Test::More tests => 175;
+use Test::More tests => 211;
# Check their perl version
BEGIN {
@@ -43,6 +43,8 @@
# Format variations
'31103572158' => '31 103 572 158',
' 31 103 572 158 ' => '31 103 572 158',
+ ' 31 103 572 158 ' => '31 103 572 158',
+ '31103572158001' => '31 103 572 158 001',
);
while ( @good ) {
check_good( shift(@good), shift(@good) );
@@ -58,6 +60,7 @@
'12345678901234567890' => 'ABNs are 11 digits, not 20',
'31 103 572 157' => 'ABN looks correct, but fails checksum',
'31 103 572 157 ' => 'ABN looks correct, but fails checksum',
+ '31103572158000' => 'Cannot have the group identifier 000',
);
while ( @bad ) {
check_bad( shift(@bad), shift(@bad) );