Module naming conundrum

Ask a Question related to PERL Modules, Design and Development.

  1. #1

    Default Module naming conundrum

    Greetings, all. I have three modules I am preparing for submission to
    CPAN, but I freely confess that I can't come up with decent names for
    them. Any thoughtful suggestions would be appreciated.

    The first module (currently called DB::Access) simplifies access to
    databases by creating a family of classes based on table and column
    names. It does some of the same things as Class::DBI, but I'm taking a
    data-centric approach, as opposed to proceedural, to defining the
    accessors. An example of its usage would be:

    use DB::Access
    {
    schema => 'schema1',
    tables =>
    [
    {
    table => 'table1',
    primary_key => [ 'id' ],
    columns =>
    [
    { name => 'id', type => 'number' },
    { name => 'value', matches => qr/^.{1,40}$/ },
    ],
    },
    {
    table => 'table2',
    primary_key => [ 'seq' ],
    select_null_primary => 'SELECT LAST_INSERT_ID()',
    columns =>
    [
    { name => 'seq', type => 'number' },
    { name => 'data', constraint => sub
    {
    my($s,$v) = @_;
    return unless $v =~ /^ab/i;
    return if lc $v eq 'abnegate';
    },
    },
    ],
    },
    ],
    } ;

    (Note the curly braces - DB::Access->import expects a list of hash
    references).

    This example creates classes corresponding to the schema (by which I
    mean a collection of tables only) and each of the tables. You would
    use the resulting classes like this:

    my $db = new DB::Access handle => DBI->connect(@params),
    schema => 'schema1';
    # Search for id's less than or equal to 10
    my @res = $db->table1->search(id => le => 10);
    # print out the results
    print $_->value, "\n" foreach sort { $a->id <=> $b->id } @res;

    You can use the class to get real work done without knowing anything
    about SQL. Someone who knows a small amount of SQL can also use it
    with auto increment columns and sequences (depending on database
    support), or to query multiple tables.

    Alas, the name sucks. Although the module uses DBI, it's not a
    subclass of DBI, so the DBI:: namespace isn't appropriate. Perhaps a
    DBIx:: name? Also, I don't want people to assume that the class has
    anything to do with a certain ... underpowered, so-called "personal",
    alleged database program hailing from Redmond. Any suggestions on a
    better name would be appreciated.

    The next module is a web scraper to validate addresses and ZIP codes
    for addresses in the USA, and fetch the four-digit extention code.
    Basically, you instantiate the class, feed the object address
    parameters, call the lookup method, and read out the updated address
    parameters. It's currently called "Zip4". I suspect it needs to
    reside in the WWW:: namespace somewhere.

    The third (and final) module automates the loading of
    HTML::Template-style templates. The current (horrible) name is
    TemplateLoader. You use it thusly:

    use TemplateLoader
    (
    name => 'example_template',
    filename => 'example.tmpl',
    defaults =>
    {
    param1 => 'value1',
    param2 => 'value2',
    },
    ) ;

    This particular example would create a method called "example_template"
    in the caller's namespace. When called, the method would load the
    template (using the caller's 'load_tmpl' method by default, but that
    can be changed), and pass any default parameters in the declaration to
    the template object. If the method is called with any arguments,
    they're passed to the template object's param() method.

    Again, I would appreciate any suggestions as to a good name. While
    this module uses HTML::Template-type templates, it's not a subclass, so
    names in the HTML::Template:: space aren't appropriate.

    Jim Schneider Guest

  2. Similar Questions and Discussions

    1. Module naming help
      I have written 2 modules which I intend to upload to CPAN. I have chosen the names "Class::MethodVars" and "Class::Framework", they would both be...
    2. Module naming: Boolean::Verbose
      Hi, All. I have a module which I want to upload to CPAN. My calliing it Boolean::Verbose, but Boolean is to be top level. So I want to avoid...
    3. Request for naming help (templating module)
      -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello all, I have recently written a templating module and released it to CPAN. There are...
    4. Help naming a module
      Hi, I'm building a module that when finished, I expect to upload to CPAN. This module communicates with a piece of stock trading software called...
    5. keyboard conundrum
      Alan Coopersmith <alanc@alum.calberkeley.org> wrote in message news:<bd5tvj$2omc$3@agate.berkeley.edu>... If not using XKB, the offset is So in...
  3. #2

    Default Re: Module naming conundrum

    On 2006-03-10, Jim Schneider <jpschnei@yahoo.com> wrote:
    > Greetings, all. I have three modules I am preparing for submission to
    > CPAN, but I freely confess that I can't come up with decent names for
    > them. Any thoughtful suggestions would be appreciated.
    >
    > The first module (currently called DB::Access) simplifies access to
    > databases by creating a family of classes based on table and column
    > names. It does some of the same things as Class::DBI, but I'm taking a
    > data-centric approach, as opposed to proceedural, to defining the
    > accessors. An example of its usage would be:
    <snip examples of use>
    > Alas, the name sucks. Although the module uses DBI, it's not a
    > subclass of DBI, so the DBI:: namespace isn't appropriate. Perhaps a
    > DBIx:: name? Also, I don't want people to assume that the class has
    > anything to do with a certain ... underpowered, so-called "personal",
    > alleged database program hailing from Redmond. Any suggestions on a
    > better name would be appreciated.
    There are modules named DBIx::Table, Data::Table and DB::Table that seem
    roughly equivalent. All of these top levels seem like good canidates to
    me. Since you want to emphasize the data oriented nature of your module
    perhaps something under Data::.
    > The next module is a web scraper to validate addresses and ZIP codes
    > for addresses in the USA, and fetch the four-digit extention code.
    > Basically, you instantiate the class, feed the object address
    > parameters, call the lookup method, and read out the updated address
    > parameters. It's currently called "Zip4". I suspect it needs to
    > reside in the WWW:: namespace somewhere.
    I don't think WWW::Zip4 would be too bad. There is a
    Scrape::USPS::ZipLookup though the only modules under Scrape:: are this
    one and three others underneath it. This explains why I hadn't seen
    Scrape:: before.
    > The third (and final) module automates the loading of
    > HTML::Template-style templates. The current (horrible) name is
    > TemplateLoader. You use it thusly:
    <snip usage example>
    > Again, I would appreciate any suggestions as to a good name. While
    > this module uses HTML::Template-type templates, it's not a subclass, so
    > names in the HTML::Template:: space aren't appropriate.
    What about HTML::TemplateLoader?

    Of course, there could be names better then my suggestions. I went
    through this process with my first CPAN module about a week or two ago.
    If you haven't done so already, I'd suggest a post to the module-authors
    list, I've received great feed back there and the list is pretty
    low-volume. <http://lists.cpan.org/showlist.cgi?name=module-authors>

    --
    Michael
    [email]michael@thegrebs.com[/email]
    SpamStats: [url]http://spam.thegrebs.com[/url]
    Michael Greb Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139