[ic] Re: (update) postcode - OrderProfile check type

Mike Heins mikeh@minivend.com
Wed, 20 Sep 2000 03:50:22 -0400


Quoting Brett Harrison (bh@mail.yhti.net):
> I hope this is not too far off topic :)  but with the bug tracking database
> not yet functional on akopia's site, I just thought I'd share this here.
> 
> Here is what I found on my problem with the postcode OrderProfile check type:
> 
> in INSTALLARCHLIB/lib/Vend/Order.pm on line 1163 is the following code to
> perform the postcode checktype.
> 
> sub _postcode {
>         _zip(@_) or _ca_postcode(@_)
>                 and return (1, $_[1], '');
>         return (undef, $var, 'not a US or Canada postal/zip code');
> }
> 
> 
> This was not returning an error no matter what.  I'm not a hardcore perl
> hacker, but I believe this to be true because the list value that is
> returned by _zip() and _ca_postcode includes the error message which was
> being evaluated as true in _postcode(), thus causing it to return true all
> the time.  Here is my replacement for _postcode() which seems to have solved
> this problem.
> 
> sub _postcode {
>         ((_zip(@_))[0] or (_ca_postcode(@_))[0])
>                 and return (1, $_[1], '');
>         return (undef, $_[1], 'not a US or Canada postal/zip code');
> }
> 
> 
> Also notice that I changed the "$var" to "$_[1]" so that on a real failure,
> it returns the correct name of the form variable that is being checked.
> 
> 
> 
> If anyone has any better suggestions to keep posts of this type off the
> list, please pass them on to me.
> 
> Thanks!  and yes I think Interchange is very usable product!! and am looking
> forward to mastering it.
> 

Thanks very much! Patch incorporated.

-- 
Akopia, Inc., 131 Willow Lane, Floor 2, Oxford, OH  45056
phone +1.513.523.8220 fax 7501 <heins@akopia.com>

Just because something is obviously happening doesn't mean something
obvious is happening. --Larry Wall