Kathy181249s there a way to have a link on an html page that will display the contents of the .dat file in plain text?

As the other answers suggest, you have to
write a 'reader program' which is stored some-
where and is accessible via /cgi-bin/ (in your case).

The file could roughly look like:
#!/usr/bin/perl # [plain] (no extension) # dump some /cgi-bin/ (or other) file in plaintext mode # 1) file must be in the same dir as script # 2) server has to provide PATH_INFO # 3) call with: http://my.server.org/cgi-bin/plain/textfile.dat # if 'plain' is the scripts name # my ($fn) = $ENV{SCRIPT_FILENAME} =~ /(.+?)[^\/]+$/g; $fn .= $1 if $ENV{PATH_INFO} =~ /([^\/]+)$/; print "Content-type: text/plain\n\n"; if( -f $fn ) { open my $fh, '<', $fn or warn "$!"; local $/; print <$fh> } else { print "($fn not found)\n" }
As shown above, you name this snippet eg. "plain" and invoke it by
    http://my.server.org/cgi-bin/plain/textfile.dat
(It uses the PATH_INFO Environment variable.)

Remember to get the access and user rights correct
when saving your stuff in /cgi-bin/

Regards

mwa

In reply to Re: Viewing .dat files by mwah
in thread Viewing .dat files by Kathy181249

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.