http://qs321.pair.com?node_id=11112882

pragovnj has asked for the wisdom of the Perl Monks concerning the following question:

I have a CGI which outputs to plain text. How to have this as Pipe delimiter?

 print "Content-type: text/plain\n\n" ; Thanks, Pragov

Replies are listed 'Best First'.
Re: Pipe delimiter
by marto (Cardinal) on Feb 12, 2020 at 21:29 UTC

    It would be easier to help if you gave an example of your actual code, the output you expect and any data. See How do I post a question effectively? for more on that. Even the legacy CGI has a method to save you from manually printing headers. Explain what it is you're trying to do, show us how, and you'll likely receive good advice.

Re: Pipe delimiter
by Anonymous Monk on Feb 12, 2020 at 20:58 UTC
    what is a "pipe delimiter" in this context???

      Currently it is is plain text and separated by tab. Is it possible to have a separator like pipe | instead of tab or comma separated?

      ?
        All that you've told us so far is that you have some webpage that will contain plain text, that's what the Content tag means. There is no "pipe character" spec in a content type. Your printing code will contain the explicit pipe characters to be printed.

        I have no idea what kind of text that contains pipe characters that you'd like to put on this plain text page. I guess you currently print with tabs - show us that 1) Perl code, 2) program data, 3) example printout and 4) what you think example printout should look like for 5-10 lines of output. Lot's of possibilities: "CSV" file using |?, perhaps a simple table where the pipe chars delimit the columns?

        Yes.

        !


        holli

        You can lead your users to water, but alas, you cannot drown them.
Re: Pipe delimiter
by Anonymous Monk on Feb 12, 2020 at 23:12 UTC
    You are asking a rather nonsensical question ... which is why no one can answer it. Content-type: is an HTTP header, so you cannot simply print it. And, what does this have to do with pipe delimiters? No one has a cucking flue.
      > Content-type: is an HTTP header, so you cannot simply print it.

      Rather uninformed, CGIs print headers and content to STDOUT.

      But yes most of the OP doesn't fit into one recognizable question pattern.

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery FootballPerl is like chess, only without the dice