in reply to IRC Stats

Um, you say you "edited" this script, so I would assume you didn't "write" it (i.e. from scratch). It would probably be polite, at least, to say who wrote it or where it came from, and it would certainly be helpful to know what parts were edited by you (maybe even what they were like before you changed them) -- e.g. did you change something below the comment that says  DO NOT MODIFY ANYTHING BELOW THIS LINE ?

Have you checked that the directories cited in $datapath and $pidfile actually exist, and that you have write permission in those directories?

Is there anything else you could tell us about its expected and/or actual behavior? ("it doesn't take the stats" seems kind of vague) -- e.g. are there any error messages or other outputs?

Have you tried stepping through it with the perl debugger, to see how the control flow is going and what sorts of values are being assigned to variables?

Sorry, but that's about as much help as I can give, based on what you've posted.

update: Well, I could offer one more tip, but it involves modifying code below the line that says DO NOT MODIFY ANYTHING BELOW THIS LINE -- in the "saveinfo" sub, none of those "open(OUTPUT...)" lines have error checking, so if the open fails, you won't hear about it, and nothing gets saved. If you change those to:

open(OUTPUT, ">name_expression") or die "name_expression: $!";
(where "name_expression" is just a placeholder for whatever string is being used as the file name to be opened), you might get more information about what's going wrong. But maybe not -- hard to say.

(P.S. Welcome to the Monastery!)

Replies are listed 'Best First'.
Re^2: IRC Stats
by fx- (Initiate) on Apr 05, 2005 at 05:22 UTC

    http://snowdog.interpol.be/ircstats21.pl -> The original.

    http://snowdog.interpol.be/mrtg-irc-stats.pl -> This is pl that i wanted to insert in the original.

    Everything works except the statsm (i added that part).
    I doens't create a file statsmmrtg.
      Everything works except the statsm (i added that part).

      Huh? I don't find anything in either of those snowdog downloads that matches "statsm" -- I don't have a clue what you're talking about.

      I doens't create a file statsmmrtg.

      Huh?? I don't find anything in either of those snowdog downloads that matches "statsmmrtg" -- I don't have a clue what you're talking about (again).

      Maybe it's just my own lack of exposure to the domain you're trying to work with here, but I also don't see any evidence that you're actually responding directly to anything I said in my previous reply.

      Okay -- I think I get it. In the OP code above, there's this, at line 128:

      $statsmmrtg=$i[3];
      Now, can you explain why this variable ($statsmmrtg) is never used anywhere else in the OP script? It seems logical that if you only assign a value to it and then never use it, it won't show up in any file or whatever.

      Then at lines 195-199, you have:

      if ($statsm ne "") { open(OUTPUT, ">$datapath/statsmplain"); print OUTPUT "$statsm"; close OUTPUT; }
      and these are the only mention of this variable ($statsm) -- it never gets anything assigned to it. So what would you expect to appear in a data file, if all you print to it is an undefined (null, empty) value?

      Maybe if you used the same variable name in these two places, you'd get your data into that file (assuming you have write permission).

      Turning on warnings would help -- it'll tell you when you only use a given variable name once, and when you try to print an undefined value. Using strict would help more.

      Oh well. Good luck with that, whatever it is.