Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: [Perl-CGI] Print non-interpolated string

by graff (Chancellor)
on Apr 03, 2014 at 23:45 UTC ( #1081040=note: print w/ replies, xml ) Need Help??


in reply to [Perl-CGI] Print non-interpolated string

If you want to preserve white-space patterns (e.g. line breaks, line-initial spaces, etc) when the browser displays the submitted text, you should apply the conversions described by choroba above, and then

print qq{<pre>\n$text\n</pre><br/>};


Comment on Re: [Perl-CGI] Print non-interpolated string
Download Code
Re^2: [Perl-CGI] Print non-interpolated string
by Digioso (Novice) on Apr 04, 2014 at 08:22 UTC
    Thanks for this. :)
    It works with chorobas snippet and yours.
    I tried the escapeHTML function but Perl said that it couldn't find this one. According to the version 3.65 manual escapeHTML is being executed automatically.
    My webserver has CGI.pm version 3.42 installed.
    So my guess is that escapeHTML is a feature that was introduced in a later version.

      I tried the escapeHTML function but Perl said that it couldn't find this one.

      If you want to use the functional interface, either import the function, or use its fully qualified name (full name)

      According to the version 3.65 manual escapeHTML is being executed automatically.

      Well, you didn't understand what you read -- you're not using any of the form generators which would do this automatically

      So my guess is that escapeHTML is a feature that was introduced in a later version.

      Its been there for at least 20 years

        Thanks, I managed to fix it.
        The documentation is... let's say not really clear on how to use it.
        It says: $escaped_string = escapeHTML("unescaped string");

        But for manual use it's $escaped_string = $cgi->escapeHTML("unescaped string");
        Unfortunately this is not mentioned in the documentation but Google found the Syntax for me. This method is not importet by using 'use CGI;'. It's a method on the $cgi-Object. :)

        And you're right: This method is used automatcally only for forms created using CGI.pm and not on my self-written HTML-code.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1081040]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2014-08-01 01:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (256 votes), past polls