in reply to Writing a Perl Module... problems
That happens to be the template for whenever I start a new .pm or .pl file in vim (minus the comments, of course).package Name::Name; use 5.6.0; # Always specify the minimum Perl your code expects to work + with. use strict; # Got this right. use warnings FATAL => 'all'; # If you're 5.6+, this catches a lot of s +illy mistakes. our $VERSION = '0.05'; # If you're 5.6+, this is a nicer way of writin +g that VERSION stuff. # MY CODE HERE 1; __END__ # Always put this here to tell you that there can never be any + code after this.
Now - why do you want to call the methods Foo->meth() vs. having it be a library of functions? I've always thought that the way File::Spec does this is really freaking annoying. If you're a library of functions, then provide the functions for export. If you're an OO module, then use Moose (or any of the other 1235123123 OO modules on CPAN) to provide the OO stuff, have your users receive an object, and call methods on that. Just because you can do something is a poor reason to actually do it, especially in production. KISS is a good motto.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Writing a Perl Module... problems
by cosmicperl (Chaplain) on Sep 15, 2007 at 03:39 UTC | |
|
Re^2: Writing a Perl Module... problems
by stvn (Monsignor) on Nov 12, 2007 at 05:57 UTC |