http://www.perlmonks.org?node_id=303697

Mail::SimpleList and Mail::TempAddress grew out of the same base idea: an e-mail can be an RPC call to a remote program. Consequently, they share quite a bit of code.

I've been refactoring the commonalities into a parent module. It needs a good name, though. My best idea so far is Mail::Command, though it's not completely satisfying. Mail::Action came to mind while writing the title. It's not bad.

Is there a better title?

Update: Here's a brief overview of the parent module.

new creates a new object containing a storage object and a Mail::Internet object representing the incoming message. Two accessor methods, addresses and message allow retrieving these objects.

address_field retrieves and cleans an address or list of addresses from a message field.

find_command looks for a command in the subject of the message and checks that the current object can handle that command.

reply sends a response message.

copy_headers copies message headers from an incoming message to an outgoing message.

process_body processes directives found in the body of a message, based on what the current address object can handle.

command_help responds to a help request with the "how to use this module" section of the documentation.

I'll probably also refactor out commonalities of the storage module and the actual address modules into two other parent classes. See Mail::SimpleList::Aliases versus Mail::TempAddress::Addresses and Mail::SimpleList::Alias versus Mail::TempAddress::Address, respectively.

Replies are listed 'Best First'.
Re: Naming a Mail Action Module
by demerphq (Chancellor) on Nov 01, 2003 at 01:59 UTC

    grew out of the same base idea: an e-mail can be an RPC call to a remote program. Consequently, they share quite a bit of code.

    It sounds to me like you have the basis of the name in your first sentence. Mail::RPC. Thats pretty clear what it does. :-)

    Also, it sounds like a Mail/MIME/SMTP implementation of a CGI::Application, so perhaps Mail::Application?


    ---
    demerphq

      First they ignore you, then they laugh at you, then they fight you, then you win.
      -- Gandhi


      I'll second the Mail::Application proposition.

      Makeshifts last the longest.

      And I'll second Mail::RPC. I think Mail::Application is a little too generic. Someone might think it would provide a framework for writing an MUA for instance.

      -sauoq
      "My two cents aren't worth a dime.";
      
Re: Naming a Mail Action Module
by Ovid (Cardinal) on Oct 31, 2003 at 20:57 UTC

    Can you provide some sample code of the parent module? Without knowing what the common functionality is, it's tough to give it a name.

    Cheers,
    Ovid

    New address of my CGI Course.

Re: Naming a Mail Action Module
by simonm (Vicar) on Nov 01, 2003 at 04:31 UTC
    I think it would be good to reference the "action on receipt" nature of the code, so that it's clear that it doesn't have anything to do with the command for sending mail; perhaps something along the lines of Mail::ReceiptAction, Mail::ActionAddress, Mail::AutoResponse, or Mail::RequestHandler?
Re: Naming a Mail Action Module
by jZed (Prior) on Nov 01, 2003 at 19:09 UTC
    Maybe something along the lines of Mail::OnTheFly or Mail::AdHoc because that's what seems most different about these modules - they allow you to do things like create lists and users on-the-fly rather than as permanent parts of your mail setup.

    I like Mail::Application, Mail::Action, Mail::RPC but they don't seem to capture the fact that it's directives in the email itself which initiate the Actions. Maybe something like Mail::Message2Action or Mail::CommandLang. (Well those kinda suck, but provide more explicit explanation and could encompass many other sorts of modules)

Re: Naming a Mail Action Module
by Aristotle (Chancellor) on Nov 01, 2003 at 19:54 UTC
    sauoq is right that ::Application is a bit too generic. On second thought, I'd suggest Mail::Responder. That's exactly what it is..

    Makeshifts last the longest.