Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Chatterbox bug

by Limbic~Region (Chancellor)
on Feb 23, 2006 at 14:29 UTC ( #532275=monkdiscuss: print w/replies, xml ) Need Help??

A question in the chatterbox prompted me to type a 1 character reply in the cb nodelet. I was suprised to find that after clicking "talk", my response did not show up. The character was the number 0. My guess is that testing for truth is not the same as testing for length but that is just a guess.

Cheers - L~R

Replies are listed 'Best First'.
by tye (Sage) on Feb 23, 2006 at 18:09 UTC

    It's a Perl site. What did you expect? In any case, I consider it a feature (in part because it is ubiquitous).

    ... and my first attempt to set the title of this node to "0" was ignored, silently reverting to "Re: Chatterbox bug" ...

    - tye        

    Re: 0
    by holli (Monsignor) on Feb 23, 2006 at 18:16 UTC
      It's probably interesting that in thread view the title of your node is "[untitled node, ID 532345]", while it is displayed in Recently Active Threads as "0". Feature?

      holli, /regexed monk/

        In addition, it also shows up in the "[untitled node, ID 532345]" format in the "Notes" section of Newest Nodes as well. (Thought I would mention that, in case it was helpful to anyone looking at it.)

        Re^3: 0
        by holli (Monsignor) on Feb 23, 2006 at 18:52 UTC

        Yes, you've found a bug... with Recently Active Threads. It doesn't deal with empty titles usefully (they result in a link with no title text, which most browsers simply ignore while some just make them nearly impossible to see or follow).

        I find such problems much worse than the many, many places where PM treats '0' that same as ''.

        Some of these places I like more than others. For example, we recently added another case of this "bug" so that [0] renders as [0], not a link. While the chatter one is not as easy to like.

        But we went years without anyone appearing to even notice this CB 'feature', so the downside is very small. Perhaps we even saved ourselves from some sloppy client code that sent message=0 when no message was desired. (:

        The fact is that treating '0' like '' is so much simpler in Perl and often results in code that handles '' and undef values better than is easy to do while allowing '0' through.

        So I'm not exactly opposed to 'fixing' the 'bug' that prevents '0' from being chatted. But I'm certainly not in a rush to do it and I won't mind if it is never fixed. And I'm against starting a hunt to search out the tons of similar places and add the extra complexity to the code to try to treat '0' differently while hoping to not break the handling of empty and undefined strings.

        Sure, it isn't rocket science, but ignoring '0' is usually less troublesome than getting the other cases wrong. So I mostly look at it as a very Perlish quirk and thus very appropriate on this particular website and I'll likely continue to be fairly cavalier with mistreating '0' this way in PerlMonks code, while reducing code complexity. And continue to be amused and not annoyed when I discover more places here where that happens. :)

        - tye        

        Not only that, but when I clicked on it (in "Newest Nodes"), the displayed page was empty except for the labels, "Category:", "Author/Contact Info", and "Description:".

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: monkdiscuss [id://532275]
Approved by g0n
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2018-06-18 06:36 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (109 votes). Check out past polls.