• Stephen Caldwell (unregistered)

    This is obviously a clear cut case of TFL2RTFM (To Fskin Lazy to Read the Fskin Manual).

  • Some Guy (unregistered)

    That acronym is a clear cut case of TFL2WWOAIUTFLISNA (Too F**king Lazy to Write Words Out And Instead Using Their First Letters In Some Nonsensical Acronym)

  • Martin (unregistered)

    this function should really

    # be put somewhere more centralized

    ooo... perhaps (now this is a stretch) as part of the perl language itself?

  • dave s. (unregistered)

    try Moveable Type.

  • froz (unregistered)

    this should return the number of chars in the string.

    Obviously the next empty comment line used to be:
    # but I really have no clue what it's doing, so it's anyones guess.

    before the coder decided to make it not quite as blatant.
  • TheF0o1 (unregistered)

    This is baffling. It must be the product of a disturbed mind. I've only written a little perl, but this still seems bizarre to me.

    The "no warnings" pragma is an interesting language construct. I tend to have selective hearing myself sometimes. I guess it's ok, but it could be used for good or evil. In this case, I'd say the programmer should pay attention to the warnings.

    There are parentheses in the declaration of $str but no parentheses in the declaration of $len. Why?

  • Try Wordpress (unregistered)


  • X (unregistered)

    The parens in the declaration of $str put it in list context, getting the first element of @. If they weren't present, $str would be set to the number of elements in @.

    This also means that the explicit casting with scalar is unneeded because assigning to $len is in scalar context there.

    Of course, none of what I'm saying really matters because the entire thing is pointless.

  • dan (unregistered)

    >There are parentheses in the declaration of
    > $str but no parentheses in the declaration
    > of $len. Why?

    because he's trying to assign the first element of the @_ array (the parameters passed to the sub) to the scalar $str, the parentheses enable 'list context' so the elements of the array are mapped to the scalars inside the parentheses. Had he had done: $str = @_ he'd have just assigned the array's size to the scalar $str. The following would all have done the same thing:

    my $str = shift; # @_ is used as default if no array is specified


    my $str = $_[0];

    But yeah. Stupid.

  • Dave M. (unregistered)

    I'll add my two cents here and suggest ExpressionEngine. EE sends e-mails out to folks who have posted a comment. I think it even lets people "subscribe" to the comments to get e-mails as comments are added.

    I'm not sure about the ability for people to post new entries that you can moderate, but I think it's possible.

  • Graeme Foster (unregistered)

    I'm a .NET developer, but I switched from .Text to Drupal a while back. It doesn't have RSS feeds or emails for comments, but it does have extensive support for moderation, so people could post directly to the site and wait for approval (from yourself or othe rtrusted users) before being published.
    There may be another CMS which suits you even better. Have a look at (and play with!) the various CMS installations on http://www.opensourcehost.com - I'd recommend them as hosts too! :)

  • Matt K (unregistered)

    >>> no warnings;

    Probably included 'no warnings;' because he tried to compile and got 'Warning: There's a much better way to do this, you dumbs**t.'

  • James Mastros (theorbtwo) (unregistered)

    Note, by the way, that if he'd tried to do anything additional with his arguments after the shift, he would have died horribly. Why? Because split in scalar or void contexts returns the number of elements in the results, and implicitly puts the list of results into @. The problem with this is that @ is used for your argument list. Slick move there. There's a warning for this, of course -- but he disabled warnings. At least the rest of the module presumably uses warnings (otherwise there'd be no point in disabling them).

    Oh, and re the "implict everything" and "variable variables", both features are best used sparingly, and most people figure that out pretty swiftly. (Perl is by far my favorite languge, and I'm a little bit biased -- but we see /lots/ of beginners on perlmonks.org, and the majority of them find ways to be idiotic without abusing $_ or symbolic references.

    (Oh, and saying "variable variables" rather then "symbolic references" is pretty WTFish, IMnsHO. Of course they're variable; WTF else would they be?)

  • Stan Rogers (unregistered)

    Simply because you said you were a Microsoft guy, I have to point out that every one of the enhancements you mentioned would be a <ten-minute implementation on Domino ;-)

  • Buck Rogers (unregistered)

    I always found it a bit of a contradiction that a site about bad code was hosted on IIS/ASP by MS - which is a synonym for bad code.

    Therefor, despite you claim being a MS-guy (god bless your soul) I'd recommend you just spend a weekend and roll your own (no setup.exe, sorry). You'll get any features you like that way and maybe you'll even realize in the process why no one in their right mind would choose a MS product as foundation for a web application. :)

  • Miles Archer (unregistered)

    The variable variables note reminds me a comment a co-worker used to make: "Variables won't and constants aren't"

  • John (unregistered)

    Correct me if I'm wrong, but didn't the length function in older versions of Perl return the number of bytes, not the number of characters? Perhaps this author thought this was still the case and was trying to allow for character encodings where the character size is not one bye.

  • M (unregistered)

    sub strlen {return scalar split(//, shift)}

    No need for pesky variables.

  • Dave Mays (unregistered)

    @Buck Rogers
    - Cheap shot! (not to mention inaccurate) I've seen plenty of horriffic code in Perl and PHP.

    Anyway - my $0.02 for a new "content management" solution:

    The ASP.NET "Portal" starter kit has a pretty basic "discussion" system in it. There's no RSS, but a clever guy could write an RSS module for it in no time.

    On the PHP side, you could use "CuteNews" which doesn't even need a database. It writes the content to textfiles. Not a super solution, but functional.

  • Bongo (unregistered)

    .Text publishes Comment RSS feeds. Some newsreaders (like RssBandit) can watch conversations (others, you need to hunt for the comments with)

  • foxyshadis (unregistered)

    Reading a bit between the lines, is this your home machine? Not to be mean, but if so, no wonder it's so slow during the day. 20-30 second wait times are killing it. I thought it was .Text doing it, but maybe not; either it needs to be a dedicated machine or, if it is, bump the ol' processor or use someone else's. >_>

    I'd probably end up just writing my own blog system and customizing it to my tastes. Wait, I already did. (am?) Now I'm going to be writing my own mini-CRM app. My standards too exacting? naaaaaaaaaaaaah.

  • Anarcho (unregistered)

    @Buck Rogers

    That was exactly the same thing I thought when I first scrolled down to the "Powered by ASP" thing.

    I thought: This guy make jokes about stupid code and uses a more than stupid language? That's it what makes this page really funny.

    I have to use asp at work and I have to say that it's really a damn piece of shit!

    I prefere PHP in every case I come accross.

    The amount of saying WTF about ASP is much higher than saying WTF about coding style of other people!

    but you should really get away from MS Products, especially from ASP!

    But of course, only my 68 Cents....

  • Buck Rogers (unregistered)

    @Dave Mays

    True that, ofcourse. The point I was trying to make was that even <b>if</b> you manage to write a good piece of code in ASP or .net it is all wasted because the VM it runs in (wintendo, iis) is broken by design.
    I hate to see people struggling to get stuff done in a broken framework while they could do the same things in a <b>straightforward</b> manner using free software on a real OS.

  • psych0 m0nk3y (unregistered)

    did anyone try running .text with mono?

  • Jake Vinson (unregistered)

    I normally remain pretty cool about this sort of thing, but I must say this:

    "Sweet jesus, I hate linux fans."

  • Dave Mays (unregistered)

    LOL @ Jake. 8-D

    Yeah, fanboys are pretty lame.

  • pompo500 (unregistered)

    Dear Buck Rogers, could you please tell me why the CLR is 'broken by design'?
    Are you a .NET developer?

  • Robert Hensing (unregistered)

    Hey man, you can configure .TEXT to automatically post the comments via the admin page - you don't have to approve them individually although this may be the default. :)

    Robert Hensing

  • Stef&#225;n J&#246;kull (unregistered)

    Although i hate to take part in such a blatant topic hijacking i have to speak my mind. Sorry Alex :)

    @Buck Rogers:
    There's a reason that over 50% of the Fortune 500 companies are now using .NET! It seems to me that you've never really worked closely with ASP.NET and IIS6, but if you have i'll apologize right now for being presumptious. If you had though you'd be able to come up with reasons as to why it's "broken by design" :/

    I don't have anything against PHP, and in fact i admit that i've never really looked at it. But that doesn't make me go around spreading FUD about it. I have on the other hand worked very closely with Java and JSP a few years ago, and i can say hands down that i'd prefer .NET and ASP.NET over that any time. In fact i'd prefer .NET over any other programming "languages".

  • KoFFiE (unregistered)

    @all .NET fanboys :) Accusing someone of being a fanboy and then desperately trying to defend your own dear devel-tool is actually pritty funny - but that's what this site is all about - no? Continue plz :)

    Then some serious (totally offtopic) talk - CLR is not 'broken by design', ASP is. VB-alike code tends to make a programmer lazy, and 90% of the VB/ASP coders doesn't know what happens and how it happens behind their back, they only know there's some magic
    CLR does have some freaky strange things in it to support sandboxed environments, and yet support direct-memoryaccess based languages such as C/C++, which simply screams to be exploited. Due to the complexity of this sandboxing, "unsafe" code-zones (on bytecode-level) - there simply have to be bugs in it, it hasn't matured yet (and this would be the case for any company or oss project, not pointing a finger at MS now)

    So it's not .NET, no - it's the VB-syntax based languages that are broken by design, you should even wonder if there is a design at all, and if there is, is it "make stupid people able to write the most horrific, slow code, which could still work"?
    As a language, I like C# for as much I have looked into it, haven't had a lot of time lately. Ok - it's a Java rip-off, but it has some major improvements over it (although Java 1.5 catches up with that). I am someone who uses the right tool for the right thing, and to be honest, a VB-alike language sollution would only be used for very-quick and very-dirty in-house sollutions if I would be the one to decide over that (luckily - I have a major influence there in that area :D)

    Then about the fortune500 companies. How come that these are so important examples? They have to make huge deals with MS for their office & windows licences, so they have a lot of contact with the marketting-folks of MS, so guess why they all choose to develop in .NET. It's all a top-down decision, managers and commercial people get convinced that .NET is the future, they say "we need .NET", they hire .NET people, give other employers courses for .NET, and then they can use the ".NET powered" marketting tool from MS too, cause that's what MS's bigges talent is, marketting. Most fortune-500 companies are marketting-driven, so they are very sensitive to things like this. Don't look for superoir technology, cause although the CLR is a nice idea, even the first beta-versions of the mono runtime ran the same bytecode faster than the officially released MS-runtime.

    Then some ontopic stuff, I don't know perl at all, but it looks eeh - strange, or is that just Perl? :p

  • wtf comments on wtf topics (unregistered)

    Must be the day for morons to come out and play and post to wtf. Thanks for the funny, uneducated comments on the off-the-topic broken framework, VB and such. Especially Buck and Koffie, you two take the "I don't know what I'm talking about" prize of the day.

  • KoFFiE (unregistered)

    You sound like a fanboy to me :) Very good arguments you bring there :)

  • Manni (unregistered)

    I know I'm going to catch a flame or two, but since this has gotten into a program language war...

    I'm a VB programmer, partially by choice. I started with ASP and I can attest to some of the nuances of it. I fail to see how it's "broken by design". Maybe I have a different definition of the word "broken". I think the open source community views companies like MS as inherently evil simply because they make programming easy. And in the end, it's the programmers who get lazy, don't blame the language or the company that creates the standard.

    Most of the time at my job people need simple programs to save them large chunks of time doing menial tasks. Our C++ programmers require 4-5x as much time to write the same tool as it takes to do in VB. When it comes to processor-intensive tools like image manipulation, of course there's no substitute for a well-constructed C++ app.

    I think too many developers think of programming as an elite club, and easy languages like VB allow undesireables into the group. I think of VB as a stepping stone to a more robust language, but I won't stop using it altogether just because of how quickly I can whip up a simple app to do the job at hand.

    Was that $0.02 worth? I might have thrown in a full quarter...

  • Hassan Voyeau (unregistered)

    Both PHP and ASP has its advantages and disadvantages. ASP allows use of various programming languages with a great OO model however there is a cost attached to this - speed and memory usage. PHP is open source (add your pros and cons of open source here). ASP requires IIS (add your pros and cons of IIS here). IMHO the most important thing is to weigh the advantages and the disadvantages of each technology as it applies to your application and make a decision based on that and avoid the "fanboy" syndrome.

  • Eric Hodel (unregistered)

    Don't try to write OO code in languages where the OO features were bolted on (or are half-assed). Its just stupid. (Such languages include Perl, Python, VB, PHP, ...)

    Instead, use a real OO language, like Smalltalk (or Ruby).

  • Scott Watermasysk (unregistered)

    Email notification for blog post updates will be a feature for Community Server:Blogs (which will actually be 1.0 of .Text).

    You could also use community Server: Forums, which has this feature currently built in. You could then take things a step further by allowing people to post their own WTF's. :)


  • KoFFiE (unregistered)

    @Manni, I completely agree that for small programs it's very suitable, sometimes even the best thing available (especially with DB's), but believe me, for your own good, don't try to do multi-manyear projects in VB. I have been there, I won't go there again, I'd rather resign. Once you have a large project, you simply loose all the rapid-development benefits.

    I do blame the language however (and let's not forget the IDE), it mutated 'till VB6 (some would say "evolved"), and then a major reorganisation was done for .NET (which was nothing too soon). It improved a lot, but it still is far from good. One of the main problems of VB which still remains is that the user-interface doesn't force you to organize anything, a simple project is very/too maintainable w/o any project organisation, which is fine for small programs. But when the project grows, it becomes a mess very quickly, and when using VB, very few ppl will restart everything at a point that early in the development stages, after all, it's rapid development, it should probably be finished rather quickly, no?

    If you really need to write .NET apps, please choose C#, and as a correction for above, with ASP in my previous post, I did mean VB.NET syntax ASP, since you can (and should imho) use C# or any other language the CLR supports to write ASP pages, but afaik, the VB syntax is still the most popular, due to historical reasons.

    I also agree with Hassan Voyeau that you should use the best tool for the best job, but the problem is that there are so many VB-only coders that have never seen anything else, or at least never coded a significant project in another language. It is striking that all pure-100%-VB-only coders I've seen produce much worse VB-code than someone with a more extensive language-background. I wouldn't call myself a fan-boy, I only don't like VB - with reason, I've had very bad experiences with it, being dropped into a rather large project after a few months, and I've seen those same problems more than once afterwards.

  • Patrick Sullivan (unregistered)

    I'm thinking of moving to DasBlog, no database for that one!! It looks pretty sweet

  • (cs) in reply to M
    sub strlen {return scalar split(//, shift)}

    No need for pesky variables.

    sub strlen { scalar split //, shift } 

    No need for return statements or parentheses either :)

  • (cs) in reply to Stingray
    sub strlen {return scalar split(//, shift)}

    No need for pesky variables.

    sub strlen { scalar split //, shift } 

    No need for return statements or parentheses either :)

    sub strlen($) { length shift }
    No need for pesky regexs either :)
  • (cs) in reply to Maurits
    sub strlen {return scalar split(//, shift)}

    No need for pesky variables.

    sub strlen { scalar split //, shift } 

    No need for return statements or parentheses either :)

    sub strlen($) { length shift }
    No need for pesky regexs either :)
    sub strlen($) { length pop }
    Saved ya 2 characters.  And now, let's all go play perlgolf! http://terje.perlgolf.org/
  • (cs) in reply to Stef&#225;n J&#246;kull

    There's a reason that over 50% of the Fortune 500 companies are now using .NET!

    <FONT face="Courier New" size=2>at my old job, we used a propietary language (i would get into amazing details and wtfs, but i'm going to wait a year [:D]).  my manager used to justify using it (a functional language developed in the 60's) by saying "well, you see, INITECH* wrote the language, and they're a $10 billion/year company!  that's the kind of success we want to build our company on!" - of course, in reality something like 80% of their money comes from locked-in customers paying support fees to drag this 40+ year old system into the 21st century.</FONT>

    <FONT face="Courier New" size=2>seriously, this language made C with inline assembler look infinitely more mantainable.</FONT>

    <FONT face="Courier New" size=2>* not the actual company name.  duh.</FONT>

  • (cs) in reply to Dave Mays
    Dave Mays:
    LOL @ Jake. 8-D

    Yeah, fanboys are pretty lame.

  • oksupra.com (unregistered)

    Supra shoes are so popular all over the world. Whatever you take on Supra being in the Supra Skytop Shoes market. Now Supra Strapped Shoes also very popular attention. It is nice that they actually took the time to make Supra Skate Shoes that work well. Supra shoes is a brand that has been inspired, designed and marketed by passionate individuals. We have brought to you the fullest selection of Supra footwear at cheapest price.

  • Sebastian Ramadan (unregistered)

    It's d-e-f-i-n-i-t-e-l-y. You're welcome.

Leave a comment on “Perls of Clarity”

Log In or post as a guest

Replying to comment #:

« Return to Article