in reply to Question about making modules.

Some comments, not necessarily in any order:

Have you looked at how CPAN modules are written? Take a look at what they do - there's a style that's evolved over the years in order to handle the vast array of installation targets.


My criteria for good software:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?

Replies are listed 'Best First'.
Re^2: Question about making modules. (perl ver)
by tye (Sage) on Jul 06, 2008 at 18:07 UTC
    Put in a required minimum Perl version.

    Gah. Please don't. Don't proclaim "This requires Perl version X" unless you actually know that it really does require it. And if you do go to the effort of figuring out that a particular version is required, then please be quite specific in describing why that particular version is required (at the least).

    I'd much rather get an error that points right at the thing that isn't supported with my version of Perl than be told "The author of this module has decided to prevent this module from even attempting to run on your version of Perl but absolutely no insight as to why was provided." That's just rude or worse.

    Update: It'd be nice if "use 5.006_001('open my $fh');" were supported so that when an author provides insight we don't have to go hunting for it.

    - tye        

      I'm with you there. Being able to specify minimum feature requirements vs. minimum version is a much nicer solution, and not just for Perl versions.

      In the meantime, specifying a minimum Perl version is better than failing randomly after installation. To me, "use 5.006_000;" is important because of the number of times I've moved files from Pure-Perl modules around and hit random bugs.


      My criteria for good software:
      1. Does it work?
      2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
Re^2: Question about making modules.
by linuxer (Curate) on Jul 06, 2008 at 22:13 UTC
    Don't use version. Don't use v-strings.

    Can you explain or give a link to an explanation why not?

    What to use instead?

      v-strings weren't supported prior to 5.6 and the support for them changed in 5.8 and they were removed in 5.10. So, do you want to use something with that kind of track record?

      My criteria for good software:
      1. Does it work?
      2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?

        Ok, that clarifies, that I don't want to use v-strings. ;o)

        But there's some confusion left because of the version pragma.

        My Cygwin perl 5.10 and ActivePerl 5.8.8 both have that pragma available; but if I try to check the perldoc at http://perldoc.perl.org/ that pragma is undocumented?

        I got curious because I read the chapter about versioning in "Perl Best Practices" and it presented the version pragma... Some minutes later I read your answer not to use it.