The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> Perl Programming
|
Process value from TEXTAREA. Help Please!!!
Discuss Process value from TEXTAREA. Help Please!!! in the Perl Programming forum on Dev Shed. Process value from TEXTAREA. Help Please!!! Perl Programming forum discussing coding in Perl, utilizing Perl modules, and other Perl-related topics. Perl, the Practical Extraction and Reporting Language, is the choice for many for parsing textual information.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

August 9th, 2000, 10:04 AM
|
|
Junior Member
|
|
Join Date: Aug 2000
Location: Lanham,MD,US
Posts: 7
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Dear all,
Can you please give me ideas on how to use CGI.pm param() function (or any other ways) to get the text in a TEXTAREA box? I got the value from param() function; however, it ate up the "n", making my text all in one line.
Thank you very much. I really appreciate your help.
Nam.
|

August 9th, 2000, 12:03 PM
|
|
Contributing User
|
|
Join Date: Aug 2000
Location: Indiana
Posts: 614
  
Time spent in forums: 4 h 49 m 49 sec
Reputation Power: 14
|
|
|
Foget about CGI.pm.
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
####Post Data
read(STDIN, $namevalues, $ENV{'CONTENT_LENGTH'});
@namevalues = split(/&/, $namevalues);
foreach $namevalue (@namevalues) {
($name, $value) = split(/=/, $namevalue);
$name =~ tr/+/ /;
$value =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$INPUT{$name} = $value;
}
[/code]
That will parse POST data. if you want to turn n's into <br>'s just add these lines above "$INPUT{$name} = $value;":
#####
$value =~ s/n/<br>/g;
$value =~ s/r//g;
#####
[This message has been edited by JonLed (edited August 09, 2000).]
|

August 9th, 2000, 01:10 PM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
Just be sure NOT to wrap line if the output is to be emailed to you. Do the wrap line otherwise. Also include the following:
$body =~ s/nn/<p>/g;
$body =~ s/n/<br>/g;
Try not to use CGI.pm if possible. I don't even use CGI.pm to upload something from web-based.
[This message has been edited by freebsd (edited August 09, 2000).]
|

August 9th, 2000, 01:26 PM
|
|
Junior Member
|
|
Join Date: Aug 2000
Location: Lanham,MD,US
Posts: 7
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Dear freebsd,
I'm a newbie. You mean not to put "WRAP" in the html TEXTAREA box?
I would like to ask you how to upload a file without cgi.pm later when I do it.
Currently I cgi.pm helps me with parsing, cookies, and upload. Can you tell me why we should NOT use CGI.pm?
Thank you very much, freebsd.
Nam.
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by freebsd:
Just be sure NOT to wrap line if the output is to be emailed to you. Do the wrap line otherwise. Also include the following:
$body =~ s/nn/<p>/g;
$body =~ s/n/<br>/g;
Try not to use CGI.pm if possible. I don't even use CGI.pm to upload something from web-based.
[This message has been edited by freebsd (edited August 09, 2000).][/quote]
|

August 9th, 2000, 03:45 PM
|
|
Contributing User
|
|
Join Date: Aug 2000
Location: Indiana
Posts: 614
  
Time spent in forums: 4 h 49 m 49 sec
Reputation Power: 14
|
|
|
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>$body =~ s/nn/<p>/g;
$body =~ s/n/<br>/g;[/quote]
I don't like to use <p>'s. That's just me though. (2 <br>'s has the same effect).
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Currently I cgi.pm helps me with parsing, cookies, and upload. Can you tell me why we should NOT use CGI.pm? [/quote]
Because 1) It doesn't let you do what you want to do with the incoming text (or whatever's coming in). 2) Not all server's have it installed. I know most do, but not all. 3) Now YOU have to come here and ask how to do something because you didn't learn it from having to figure out parsing (or at least examine somebody else's code).
It's not like doing things "the old fashion way" is hard. I personally get more satisfaction from figuring out something myself and knowing how it works, rather than just sticking something in and hoping it'll work all the time.
[This message has been edited by JonLed (edited August 09, 2000).]
|

August 9th, 2000, 04:06 PM
|
|
Junior Member
|
|
Join Date: Aug 2000
Location: Lanham,MD,US
Posts: 7
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Thank you! Yes, it's time for me to dig into it.
Nam.
|

August 18th, 2000, 05:21 AM
|
|
Contributing User
|
|
Join Date: May 2000
Posts: 73
Time spent in forums: < 1 sec
Reputation Power: 14
|
|
|
Hi Nam
if you are looking to print the text into a html page and keep it in the format it was typed you could try wrapping it in a pre tag
eg: <PRE>
$your_textarea_variable
</PRE>
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|