in reply to formatting output logfile

Oh my! Get rid of "print "Content-type: text/plain\n\n ";", and put "<br />\n" where you have "\n". I mean that each "\n" has to be subst with "<br />\n", even the double ones.

More on HTML here, and that's definitively not a Perl issue.

Flavio (perl -e 'print(scalar(reverse("\nti.xittelop\@oivalf")))')

Don't fool yourself.

Replies are listed 'Best First'.
Re^2: formatting output logfile
by Anonymous Monk on May 20, 2005 at 10:48 UTC
    Is this correct?
    #!/usr/bin/perl # logger.cgi # version 1.0 # Create a file called main.log. Must have write permissions # set to main.log $mainlog = '/mnt/web_c/d31/s02/a000ras1/www/main.log'; $shortdate = `date +"%D %T %Z"`; chop ($shortdate); open (MAINLOG, ">>$mainlog"); print MAINLOG "Time: $shortdate\n"; print MAINLOG "User: $ENV{'REMOTE_IDENT'}"<br />\n"; print MAINLOG "Host: $ENV{'REMOTE_HOST'}"<br />\n"; print MAINLOG "Addr: $ENV{'REMOTE_ADDR'}"<br />\n"; print MAINLOG "With: $ENV{'HTTP_USER_AGENT'}"<br />\n"; print MAINLOG "Page: $ENV{'DOCUMENT_URI'}"<br />\n"; print MAINLOG "From: $ENV{'HTTP_REFERER'}"<br />\n"; close (MAINLOG); exit;
      Please someone awake me, I'm living in a nightmare.
      print MAINLOG "Time: $shortdate<br />\n"; print MAINLOG "User: $ENV{'REMOTE_IDENT'}<br />\n"; print MAINLOG "Host: $ENV{'REMOTE_HOST'}<br />\n"; print MAINLOG "Addr: $ENV{'REMOTE_ADDR'}<br />\n"; print MAINLOG "With: $ENV{'HTTP_USER_AGENT'}<br />\n"; print MAINLOG "Page: $ENV{'DOCUMENT_URI'}<br />\n"; print MAINLOG "From: $ENV{'HTTP_REFERER'}<br />\n";
      Anyway, you can ask "Is this correct" to perl itself:  use strict, use warnings, use diagnostics and compile your script:
      perl -c scriptname.pl

      Flavio (perl -e 'print(scalar(reverse("\nti.xittelop\@oivalf")))')

      Don't fool yourself.