Count von Counter - Fortune [possible satire]

ncowrindolf: 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) ?
rindolfncow: yes, it is.
urincow: you can use state vars in recent perls too
ncowbut I keep thinking there was a way of doing it with outer and inner subs too, or no
rindolfncow: thing is in sub outer { my $c = 0 ; .... } the $c is temporary.
ncowuri: yeah I just saw that in perlfaq7 just before you said that, thanks though :)
rindolfncow: which causes weird side-effects with a package-scope inner sub.
ncowrindolf: but shouldn't the inner sub have a closure over $c though?
rindolfncow: it will.
rindolfncow: but every time you call outer() you get a different $c.
apeironWindows also accepts a sledgehammer to the hard drive.
ncowrindolf: I'm talking about calling the inner one
ncowrindolf: could be interesting to call the outer one to re-prime or something (just kind of thinking aloud, I could be completely wrong)
ncow(please let me know if I am)
cjBotje: that's not the point. Some systems don't :)
rindolfapeiron: 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.
apeironAnd for those we have File::Spec.
rindolfapeiron: it's not as straightforward as in UNIX.
ncowI 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?"
ncowIt says: sub counter { state $count = 1; $counter++ }
ncowI think that should be $count++ not $counter++
rindolfapeiron: http://www.shlomifish.org/humour/fortunes/show.cgi?id=joel-forum-unix-shooting-in-the-foot
rindolfncow: yes, it should.
rindolfncow: or "$state $counter = 1;".
ncowrindolf: oh shit, that is so true. I hate ActiveX like the mf-ing plague
ncowrindolf: yes, though counter is the sub's name, I think the var was meant to be called $count
ncowas in the count that the counter counts :)
rindolfncow++
rindolfncow: it still exists in my github fork of the perl-doc-cats repo.
ncowa counter doesn't counter counters unless it is in fact a counter counter :)
urincow: go back to sesame street!
ncowlol
uriit seems to be where you learned your perl!
uriuse Big::Bird;
ncowbut does a counter counter count it self as a counter counter?
urithat 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?)
ncowok I think I'm done with that one...
ncowsorry, whenever someone mentions ActiveX it makes me all twitchy, and if there is no one around to choke into submission, I tend to write odd things, like a ram memory discharge
Khisantha CounterCounterFactoryCounter
szrActiveX will do that
rindolfncow: heh.
rindolfncow++
ncowooooh now we're talking
rindolfncow: anyway, how do you want to be credited in the commit log?
uririndolf: call him the miscount
rindolfuri: heh.
ncowyou 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
rindolfuri: Count von Counter
ncowso I'm the count of miscountistu?
rindolfncow: pushed.
ncowcool
ncowglad I could help.
rindolfncow: 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
ncowrindolf: haha
ncowrindolf: god I still remember that from when I was a kid watching PBS
rindolfncow: I remember it from the Israeli Sesame Street.
ncowIsraeli? didn't know they had their own version
rindolfncow: they call him there "Mar Soffer." - "Mr. Counting"
rindolfncow: we actually had two at two different times.
Channel#perl
NetworkFreenode
TaglineHow many counts will a counter count if a counter could count counts?
Published2011-12-27