Hi Balaji, > I wanted your comments and some suggestions. I am planning on publishing a > Perl module that I have written and successfully used for some time now. I > hope it is useful to others as well.
There are a number of places where you can get feedback on module ideas: http://prepan.org <http://prepan.org/> is a website where you can post an outline of your module, link to a github repo, and ask for feedback on the name and other aspects. module-auth...@perl.org <mailto:module-auth...@perl.org> is a mailing list where CPAN authors can discuss any aspect of the module creation process. I’ll add some quick comments as well. > NAME > > Auto::Log - a simple Perl extension that allows messages to be redirected to > a specific file I wouldn’t put this in the “Auto” top-level namespace. If you look on MetaCPAN you’ll see a lot of modules in the Log:: namespace, some in Logfile::, and a small handful in Logger:: You might want to look at some of the existing modules, and see if there’s one that already provides the functionality that you have? If not, that might help you think about differentiating your module, both in the design / interface, and in the documentation. Doing such a mini review will also help you write the SEE ALSO section of your documentation :-) > SYNOPSIS > > use Auto::Log; > > my $log = new Auto::Log "allmsg.log”; The indirect method notation should be avoided these days. This should be written as: my $log = Auto::Log->new(‘allmsg.log’); You can find various pages online explaining why you shouldn’t use the indirect notation; here’s one of them: http://modernperlbooks.com/mt/2009/08/the-problems-with-indirect-object-notation.html > print "This will go into the log file.\n"; > warn "This will also automatically go into the log file.\n" > $log->DESTROY; # restores STDOUT and STDERR to original state You shouldn’t call the DESTROY method explicitly. If you want to illustrate the action of the DESTROY handler, you could have it going out of scope, and have a comment. Something like: { my $log = Auto::Log->new('allmsg.log'); # … do some stuff } # $log goes out of scope # The DESTROY method will restore STDOUT and STDERR You may also want to take a look at IO::Capture, and link it in your SEE ALSO. Cheers, Neil