print $q->header();
print $out;
but what i would really likee to do is print everything out in TEXT only
format...for debuggin purposes....
is there a way to do this, so the browser does NOT print using HTML
formating, and just prints everything in plain text?
thanks!
If you are using a standards compliant browser, you can just do:
print "Content-type: text/plain\n\n";
However, I see that you are posting from Outlook, and if that means that
you are browsing the web with MSIE, using the <pre> tag may be an
alternative. But then you also need to
s/</</g;
s/>/>/g;
before printing to STDOUT.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
> but what i would really likee to do is print everything out in TEXT only
> format...for debuggin purposes....
The Perl language doesn't care in the least whether you print
a content-type header of text/html or text/plain
> is there a way to do this,
Sure
> so the browser
That depends a bit on what you mean by "the browser". There are
browsers which are compatible with the applicable IETF and W3C
specifications in this regard, and then there's a disreputable
operating system component that occasionally gives an impression of
being a WWW browser, but (it seems) more by accident that by design.
None of this is Perl-specific, though. Have you considered using the
newsgroup recommended in perlfaq9? (but beware the automoderation
bot).
you mean start my $out with the above?
> still new to PERL, anyway write now i do all OUTPUTTING to the web browser
> with:
Experienced Perl programmers don't use all CAPS.
>
> print $q->header();
> print $out;
>
> but what i would really likee to do is print everything out in TEXT only
> format...for debuggin purposes....
>
> is there a way to do this, so the browser does NOT print using HTML
> formating, and just prints everything in plain text?
Print stuff between <pre> and </pre> tags. You can also use the
$q->pre() function of CGI, which, since it is not documented in perldoc
CGI, is probably an auto-generated tag function.
please help
Then send the output to a file as well as the browser. Or use
View|Source to see what the browser is getting.
I mean that you can replace
print $q->header();
with that.
Seeing as he's using the CGI module, he might as well use:
print $q->header('text/plain');
> In article <10983950...@nntp.acecape.com>, daniel kaplan
> <nos...@nospam.com> wrote:
>
>> still new to PERL, anyway write now i do all OUTPUTTING to the web browser
>> with:
>
> Experienced Perl programmers don't use all CAPS.
Does <stdin> work then ?
> Print stuff between <pre> and </pre> tags.
Merely clamping material in a <pre> element does not, in general,
turn it into plain text. You'd need to escape the HTML-significant
characters in it (escapeHTML() in CGI.pm) too.
If you've no other reason for sending content-type text/html then I'd
still say that sending text/plain is the straightforward solution.
This of course has nothing directly to do with Perl. It would be the
same principle in any scripting language.
What happened when you tried it? (yes, it does work)
Experienced Perl programmers don't spell it "PERL", because
it is not an acronym.
If you call it PERL then you do not know the secret handshake.
--
Tad McClellan SGML consulting
ta...@augustmail.com Perl programming
Fort Worth, Texas
> Paul Robson <auti...@autismuk.freeserve.co.uk> wrote:
>> On Thu, 21 Oct 2004 15:24:05 -0700, Jim Gibson wrote:
>>
>>> In article <10983950...@nntp.acecape.com>, daniel kaplan
>>> <nos...@nospam.com> wrote:
<snip>
>
> Experienced Perl programmers don't spell it "PERL", because
> it is not an acronym.
I beg to differ ;-)
From the Perl manpage:
NAME
perl - Practical Extraction and Report Language
Chris.
> If you call it PERL then you do not know the secret handshake.
The Perl FAQ is surely only a "secret" to those who treat this
group as a write-only medium.
>> Experienced Perl programmers don't spell it "PERL", because
>> it is not an acronym.
>
> I beg to differ ;-)
You know better than the Perl FAQ?
What's the difference between "perl" and "Perl"?
One bit. Oh, you weren't talking ASCII? :-) Larry now uses "Perl" to
signify the language proper and "perl" the implementation of it,
i.e. the current interpreter. Hence Tom's quip that "Nothing but perl
can parse Perl." You may or may not choose to follow this usage. For
example, parallelism means "awk and perl" and "Python and Perl" look
OK, while "awk and Perl" and "Python and perl" do not. But never
write "PERL", because perl is not an acronym, apocryphal
folklore and post-facto expansions notwithstanding.
> From the Perl manpage:
>
> NAME
> perl - Practical Extraction and Report Language
If it was an acronym it would have been spelled in ALL CAPS.
It appears that you have helped to prove my point. Thanks!
It is not an acronym, it is what might be called a "backronym"
since the word came first and the expansion of the letters in
the word came later.
Then why did you use CAPS?
Actually, in the context of a man page, no, it wouldn't, because the
executable program is named "perl", not "PERL" or "Perl".
--
John W. Kennedy
"The pathetic hope that the White House will turn a Caligula into a
Marcus Aurelius is as naïve as the fear that ultimate power inevitably
corrupts."
-- James D. Barber (1930-2004).
Just 'cos the docs contradict themselves doesn't make them wrong :)
(perlfaq1 states explicitly that Perl is not an acronym).
This backronym for Perl is something of a joke, as is 'Pathologicaly
Eclectic Rubbish Lister'. See the Camel for the actual history of the
name.
Ben
--
And if you wanna make sense / Whatcha looking at me for? (Fiona Apple)
* b...@morrow.me.uk *
...as Gödel's Theorem vanishes up its own nose....
--
John W. Kennedy
"Sweet, was Christ crucified to create this chat?"
-- Charles Williams. "Judgement at Chelmsford"
Sigh. Because it's shorter than Capitalization Annoying to Perl
Scripters.
Jon
P.S. I sense a "script versus program" flamewar coming on.
Yep, try:
use CGI qw(escapeHTML);
my $cgi = new CGI;
print $cgi->header();
print $cgi->start_html("Plain text output");
print $cgi->pre(escapeHTML($out));
print $cgi->end_html();
exit 0;
>
> P.S. I sense a "script versus program[..]
A script is interpreted and a program is compiled. I know you can in Perl
and some other scripting languages turn a script into a program, which
makes it more like a real programming language, like C++ or Java. Perl is
a scripting tool written in C so C programmers can have the conveniences of
languages like C++ or Visual Basic without having to leave their native
environment.
lwt
L> A script is interpreted and a program is compiled. I know you can
L> in Perl and some other scripting languages turn a script into a
L> program, which makes it more like a real programming language, like
L> C++ or Java. Perl is a scripting tool written in C so C
L> programmers can have the conveniences of languages like C++ or
L> Visual Basic without having to leave their native environment.
nonsense. balderdash. gobbledygook.
pick one.
uri
--
Uri Guttman ------ u...@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
Perl is both compiled *and* interpreted (see perlrun.pod).
So which one is it if written using Perl?
[ That is a rhetorical question, as there is no correct answer.
The script vs. program thing has been discussed here ad nauseum
and is always valueless as there is no difference.
I think Jon was being sarcastic, yet here you are, starting
up such a useless subthread yet again...
]
> I know you can in Perl
> and some other scripting languages turn a script into a program, which
> makes it more like a real programming language, like C++ or Java.
That is a load of hooey.
If you can write "programs" in it, then it is a real "programming language".
> Perl is
> a scripting tool written in C so C programmers can have the conveniences of
> languages like C++ or Visual Basic without having to leave their native
> environment.
Yet more foolishness!
that is the bottom line, whether it is compiled at run time or before only
counts as a difference in speed. but the bottom line is that it IS a
programming language...
Why? They all apply.
Anno