in reply to Re^3: globbed variable in parse cgi form - beyond me
in thread globbed variable in parse cgi form - beyond me

Ikegami,

Noted

Replies are listed 'Best First'.
Re^5: globbed variable in parse cgi form - beyond me
by davido (Cardinal) on Jun 27, 2011 at 19:29 UTC

    You said: CGI.pm produces xhtml and I am writing in 4.01 strict currently

    The documentation says:

    -no_xhtml

    By default, CGI.pm versions 2.69 and higher emit XHTML (http://www.w3.org/TR/xhtml1/). The -no_xhtml pragma disables this feature. Thanks to Michalis Kabrianis <kabrianis@hellug.gr> for this feature.

    If start_html()'s -dtd parameter specifies an HTML 2.0, 3.2, 4.0 or 4.01 DTD, XHTML will automatically be disabled without needing to use this pragma.

    It's been awhile since I really read the CGI documentation, and it's had multiple revisions since then. But I found that in about six seconds. Here's how you do it: First you point your browser to http://search.cpan.org. Next type, "CGI", and click on the first distribution listed. Then type into your browser's text-search box "xhtml". The paragraph I posted was the first thing that showed up. Consider this a brief tutorial on how to get a quick answer to a module concern.


    Dave

      Yes I expected there would be something to switch off xhtml. I tried - use CGI qw/:html4/; but maybe that has more to do with importing methods.

      As a third point I forgot to mention a lot of the styling is rendered from css so that negates the use of attributes a bit too.

      The real difficulty i am having now that i have extracted the data using the param methods is in relation to placing a textareas' value into a non textarea element such as a regular div and making it format to P or BR at the newline. I've tried mixing cgi methods with arrays and array scalars explicit and sometimes very explict. lol. And trying to regexp substitute P tags with existing carriage returns and newlines but I just cannot get that value to split and format from a predifined newline character(? i saw a ^M at one point if i can figure waht that is maybe im in with a shot). Maybe I have to tr/%daf/pack hex/ as i haven't done that yet.

      my $ctp = CGI->new; my $webmaster = "http\:\/\/www.mysite.com\/"; my @names= $ctp->param; my @values; foreach my $name(@names){ my $value = $ctp->param($name); push(@values, $value); } # print "Content-type: text/plain\r\n\r\n"; my @tone = $ctp->param('tone'); #print $ctp->p(tone); my $doob; #print $ctp->p("@tone"); print "\@tone: @tone\n\n"; if ($tone[0] =~ m/\\n/){ print "[^f]*. globals and carriage returns an +d zero array value arrays !!\n\n"; } foreach my $toneadd(@tone){ if ($toneadd =~ m/\\r\\n/){ print "[^f]*. globals and carri +age returns!!\n\n"; $toneadd =~ s/\\r\\n/<\/p><p>/;} $doob .= $toneadd; print "\$toneadd: $toneadd\n\n"; } my @tone = $ctp->param('tone'); foreach my $toneadd(@tone){ $line .= "<p>$toneadd<\/p>"; } print $line; print "\$doob: $doob\n\n"; print "<p>$doob<\/p>\n\n";

      Which after another quick & useless debug sesh, I think is shifting me back round to the initial importing through a glob query. Though I can just go and re-open the file again and them in afterwards maybe a good enough workaround even if time consuming.

      OR I gotta read some more stuff somewhere....

        $ perldoc CGI |grep -i xhtml -C1 -no_xhtml By default, CGI.pm versions 2.69 and higher emit XHTML (http://www.w3.org/TR/xhtml1/). The -no_xhtml pragma disables +this feature. Thanks to Michalis Kabrianis <kabrianis@hellug.gr> fo +r this -- If start_html()'s -dtd parameter specifies an HTML 2.0, 3.2, 4 +.0 or 4.01 DTD, XHTML will automatically be disabled without needing + to use this pragma. -- The -encoding argument can be used to specify the character set fo +r XHTML. It defaults to iso-8859-1 if not specified. -- Otherwise it will be replaced by the default DTD. If the public DT +D contains 'XHTML', CGI.pm will emit XML. The -declare_xml argument, when used in conjunction with XHTML, wi +ll put a <?xml> declaration at the top of the HTML header. The sole purpo +se of -- action: this script enctype: application/x-www-form-urlencoded for non-XHTML multipart/form-data for XHTML, see multipart/form-dat +a below. -- If XHTML is activated (the default), then forms will be automatically created using this type of encoding. -- The start_form() method uses the older form of encoding by default unless XHTML is requested. If you want to use the newer form of en +coding by default, you can call start_multipart_form() instead of start_f +orm().
Re^5: globbed variable in parse cgi form - beyond me
by ikegami (Patriarch) on Jun 27, 2011 at 18:41 UTC

    CGI.pm produces xhtml and I am writing in 4.01 strict currently

    You can use CGI.pm for parameter handling without using it for markup generation.