Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
Perl: the Markov chain saw
 
PerlMonks  

reputer reply

by epoptai (Curate)
on Apr 04, 2001 at 12:37 UTC ( #69583=CUFP: print w/ replies, xml ) Need Help??

reputer is a perl/cgi that analyzes and displays node reputation and xp data from perlmonks (html screenshots).

Because it's larger than 50k reputer has two nodes on Perlmonks.
This is the reply node, please reply here.
The source code is in code catacombs.

  • Sort nodes by rep, title or date in HTML tables.
  • Three ways to graph number of nodes by reputation.
  • Display changed, deleted and new node info and rep change.
  • Cookies save info used for lwp transfers, and display options.
  • Can write up to 8 data files in temp dir, so give it write permission.

Also includes proxy support, restricted public access mode,
integration with command line programs and compressed file export.

Inspired by and designed to (optionally) integrate programs like luke repwalker and statswhore. Thanks to jcwren and ybiC for beta testing.

Let me know if you have any problems.

Comment on reputer reply
Re: reputer reply
by grinder (Bishop) on May 17, 2001 at 15:00 UTC

    Man, reputer is going to answer all my reputation questions.Here are some comments I have after having had a bit of a play with it.

    • The documentation is extremely good and to the point. Too bad there is not a lot of it :)
    • When you run reputer and click on its link to come to this page, the URL appears as http://www.perlmonks.org//index.pl?node=reputer+reply which makes things barf later on. This could be because I set my "domain" as http://www.perlmonks.org/ (note the trailing slash).
    • When I started it up, the script died with a mysterious error (okay, it coughed up the line number). Turns out that in sub getsave had code like
      open(DAT,"> $_[0]") or die "$!";
      I think it's better to be more explicit about what's going on
      open(DAT,"> $_[0]") or die "open $_[0] for output: $!";
    • From here I was able to figure out what was going on, namely, a place to write the reputer data files, which gets back to the documentation... it's takes a bit of sleuthing to find out what the script wants in order to get it going. Some of the things included: setting up a directory chowned to nobody, fixing the shebang line
    • When I ran the script with warnings enabled it spewed loads of messages into the error_log. Are you interested in patches?
    • Is your spacebar broken? A little whitespace would go along way to lightening up the code and making it a bit readable, e.g. lining up assignments, a space between my and the variable it declares

    More later as I play further.


    --
    g r i n d e r
      It's a little ironic that your first point concludes there is not enough documentation, followed by reports of problems caused by not following what documentation there is :-)

      It's your responsability to set config variables to reasonable values. If a trailing slash breaks the domain don't use one.

      The 10th line of the code, which is documentation, states "Can write up to 8 data files in temp dir, so give it write permission."

      The 1st config variable is $temp, which needs to be set to a writable dir. It's just standard practice to check the shebang line since we don't all install perl in the same place.

      Updated Excuse: The script is provided with warnings turned off. I know about the warnings, and decided to turn them off because I don't always succeed in initializing variables, and despite the fact that perl doesn't care, warnings about it can hang the script from CGI.

      You specifically address this in your next reply. I used to think this initialized all the vars:

      my($mode,$td,$ta,$rd,$ra,$ca,$cd) = '';
      but you correct me with this:
      my($mode,$td,$ta,$rd,$ra,$ca,$cd) = ('','','','','','','');
      and I've come to use this method supplied by Masem in CB:
      my($mode,$td,$ta,$rd,$ra,$ca,$cd) = map {''} (1..7);
      (who also suggested split //, '0'x7 )

      You last point hits a sore spot. I've lost count of how many monks have criticized my lack of whitespace and especially eliminating the space after 'my'.

      My lack of whitespace stems from using an editor that highlights syntax. This causes colors, and not whitespace, to be my primary visual cue. It allows me to fit more code on each screen while still clearly seeing what's going on.

      My editor color codes 'my' and '$' the same bright blue color, not using a space makes declarations really stand out and look different from subsequent variable usage.

      I'll look into running my code thru perltidy, but until then I suggest you do so if my formatting doesn't work well in your development environment.

      I do appreciate your feedback, it will help shape my habits and hopefully make things clearer on my next project.

      --
      Check out my Perlmonks Related Scripts like framechat, reputer, and xNN.

more comments about reputer
by grinder (Bishop) on May 22, 2001 at 17:34 UTC

    OK, now I understand why things are formatted as they are. I suppose this also explains why you don't indent subroutines :-) What I do know is I edit in terminal windows that I stretch out to 50 rows by 110 columns or more, so even with loads of whitespace I can see a lot of information at once.

    Some more comments, now that I've looked at the code in more detail.

    Update: more comments added 23-jul-2001

Re: reputer reply
by Anonymous Monk on Jun 22, 2007 at 13:43 UTC
    http://perltidy.sourceforge.net excellent decision. . .

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: CUFP [id://69583]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (10)
As of 2014-04-24 09:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (565 votes), past polls