Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Nice script! A few notes:
  • For better portablity, consider making the "my ISP" IP numbers into variables that can be easily changed at the top, like $home and $logfile are.
  • Use the $^T variable instead of calling 'time'
  • You could also just say $date=scalar localtime; :)
  • Put the gethostbyaddr line before the open and flock. That way, the data can be dumped in very quickly and the file closed again. Even better, write all the data into one variable and have a single print LOG "$data\n"; line between the lock and the close.
  • If you can't get to your access logs, the die statement at the end of 'open PIC' does not really help much. On a similar note, you should check the return value of OPEN in 'open LOG' and bypass the rest of the loop if it fails.
  • Some servers will report REMOTE_HOST as well as REMOTE_ADDR. If your server is lucky enough to do that, you can remove all the socket stuff!
  • Put the "Content-type" line at the start of the script, so the browser knows as early as possible that it is receiving an image.
  • You should also tell the browser the size, with a Content-Length header. This info is easily grabbed with -s $pic
  • For even better speed, consider hard-coding the image into the script itself. A small gif can be squeezed as small as 35 bytes!
  • Output the gif, then do your log file. Not only does the client not have to wait for the log file writing, but you can simply die if 'open LOG' or 'flock LOG' does not work.
  • Using all of the above, I can squeeze it down to a 6 line script!

In reply to RE: Poor Man's Web Logger by turnstep
in thread Poor Man's Web Logger by comatose

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    [Eily]: you mean a dll where the SW was written in perl? That sounds unlikely
    [muthusathish]: please help me regarding this
    [hippo]: Easier just to go and look at the source, no?
    [Eily]: mostly because perl isn't compiled in the usual sense of the meaning, you can't execute the opcodes directly, you need the perl engine
    [muthusathish]: i dont have the environment too, but i need to get the logics so that i can re-wite
    [Eily]: what makes you think your dll is "perl based" ?
    [muthusathish]: i dont have source code too
    [muthusathish]: it is used in VB 6 appln, while debugging is getting error
    [hippo]: Somebody has. Ask the author.
    [Eily]: muthusathish ok, the fact that you can't tell what perl has to do with it proves it: this is not perl

    How do I use this? | Other CB clients
    Other Users?
    Others drinking their drinks and smoking their pipes about the Monastery: (8)
    As of 2018-02-23 09:14 GMT
    Find Nodes?
      Voting Booth?
      When it is dark outside I am happiest to see ...

      Results (301 votes). Check out past polls.