$csv->column_names($csv->fields);
while (my $phash = $csv->getline_hr($fh)) {
+
+ # If the ID value is less than 4 characters, pad the value
+ # with zeros to be 4 characters long. This will effect
+ # the barcode and password.
+ # Only do this for teacher accounts.
+ $phash->{student_id} = sprintf('%0.4d', $phash->{student_id})
+ if $is_teacher && length($phash->{student_id}) < 4;
+
# Teacher cards have an extra 't' between district code and ID.
$phash->{barcode} = $district_code .
($is_teacher ? 't' : '') . $phash->{student_id};
+
$row_handler->($phash);
}