On Tue, Mar 23, 2010 at 08:50:38AM -0500, Kyle Emmons wrote:

> I am preparing a new module for upload to CPAN. Currently it is named 
> Net::PJLink, as it is an implementation of the PJLink network protocol (used 
> for controlling multimedia projectors). However, I read the warning at 
> https://pause.perl.org/pause/authenquery?ACTION=pause_namingmodules#Net and 
> thought it would be best to make sure before requesting the namespace. Is 
> there a more appropriate name for this module?

If you're implementing a network protocol - and it sounds like you are -
as opposed to an application that uses that protocol, then Net::* is the
right place.

> My second question concerns writing tests for this module. Most of the 
> module's functionality is based on formatting and parsing network messages. 
> I've thought of making the test fork a listener process that the tests can 
> connect to, but I think that might cause problems on some platforms and 
> firewalls. I could put special functions in the module that would return the 
> network message instead of sending it, but that wouldn't really be testing 
> the network functionality.

Forking and talking to the forked listener would work, just make sure
that you clean up the process, even if something goes wrong such as your
tests dieing or the user pressing C-c.  I guess the code for cleaning
up should go in an END block.

Mocking the code that sends the message isn't a terrible idea either.
Presumably the function that sends stuff is basically a thin wrapper
around some code that prepares a message, so splitting that into a
seperate function makes a certain amount of sense anyway, and might help
avoid duplication of code as well as making it easier to test.

-- 
David Cantrell | Godless Liberal Elitist

         Nuke a disabled unborn gay baby whale for JESUS!

Reply via email to