Previous | Next

Cowsay fix

sub display_usage {
	die <<EOF;
cow{say,think} version $version, (c) 1999 Tony Monroe
Usage: $progname [-bdgpstwy] [-h] [-e eyes] [-f cowfile] 
          [-l] [-n] [-T tongue] [-W wrapcolumn] [message]
EOF
}
sub display_usage {
  @message = ("display_usage: cow{say,think} version $version, (c) 1999 Tony Monroe\n\
Usage: $progname [-bdgpstwy] [-h] [-e eyes] [-f cowfile]\n\
          [-l] [-n] [-T tongue] [-W wrapcolumn] [message]");
  @message = (split("\n", fill("", "", @message)));
  &construct_balloon;
  &construct_face;
  &get_cow;
  print @balloon_lines;
  print $the_cow;
  exit;
}
I copied most of this code from earlier in the program, where it prints the cow.

A better fix would be to re-arrange the code so that I didn't have to have two copies of these lines.

That's called "refactoring".