Sigil has asked for the wisdom of the Perl Monks concerning the following question:

Hi. I've written few libraries I'd like to release on CPAN and I'm looking for some advice on how to name them.

I found this idea in Head First OOA&D, chapter 5. It's somewhat like a very simple version of Key-Value Coding. It's also very similar to Object::Generic but I didn't use AUTOLOAD and I implemented 'equals' and 'contains' methods in order to make the objects searchable within a container.

Here's an example:

my $a = tbd_name::Object->new(); my $b = tbd_name::Object->new(); $a->set( "ID", tbd_name::String->new("1234a") ); $b->set( "ID", tbd_name::String->new("1234a") ); print $a->get("ID"); $a->equals($b) ? print "yes"; $container = tbd_name::List->new(); $container->add($a); $container->search($b); #which returns $a

My question is. What do I call this thing? I'm thinking the namespace would be 'KeyValue::' or 'KeyVal::' Would that make sense? (That namespace doesn't seem to be used.) Should this go in 'Class::'?

Thanks.

Replies are listed 'Best First'.
Re: New module naming
by BrowserUk (Patriarch) on Nov 06, 2011 at 21:51 UTC

    What does this do that a simple hash doesn't?


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      It does "equals" and "contains" which always the objects to be searched in a list. It is a hash, but more complex behaviour can be created depending on the value object.

      Another example:

      my $person = tbd_name::Object->new(); my $person->set( "AGE", ::Integer->new(30) ); my $people = tbd_name::List->new(); $people->add( $person ); my $age_range = tbd_name::Object->new(); my $range->set( "AGE", ::Range->new( 19,39 ) ); my $search_result = tbd_name::List->new(); $people->search($age_range, $search_result);

      At this point I'm trying to figure out a good name for it.

        So you need a speacial type to hold an integer. And another to hold two integers; And another in order to return a list.

        I think you want Java.


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.
        Wasn't logged in... $search_result will contain the $person object. Or if there were many $person objects $search_result would hold anything that matches. The search can be based on any number of keys.
Re: New module naming
by Anonymous Monk on Nov 06, 2011 at 21:32 UTC
    You might get better responses to this type of question on PrePAN.
      Thanks. Didn't know about that one.