slloyd has asked for the wisdom of the Perl Monks concerning the following question:

Confession: I have been coding in Perl for over 12 years now and have yet to write a single Perl module. I guess it is becouse I do not quite understand how.. - Where is the best place to go to quickly get up to speed on what it takes? Also, what is the real benefit? Why user modules with the 'use' statement instead of just writing your subs in a separate file and using the 'require' statement to import them? Thanks for any help you can give. Steve

Replies are listed 'Best First'.
Re: Writing Perl Modules
by sweetblood (Prior) on Feb 12, 2005 at 19:23 UTC
      Thanks! Tachyon's Simple Module Tutorial was exactly what I was looking for. Steve

      Effective Perl Programming by merlyn
      To give proper attribution, the most excellent book Effective Perl Programming was written by Joseph N Hall "with" Randal L Schwartz. I assume the "with" indicates that Joseph Hall was the principal author.

Re: Writing Perl Modules
by sh1tn (Priest) on Feb 12, 2005 at 17:28 UTC
    Excellent place to start – perldoc perltoot

    Require - perldoc -f require
    Use - perldoc -f use
Re: Writing Perl Modules
by dimar (Curate) on Feb 12, 2005 at 19:01 UTC

    To program in *any* language for 12 years means (unless you are doing very trivial stuff) you are already familiar with the concept and benefits (nay, essentials) of modularity and code reuse. Apparently, you have gotten by all this time with only using "require." Consequently, in addition to the other splendid suggestions in this thread, you may also want to try a Super Search with the following characteristics:

    where any text contains all of "use", "require" and title contains "require"
    which will give you a nice overview of some issues, after you've had a shot at the tutorials.

      I do use quite a few modules that others have written (DBI, SQLite, Win32::API, Win32::GUI, etc.) but I do use the 'require' often. I am just not comfortable writing my own modules.
Re: Writing Perl Modules
by TStanley (Canon) on Feb 13, 2005 at 02:50 UTC
    samtregar wrote Writing Perl Modules for CPAN which covers the writing of modules in detail.

    TStanley
    --------
    The only thing necessary for the triumph of evil is for good men to do nothing -- Edmund Burke