sub generate_plaintext {

# leader name, leader school, follower name, follower school, events

  my ($file, $ret_ref, $i, $leader, $partners_ref,
      $follower, $j, $coup, $dances_ref, $k);

  $file="/tmp/.openimpetus_plaintext";
  open(OUT, ">$file") || Error::CantOpenFile($file);

  $ret_ref=Database::getNameSortedCompetitors();
  for ($i=0;$i<=$#$ret_ref;$i++) {
    $leader=$$ret_ref[$i];
    $partners_ref=Database::getFollowers($leader);
    if ($#$partners_ref>-1) {
      for ($j=0;$j<=$#$partners_ref;$j++) {
	print OUT $leader->getLName()."\t";
	print OUT $leader->getFName()."\t";
	print OUT $leader->getSchool()."\t";
	print OUT $leader->getEmail()."\t";
	$follower=$$partners_ref[$j];
	print OUT $follower->getLName()."\t";
	print OUT $follower->getFName()."\t";
	print OUT $follower->getSchool()."\t";
	print OUT $follower->getEmail()."\t";
	$coup=Couple->new($leader, $follower);
	$dances_ref=Database::getDancesByCouple($coup);
	print OUT $$dances_ref[0]->getAbbrev();
	if ($#$dances_ref>0) {
	  for ($k=1;$k<=$#$dances_ref;$k++) {
	    print OUT ", ".$$dances_ref[$k]->getAbbrev();
	  }
	}
	print OUT "\n";
      } # for $j over partners
    } # if $#partners>-1
  } # $i over competitors
  close(OUT);
}

1;
