I have taken 'cgi' in now and can use it to produce a basic site in HTML. The DTD does have it's own paramater in the start_html function/method. So I was able to explicitly define the document type to that of one with which I am familiar.
The issue of the multiline text newline remains. After making a workaround, I think the correct way to access the value for a textarea is to dereference the hash containing the postdata directly and manipulate the strings accordingly. Back to square one, that is currently beyond my skills. CGI appears to be helpful by removing the hardcoded return newline/carriage returns. Either this or it is an encoding issue, and the header encoding is constructed incorrectly in my script so the browser interprets it incorrectly for html. Or a mixture of the two.
Workaround: Send textarea value to datafile readit back in as an array of lines, chop the \r and \n off and join with p tags.
may be issues with using chop here. But for the moment returns the multiline in a multiline format. (pls dont tell me I can use sprintf here I will go bonkers!)
so:returns#! /usr/bin/perl -Tw use strict; use warnings; use CGI qw(-no_xhtml); use CGI::Carp qw(fatalsToBrowser warningsToBrowser); my $bar=CGI->new; print $bar->header('text/html'); print $bar->start_html(-title => 'newsite2', -dtd => [ '-//W3C//DTD HTML 4.01 Strict//EN', + 'http://www.w3.org/TR/html4/strict.dtd' ], -lang => 'en-UK', -meta => {'keywords'=>'something about my site +', 'author' => 'me silly'}, -xbase => 'http://www.mysite.com/', -style => {'-src' =>'scr/style.css'}, -script=> {'-src' =>'scr/jscript.js'}, ); print $bar->start_div();&n; #print $bar->param($bar(param('multitext'));&n; my @parnames = $bar->param; print @parnames; print "<ul>";&n; my $count=0; foreach my $next(@parnames){ $count++; print "<li>$count: $next: ".$bar->param($next)."</li>\n" or die "didnt + print it: $!\n"; } print "</ul>";&n; &multilinetext; print $bar->end_div();&n; print $bar->end_html();&n; sub multilinetext{ open(my $mt, ">", "./multitext.dat") or die "theres no flowering multi +text file in this directory to write to you numskull, ahem I mean: $!\n";&n; print $mt "mt: \n".$bar->param('multitext');&n; close $mt or die "opened for write but sure as rain won't close now ha +haha!: $!\n";&n; open($mt, "<", "./multitext.dat") or die "you just wrote this and you +cant remember what. Tough this file is staying closed. That is to say: $!\n"; our @mta=(); while (my $line=<$mt>){ chop($line) or die "chop-1? $!";&n; chop($line) or die "chop-2? $!";&n; push(@mta, $line);&n; } close $mt or die "before closing this file I saw your array function p +fffft! stop .. please. I can't breathe properly. You better close this: $!\n";&n; print "<p>"; my $amt = join("</p>\n<p>", @mta); print $amt; print "</p>"; #print scalar(@mta).": ".@mta or die "Im not kidding! you should write + comedy for a living: $!\n";&n; } &n;&n; sub n{print "\n";}&n;&n; exit(0);
to the html and therefore the browser instead of returning a text encoded format to the html but not the browser.<p>mt:</p> <p>peter piper picked a peck of pickled peppers123</p> <p>a peck of pickled peppers peter piper picked123</p> <p>if peter piper picked a peck of pickled peppers</p> <p>where's the peck of pickled pepper peter piper picked?</p> <p></p>
<li>3: multitext: peter piper picked a peck of pickled peppers123 a peck of pickled peppers peter piper picked123 if peter piper picked a peck of pickled peppers where's the peck of pickled pepper peter piper picked? </li>
I will need to look a little more into encoding types . For quick and easy I found 'Impatient Perl' by Greg London to be a great quick reference for syntax and structures. Thanks for all help on this, CGI is actually a pretty neat module once you've learnt to use it.
Don C
In reply to Re^7: globbed variable in parse cgi form - beyond me
by Don Coyote
in thread globbed variable in parse cgi form - beyond me
by Don Coyote
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |