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

This node was taken out by the NodeReaper on Thu May 19 17:08:41 2005 (EST)

Replies are listed 'Best First'.
Re: formatting output logfile
by Nkuvu (Priest) on May 19, 2005 at 18:15 UTC
    Huh, that's odd. This code looks a lot like log file formatting. Seems like it's the same question as well. How about if you read the perfectly good replies to that node?

    Of course it could just be me. It is Thursday, and I never could quite get the hang of Thursdays.

    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: formatting output logfile
by polettix (Vicar) on May 19, 2005 at 20:08 UTC
    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.
      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.