[ic] mv_credit_card_reference

Mike Heins interchange-users@interchange.redhat.com
Tue Feb 19 10:23:00 2002


Quoting Javier Martin (martin@trymedia.com):
> Hi Mike,
> 
> May I follow up this conversation from long, long ago (2001-05-10). Here you
> said:
> 
> > If you want to do it inline, i.e. after the &credit_card, do:
> >
> > &calc=<<EOF
> >     # do something with $::Values->{mv_credit_card_reference};
> > EOF
> >
> > Make sure that returns a true value, otherwise the profile will
> > fail. You would be required to set any errors in $Session->{errors}
> > yourself.
> 
> 
> Now I have some doubts about this. The question is: should the return value
> of &calc terminate the profile if it is non-true? In my experience the
> results of &calc are always ignored. Look at Order.pm, sub check_order,
> lines 904-905 (IC 4.8.3):
> 
> 
>   ($val, $var, $message) = do_check(...);
>   next if ! $var;
> 
> 
> This means that the results of every pragma/check are ignored unless they
> return something in the 2nd position of the return array. Looking at the
> tag_calc code, I see that it always returns scalar!

You are absolutely correct. Oh, how I wish I had written that code just
one year after I did! Or fixed it back when it wouldn't have caused
so many problems.

> 
> So, what should be the good behavior of &calc=return 0;? To cause or not to
> cause profile failure?
> 

Hmm. At this point I would say that you should have to return(undef, 0) to
explicitly cause a failure. Anything else might cause systems to break.

-- 
Red Hat, Inc., 3005 Nichols Rd., Hamilton, OH  45013
phone +1.513.523.7621      <mheins@redhat.com>

Friends don't let friends use Outlook. -- Bob Blaylock