Count von Counter - Fortune

Count von Counter

ncow rindolf: is not { my $c=0; sub getNext { $c++ } } a perfectly good way to do a closure on a variable (that should not be seen by anything other than that sub, sort of like that PHP example with the "static" var <http://www.phpsadness.com/sad/18> and I think similar to static vars in C++ and Java) ?
rindolf ncow: yes, it is.
uri ncow: you can use state vars in recent perls too
ncow but I keep thinking there was a way of doing it with outer and inner subs too, or no
rindolf ncow: thing is in sub outer { my $c = 0 ; .... } the $c is temporary.
ncow uri: yeah I just saw that in perlfaq7 just before you said that, thanks though :)
rindolf ncow: which causes weird side-effects with a package-scope inner sub.
ncow rindolf: but shouldn't the inner sub have a closure over $c though?
rindolf ncow: it will.
rindolf ncow: but every time you call outer() you get a different $c.
apeiron Windows also accepts a sledgehammer to the harddrive.
ncow rindolf: I'm talking about calling the inner one
ncow rindolf: could be interesting to call the outter one to re-prime or something (just kind of thinking aloud, I could be completely wrong)
ncow (please let me know if I am)
cj Botje: that's not the point. Some systems don't :)
rindolf apeiron: Windows requiring doing a SOAP request to a .NET service (that is very picky about its scope) to call an OLE component for writing an Excel macro to do that.
apeiron And for those we have File::Spec.
rindolf apeiron: it's not as straightforward as in UNIX.
ncow I think I found a mis-type in perlfaq7 <http://perldoc.perl.org/perlfaq7.html#How-do-I-create-a-static-variable%3f>, under "How do I create a static variable?"
ncow It says: sub counter { state $count = 1; $counter++ }
ncow I think that should be $count++ not $counter++
rindolf apeiron: http://www.shlomifish.org/humour/fortunes/show.cgi?id=joel-forum-unix-shooting-in-the-foot
rindolf ncow: yes, it should.
rindolf ncow: or "$state $counter = 1;".
ncow rindolf: oh shit, that is so true. I hate ActiveX like the mf-ing plauge
ncow rindolf: yes, though counter is the sub's name, I think the var was meant to be called $count
ncow as in the count that the counter counts :)
rindolf ncow++
rindolf ncow: it still exists in my github fork of the perl-doc-cats repo.
ncow a counter doesn't counter counters unless it is in fact a counter counter :)
uri ncow: go back to sesame street!
ncow lol
uri it seems to be where you learned your perl!
uri use Big::Bird;
ncow but does a counter counter count it self as a counter counter?
uri that is counterproductive thinking
ncow (or does it just consider itself a cunt and thus only count it self as a cunt counter since it only counts cunts?)
ncow ok I think I'm done with that one...
ncow sorry, when ever someone mentions ActiveX it makes me all twichy, and if there is no one around to choke into submition, I tend to write odd things, like a ram memory discharge
Khisanth a CounterCounterFactoryCounter
szr ActiveX will do that
rindolf ncow: heh.
rindolf ncow++
ncow ooooh now we're talking
rindolf ncow: anyway, how do you want to be credited in the commit log?
uri rindolf: call him the miscount
rindolf uri: heh.
ncow you don't have to do that, but if you really want to, ncow is fine. Necrocow may be me old moniker (and freenode account name) but ncow is what I've been going by for quite a while now
rindolf uri: Count von Counter
ncow so I'm the count of miscountistu?
rindolf ncow: pushed.
ncow cool
ncow glad I could help.
rindolf ncow: you're welcome.
rindolf “One Perl One-Liner, Two Perl One-Liners, Three Perl One-Liners. <Thunder and Lightning> Ha ha ha ha ha ha.”
rindolf -- Count von Counter
ncow rindolf: haha
ncow rindolf: god I still remember that from when I was a kid watching PBS
rindolf ncow: I remember it from the Israeli Sesame Street.
ncow Israeli? didn't know they had their own version
rindolf ncow: they call him there "Mar Soffer." - "Mr. Counting"
rindolf ncow: we actually had two at two different times.
Channel #perl
Network Freenode
Tagline How many counts will a counter count if a counter could count counts?