Silly Bugs!

October 6, 2005 on 10:21 am | In Foobars, Funnyish, Insider View by Josh Jones |

Can YOU find the bug?

One little problem that cropped up since we pushed our swanky new web panel live was somehow domains were getting into our database with CAPITAL letters in them!

This causes some problems with adding email addresses, dns, domain registration and things like that in our system that assume a domain will always be all lowercase (since domain names are really case-insensitive).

At first glance, I couldn’t see how the domains were getting into the system like that with this check RIGHT THERE.

Can you?

12 Responses to “Silly Bugs!”

  1. scott Says:

    eq isn’t an assignment operator like ‘=’

    Should this be the proper form?
    $domain = lc ($domain);

  2. Adam Backstrom Says:

    Is this Perl I see before me? Is this an equality test, not an assignment?

  3. Torch Says:

    since i might as well be trying to read Koine Greek when I look at the code above, I’ll use this opportunity to say “I Like Jell-O.”

  4. Brandan Says:

    Perhaps I am missing something but where do you set $domain equal to anything initially (unless you do this outside the sub). So as near as I can tell

    $domain eq ”
    so
    ” will always equal lc ”

  5. Jennifer Says:

    I don’t get it.

  6. alan Says:

    Well, this isn’t what you’re looking for but if that script runs as is you’re not declaring “use strict;”.

    Which makes you a bit, well, looney :)

  7. alan Says:

    I take the above back. $domain could be a global….which is it’s own bit of looniness, different from the first

  8. josh Says:

    Or PERHAPS it’s the third option… we could use global variable AND no “use strict;”

    :)

    But yeah, that line really should have been:

    $domain = lc $domain;

  9. Larry Gilbert Says:

    I see the problem. You should’ve used

    $domain eq lc $domain or die;

    ;-)

  10. Anonymous Says:

    That could be the end of the function, where IIRC, the result of the comparison will be used for the return value. If we are considering globals we have to consider nuts who don’t use explicit return as well. ^^

  11. techie Says:

    perl code is good while you write it by yourself for yourself, but if you want managable solution to be easy understood by others stick to something simple. like php. or java. or python. but php will be faster i believe

  12. PageRank Says:

    I dont
    PageRank
    SEO Directory
    NETmoz Directory

Leave a Reply

Powered by WordPress. Pool theme by Borja Fernandez, modified by DreamHost.
Entries and comments feeds. ^Top^