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

Hi monks, I want to add some modules I have made to CPAN. However I am unsure of what name they should be.

Example: First I have wrapped 'AnyEvent::HTTP' with 'Promises' module to create a 'PromiseHTTP' module.

Then I use that 'PromiseHTTP' module to create a 'PromiseDevice' module to talk to transact with a generic 'device' that other users may own.

The question is what names should they be? Is it allowable to add modules under someone elses name space?

What name should 'PromiseHTTP' be?

AnyEvent::HTTP::Promise Promises::AnyEvent::HTTP Promises::HTTP HTTPEventPromises something else?

Should the 'PromiseMyApi' module be:

Devicename Promises::Device AnyEvent::HTTP::Promise::Device or Something else?

Thanks!

Replies are listed 'Best First'.
Re: CPAN module naming convention?
by hippo (Archbishop) on Sep 04, 2023 at 08:28 UTC
    What name should 'PromiseHTTP' be?

    Since it sounds like it extends AnyEvent::HTTP I would think that AnyEvent::HTTP::Promises would be appropriate. It also fits in with the pattern of the other more general modules AnyEvent::Promises and AnyEvent::XSPromises.

    Should the 'PromiseMyApi' module be:

    That's less clear-cut to me, perhaps because it isn't entirely obvious what this module actually does or is for. What is a "device" in this context? An IoT toaster or something? What is it that makes this module more useful than just working with AnyEvent::HTTP::Promises directly?

    Maybe you might think about publishing AnyEvent::HTTP::Promises (which sounds like a perfectly useful module) on CPAN first on its own. That will allow people to see exactly what it does and how it works. Then with this public knowledge you can come back and show some sample code using the API/Device module and we can see how that fits in and could help choose a good name at that point. How does that sound?

    HTTPEventPromises ... Devicename

    These ones are not great choices - they will add entries to the top-level namespace without good reason and are therefore best avoided.


    🦛

Re: CPAN module naming convention?
by ikegami (Patriarch) on Sep 04, 2023 at 05:27 UTC

    Assuming it uses a module called Promise, Promise::AnyEvent::HTTP?

    On second though, AnyEvent::HTTP::Promise makes the most sense to me.