Forum Moderators: coopster & phranque

Message Too Old, No Replies

Wrapping text in a CGI based form

         

ezehra

10:45 am on Jul 5, 2003 (gmt 0)

10+ Year Member



Hi

Need solution to a CGI scripting problem in Perl:

There is a form in which some one has entered a paragraph of text in the text area and submitted it. The results are supposed to display in the next page, but the resulting text has to be wrapped in 64 characters. What will be the coding for this function in the form?

Thanks

netcommr

1:57 am on Jul 6, 2003 (gmt 0)

10+ Year Member




use Text::Wrap

my @text = ('your data here');
my $t1 = '4'; #indent on first line
my $t2 = '0'; #indent on rest of lines
$Text::Wrap::columns = 64;
print wrap($t1, $t2, @text);

ezehra

4:34 am on Jul 7, 2003 (gmt 0)

10+ Year Member



I'll try that.

Thanks!

emunir

11:34 am on Jul 10, 2003 (gmt 0)

10+ Year Member



This code gave me an error.

I also tried:
use Text::Wrap
$Text::Wrap::columns = 72;
my $comments = wrap('','', $rawcomments);
print $comments;

This didn't give an error but no wrapping occured.

Any suggestions?

Erum

netcommr

2:12 pm on Jul 12, 2003 (gmt 0)

10+ Year Member




This [perldoc.com] may be more help...

make sure the module is installed on your server!