[ic] postcode error checking

Brett Harrison bh@yhti.net
Thu, 19 Oct 2000 20:18:29 -0500


Mike,

I submitted a patch to you on 4.5.5 to change the _postcode() sub from:

sub _postcode {
         _zip(@_) or _ca_postcode(@_)
                 and return (1, $_[1], '');
         return (undef, $var, 'not a US or Canada postal/zip code');
}

to:

sub _postcode {
         ((_zip(@_))[0] or (_ca_postcode(@_))[0])
                 and return (1, $_[1], '');
         return (undef, $_[1], 'not a US or Canada postal/zip code');
}


in 4.5.7 I found the following :

sub _postcode {
         (_zip(@_))[0] or (_ca_postcode(@_))[0]
                 and return (1, $_[1], '');
         return (undef, $var, 'not a US or Canada postal/zip code');
}


At least with my current setup, this does not work :(  I replaced _postcode 
with my original patch and it once again works just fine.  I have only 
tested this on *one* machine which is running RH Linux 5.2 and Perl 
5.6.0.  Hope this info is usefull to you.

Just to clear up the above *mud*.  This code is working for me:

sub _postcode {
         ((_zip(@_))[0] or (_ca_postcode(@_))[0])
                 and return (1, $_[1], '');
         return (undef, $_[1], 'not a US or Canada postal/zip code');
}



Thanks,

-
Brett Harrison <bh@yhti.net>
http://www.yhti.net