--- cowsay.orig	Fri May 19 21:29:49 2000
+++ cowsay	Thu Apr  3 20:58:49 2008
@@ -7,7 +7,7 @@
 ##
 
 use Text::Tabs qw(expand);
-use Text::Wrap qw(wrap fill $columns);
+use Text::Wrap qw(wrap $columns);
 use File::Basename;
 use Getopt::Std;
 use Cwd;
@@ -16,7 +16,7 @@
 $progname = basename($0);
 $eyes = "oo";
 $tongue = "  ";
-$cowpath = $ENV{'COWPATH'} || '%PREFIX%/share/cows';
+$cowpath = $ENV{'COWPATH'} || '/usr/local/share/cows';
 @message = ();
 $thoughts = "";
 
@@ -184,4 +184,21 @@
 Usage: $progname [-bdgpstwy] [-h] [-e eyes] [-f cowfile] 
           [-l] [-n] [-T tongue] [-W wrapcolumn] [message]
 EOF
+}
+
+sub fill {
+    my ($ip, $xp, @raw) = @_;
+    my @para;
+    my $pp;
+
+    for $pp (split(/\n\s+/, join("\n",@raw))) {
+        $pp =~ s/\s+/ /g;
+        my $x = wrap($ip, $xp, $pp);
+        push(@para, $x);
+    }
+
+    # if paragraph_indent is the same as line_indent, 
+    # separate paragraphs with blank lines
+
+    return join ($ip eq $xp ? "\n\n" : "\n", @para);
 }
