[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] order.profile logic commands
At 01:30 PM 4/30/2002 -0700, you wrote:
>I tried using the code from the Docs, I added it to the catalog.cfg. And
>now interchange gives me a timeout error when I Apply Changes to the
>catalog. Here is the exact code I'm adding, is there any reason it wouldn't
>work?
>
>GlobalSub <<EOF
> sub set_up_extra_check {
> BEGIN {
> package Vend::Order;
> sub _date_past {
> my($ref, $var, $val) = @_;
>
> $_ = $val;
> my ($mo, $da, $yr) =
>/(^\d{1,2}).(\d{1,2}).(\d\d\d\d|\d\d)/;
>
> my ($DAY, $MONTH, $YEAR) =
>(localtime)[3,4,5];
> $YEAR += 1900;
> $YEAR = $YEAR - 18;
> my $error_msg = "bad things";
> if ($yr < $YEAR){
> return (1, $var, '');
> } elsif ($yr == $YEAR){
> if ($mo < $MONTH){
> return (1, $var, '');
> } elsif ($mo == $MONTH){
> if ($da < $DAY){
> return (1, $var,
>'');
> } else {
> return (undef,
>$var, $error_msg);
> }
> } else {
> return (undef, $var,
>$error_msg);
> }
> } else {
> return (undef, $var, $error_msg);
> }
> return (1, $var, '');
> }
> }
> }
>EOF
>
>
>-----------------------------------------
>Brendan Crosser-McGay
Probably a problem with line breaks, I wasn't thinking of that when I
posted it. Either way, check the error.log when you apply changes for clues.
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Dan Browning, Kavod Technologies <db@kavod.com>
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Steinbach's Guideline for Systems Programming:
Never test for an error condition you don't know how to
handle.