More Code 

sub format {
  my($self, $text) = @_;

  $text =~ s/\A\s+//;
  $text =~ s/\s+\Z//;
  return $text;
}