OK. Ignore all the lines starting with a # sign. They are commented out. If
you don't know what that means, stop reading now and learn some basic
programming...

local(@acc_fields) = @_;

create an array called acc_fields which exists only within the subroutine
called accum_cycle_count. Populate that array with data passed to the
accum_cycle_count subroutine.

return(-810) if ( $acc_fields[0] == 0 || $acc_fields[0] eq '' );

Stop processing the accum_cycle_count routine and return a value of -810 if
the first value in the acc_fields array is 0 or is a null value.

return(-811) if ( $acc_fields[1] eq "" );
return(-812) if ( $acc_fields[2] eq "" );
return(-813) if ( $acc_fields[7] < 0 );

These also return but with a value of -811 if the second element in the
acc_fields array is null, -812 if the third element is null and -813 if the
eigth element is less than 0 (i.e a negative value)

$acc_fields[8] = &get_date if ( $acc_fields[8] eq '' );

This runs the subroutine called get_date and stores the value it returns in
the acc_fields array at location 9. The get_date routine is run only if the
value of the data at location 9 in the acc_fields array is null.

return(&send_ddc("tdilc5110b000","accum_cycle_count",@acc_fields));

Finally the routine runs another subroutine call send_ddc, passing the data
above as a list which is available to the send_ddc routine in the @_ array
(The data in the acc_fields array is passed in a list context to the
send_ddc array. For example if the data in acc_fields was @acc_fields =
qw(one two three), then the code above would be eqiuvalent to 

return(&send_ddc("tdilc5110b000","accum_cycle_count","one","two","three"));


Anyway. Whatever the routine send_ddc returns is itself returned by the
accum_cycle_coun routine.

HTH

John

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 25 June 2001 15:59
To: [EMAIL PROTECTED]
Subject: Reading Code


Can anyone tell me how to read this bit of code in english ?

> sub accum_cycle_count
> {
>      # @acc_fields are:
>      #    0 - Cycle Counting Order
>      #    1 - Warehouse
>      #    2 - Location
>      #    3 - Item Code
>      #    4 - Container
>      #       5 - Lot Code
>      #       6 - Storage Unit
>      #       7 - Counted Inventory
>      #    8 - Counting Date
>
>      local(@acc_fields) = @_;
>      return(-810) if ( $acc_fields[0] == 0 || $acc_fields[0] eq '' );
>      return(-811) if ( $acc_fields[1] eq "" );
>      return(-812) if ( $acc_fields[2] eq "" );
>      return(-813) if ( $acc_fields[7] < 0 );
>      $acc_fields[8] = &get_date if ( $acc_fields[8] eq '' );
>
>      return(&send_ddc("tdilc5110b000","accum_cycle_count",@acc_fields));


--------------------------Confidentiality--------------------------.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.


Reply via email to