Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: automatically explains how to use misused objects

by Jenda (Abbot)
on Jan 12, 2008 at 01:21 UTC ( #662018=note: print w/replies, xml ) Need Help??

in reply to automatically explains how to use misused objects

Neat. Neat except ... why the blog? I would expect it to have smaller audience and there's (AFAIK) no way to comment should one feel the need to do so. I know it's for you to decide, but I would rather see your (at least the Perl related) articles here :-)

BTW, you'd probably catch me with that example from Clubbing someone to death with a loaded Uzi. I mean it's something I'd never expect anyone sane to do so it would take me some time to notice that this time someone did it. As I read the article I had to return to the first example after I read the one with those locations and finaly understood what the heck is going on. Thanks!

  • Comment on Re: automatically explains how to use misused objects

Replies are listed 'Best First'.
Re^2: automatically explains how to use misused objects
by Dominus (Parson) on Jan 12, 2008 at 01:29 UTC
    Neat except ... why the blog?
    Well, my interests are a lot wider than Perl. And I like to post about them. And you folks would be unhappy if I posted my meditations on translations of Boccaccio here on Perlmonks. So I have a blog. And since I have a blog, it's the natural place to post when I write something that does happen to be about Perl. And if I wanted to post it here, I'd have to mark it up and format it a second time. So it's a lot easier to just post a reference to the blog.

    But if you want to mark it up and format it a second time and post it here, please be my guest.

Re^2: automatically explains how to use misused objects
by pKai (Priest) on Jan 15, 2008 at 10:52 UTC

    Having just seen an instance of iteration over a hash and getting values there on the basis of string equality tests against string constants from a co-worker (in VB.Net though, but the same argument applies of course)…

    … maybe it's more common among programmer who grew up in an environment with arrays being the most advanced dynamic data structure?

    On the other hand, I'm not sure what to make of the Club-Uzi-quote. The moment you get away from equality tests, because the particular key is only an abstraction of a wider class of strings which all have to refer to that particular value (e.g. case-insensitivity, internationalization, whatever) you are supposed to iterate over the keys (or the key-value-pairs) of the hash, aren't you?

      Depends. Most often not. Most often you are supposed to use a datastructure that supports that. If you can't use an Uzi, use something heavier. In case you want a case insensitive hash ... there are modules for that on CPAN, if you want some other definition of equality, you can do something similar to what those modules do and if you want to process all items whose keys match some more complex condition you should probably already be using a database. Even if it was just SQLite.

      Of course that sometimes looping though all the keys&values is the only solution. And using anything else would either be an overkill or would not help anything, the point is that before you start looping you should be sure you have to. Before you start banging your Uzi over someone's head, you should make sure the Uzi is not loaded. To save time and to make sure you do not shoot yourself in the foot :-)

        Thank you very much for your comment.

        After some thinking and looking into things like Hash::Case and Tie::CPHash, tying and going for normalized keys internally is the way to go in my case also.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://662018]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (1)
As of 2022-11-28 06:06 GMT
Find Nodes?
    Voting Booth?