Ok,
Essentially I am trying to read a file into an array, and
then display the contents of the array inside the text box.
My eventual goal is to display XML text from a file in the text area.
here is the code I am using:
#!/usr/bin/perl -T use strict; use warnings; use CGI qw(:standard); use CGI::Carp qw(warningsToBrowser fatalsToBrowser); my $cgi = new CGI; print $cgi->header(); print $cgi->start_html('My test text box'); print $cgi->startform; open my $FHIN, '<', "./test.file" || die "$!"; my @fhin = <$FHIN>; print $cgi->textarea( -name=>'TEXT_AREA', -default=>"@fhin"); print "<textarea> @fhin </textarea>"; print $cgi->end_html();


this produces two empty text boxes. running this from the command line results in:
Content-Type: text/html; charset=ISO-8859-1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-U +S"> <head> <title>My test text box</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1 +" /> </head> <body> <form method="post" action="http://localhost" enctype="application/x-w +ww-form-urlencoded"> <textarea name="TEXT_AREA" >this is a test file this is line two three 4 foo bar six </textarea><textarea> this is a test file this is line two three 4 foo bar six </textarea> </body>
So I know the text is being read into the array. But looking at the source of the page shows no text is being passed:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-U +S"> <head> <title>My test text box</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1 +" /> </head> <body> <form method="post" action="/cgi-bin/cfg_edit.cgi" enctype="applicatio +n/x-www-form-urlencoded"> <textarea name="TEXT_AREA" ></textarea><textarea> </textarea> </body> </html>

and this is the contents of my test.file:
this is a test file this is line two three 4 foo bar six

In reply to Re: Perl CGI Text box by PyrexKidd
in thread Perl CGI Text box by PyrexKidd

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.