
http://pglaf.org/cgi-bin/unwrap.pl A few small changes: #!/usr/local/bin/perl -w use strict; # gbn use CGI::Carp qw(fatalsToBrowser); ########### read the user input my $buffer; my $thebook=""; # gbn read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); # Split the name-value pairs my @pairs = split(/&/, $buffer); foreach my $pair (@pairs) { (my $name, my $value) = split(/=/, $pair); # Un-Webify plus signs and %-encoding $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s/<!--(.|\n)*-->//g; # gbn: if ($allow_html != 0) { # $value =~ s/<([^>]|\n)*>//g; # } # gbn: $FORM{$name} = $value; $value =~ s/\cM//g; if ($name eq "theinput") {$thebook=$value}; } if ($thebook eq "") { $thebook='paste the text you want to unwrap in this field, and click "unwrap"...' }; print "content-type: text/html\n\n"; print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'; print "\n"; print "\n"; print '<head><title>unwrap p.g. paragraphs'; print '</title>'; print "\n"; print '<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">'; print '<body><pre>'; print '<form method="post"'; ######################################################### ### note that this line has to be changed to point to the appropriate ### place # gbn: print 'action="http://z-m-l.com/go/unwrap.pl">'; print 'action="http://pglaf.org/cgi-bin/unwrap.pl">'; ######################################################### print '<input align="left" type="submit" value="-- unwrap --"> '; print "\n"; print '<input type="hidden" name="unwrap" value="reporting...">'; print "\n"; print '<p align="left">'; print '<textarea name="theinput" rows=30 cols=80>'; print $thebook; print '</textarea>'; print '</p>'; print '<input type="hidden" name="hiddenname" value="hiddenvalue">'; ### the numbers here refer to a list of steps ### i posted in a message to gutvol-d ### #1 #skip #2 $thebook =~ s/\r\n/\n/g ; #3 $thebook =~ s/\r/\n/g ; #4 #skip #5 #skip #6 $thebook =~ s/ \n/\n/g ; $thebook =~ s/ \n/\n/g ; $thebook =~ s/ \n/\n/g ; $thebook =~ s/ \n/\n/g ; $thebook =~ s/ \n/\n/g ; $thebook =~ s/ \n/\n/g ; $thebook =~ s/ \n/\n/g ; $thebook =~ s/ \n/\n/g ; #7 $thebook =~ s/\n/ \n/g ; #8 $thebook =~ s/ \n \n/\n\n/g ; #9 $thebook =~ s/\n \n/\n\n/g ; $thebook =~ s/\n \n/\n\n/g ; $thebook =~ s/\n \n/\n\n/g ; $thebook =~ s/\n \n/\n\n/g ; #10 # wait! not yet! #11 $thebook =~ s/ \n /\n /g ; # maybe clone this for an asterisk in column 1, and # clone this for a number in column 1 which is # followed by a period-space in columns 2-3. $thebook =~ s/ \n>/\n>/g ; $thebook =~ s/ \n</\n</g ; $thebook =~ s/ \n\t/\n\t/g ; $thebook =~ s| \n/tab|\n/tab|g ; #12 $thebook =~ s/ \n/ /g ; print $thebook; print "</form></pre></body></html>"; On Wed, Apr 21, 2010 at 03:54:34PM -0400, Bowerbird@aol.com wrote:
michael said:
Let's have the code
sure thing, boss.
and install it where everyone can find/use it.
great idea...
Help Newby set it up later.
i don't think he will need any help, but yeah, sure.
and, of course, i invite people to improve the script.
-bowerbird
===========================================
#!/usr/local/bin/perl -w use CGI::Carp qw(fatalsToBrowser);
########### read the user input read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
# Split the name-value pairs @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); # Un-Webify plus signs and %-encoding $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s/<!--(.|\n)*-->//g; if ($allow_html != 0) { $value =~ s/<([^>]|\n)*>//g; } $FORM{$name} = $value; $value =~ s/\cM//g; if ($name eq "theinput") {$thebook=$value}; }
if ($thebook eq "") { $thebook='paste the text you want to unwrap in this field, and click "unwrap"...' };
print "content-type: text/html\n\n"; print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'; print "\n"; print "\n"; print '<head><title>unwrap p.g. paragraphs'; print '</title>'; print "\n"; print '<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">'; print '<body><pre>';
print '<form method="post"';
######################################################### ### note that this line has to be changed to point to the appropriate place ### print 'action="http://z-m-l.com/go/unwrap.pl">'; #########################################################
print '<input align="left" type="submit" value="-- unwrap --"> '; print "\n"; print '<input type="hidden" name="unwrap" value="reporting...">'; print "\n"; print '<p align="left">'; print '<textarea name="theinput" rows=30 cols=80>'; print $thebook; print '</textarea>'; print '</p>'; print '<input type="hidden" name="hiddenname" value="hiddenvalue">';
### the numbers here refer to a list of steps ### i posted in a message to gutvol-d ###
#1 #skip #2 $thebook =~ s/\r\n/\n/g ; #3 $thebook =~ s/\r/\n/g ; #4 #skip #5 #skip #6 $thebook =~ s/ \n/\n/g ; $thebook =~ s/ \n/\n/g ; $thebook =~ s/ \n/\n/g ; $thebook =~ s/ \n/\n/g ; $thebook =~ s/ \n/\n/g ; $thebook =~ s/ \n/\n/g ; $thebook =~ s/ \n/\n/g ; $thebook =~ s/ \n/\n/g ; #7 $thebook =~ s/\n/ \n/g ; #8 $thebook =~ s/ \n \n/\n\n/g ; #9 $thebook =~ s/\n \n/\n\n/g ; $thebook =~ s/\n \n/\n\n/g ; $thebook =~ s/\n \n/\n\n/g ; $thebook =~ s/\n \n/\n\n/g ; #10 # wait! not yet! #11 $thebook =~ s/ \n /\n /g ; # maybe clone this for an asterisk in column 1, and # clone this for a number in column 1 which is # followed by a period-space in columns 2-3. $thebook =~ s/ \n>/\n>/g ; $thebook =~ s/ \n</\n</g ; $thebook =~ s/ \n\t/\n\t/g ; $thebook =~ s| \n/tab|\n/tab|g ; #12 $thebook =~ s/ \n/ /g ;
print $thebook;
print "</form></pre></body></html>";
_______________________________________________ gutvol-d mailing list gutvol-d@lists.pglaf.org http://lists.pglaf.org/mailman/listinfo/gutvol-d