Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
Perl Monk, Perl Meditation
 
PerlMonks  

Is there any specific convention/best practices for perl module creation?

by tomishere (Novice)
on Nov 17, 2012 at 11:24 UTC ( #1004303=perlquestion: print w/ replies, xml ) Need Help??
tomishere has asked for the wisdom of the Perl Monks concerning the following question:

On what basis Directories and Files should be classified(Right now each of my Files are for handling specific section of our application)? What should be the maximum number of lines in a file? What are the basic concepts and standards that should be followed while designing Classes and methods? If there is any good links for the same please provide me Thanks

Comment on Is there any specific convention/best practices for perl module creation?
Re: Is there any specific convention/best practices for perl module creation?
by karlgoethebier (Deacon) on Nov 17, 2012 at 13:15 UTC

    Please take a look at here - and you will find some answers to your questions. Regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

Re: Is there any specific convention/best practices for perl module creation?
by 2teez (Priest) on Nov 17, 2012 at 13:15 UTC

    Hi tomishere,
    ..If there is any good links..
    Links you say?
    Please check the followings:
    perlstyle, perlmod then
    See perlmodlib for general style issues related to building Perl modules and classes, as well as descriptions of the standard library and CPAN,
    Exporter for how Perl's standard import/export mechanism works,
    perlootut and perltooc for an in-depth tutorial on creating classes,
    perlobj for a hard-core reference document on objects,
    perlsub for an explanation of functions and scoping, and
    perlxstut and perlguts for more information on writing extension modules.

    If you tell me, I'll forget.
    If you show me, I'll remember.
    if you involve me, I'll understand.
    --- Author unknown to me

      Unless my eyes are deceiving me, I don't see perlmodstyle in your list, which is a very good resource.

      Additionally, if you intend to upload to CPAN, I recommend reading the CPAN Author's FAQ, and About PAUSE (even if you're not uploading to CPAN, there's useful advice).

      Once you're confident enough in your own good judgement to not be blindly influenced by the book, Perl Best Practices (O'Reilly) is useful. But most people seem to ignore the instructions early in the book telling authors that these guidelines are more intended to "get you thinking" than to "tell you what to do." In practice, it seems the opposite happens; the "best practices" are trotted out as a crutch to excuse coders from thinking for themselves. With that caveat, I still think it can be helpful to read through it and try to understand what issues are being addressed, and where the suggestions are (and are not) appropriate.


      Dave

        ++ Dave. Agreed with your point on Perl Best Practices Book.
        However, I suppose the OP wanted a pointer or references to Perl documentations that could help (in writing or) using perl modules correctly.
        Nice inclusion of perlmodstyle.
        Thanks.

        If you tell me, I'll forget.
        If you show me, I'll remember.
        if you involve me, I'll understand.
        --- Author unknown to me
Re: Is there any specific convention/best practices for perl module creation?
by ww (Bishop) on Nov 17, 2012 at 13:34 UTC
    Please see our excellent Tutorials section; specifically, "Modules-How-to-Create-Install-and-Use"

    And please read On asking for help for some hints on how to best obtain help here.

Re: Is there any specific convention/best practices for perl module creation?
by eyepopslikeamosquito (Canon) on Nov 17, 2012 at 23:09 UTC

    On what basis Directories and Files should be classified (Right now each of my Files are for handling specific section of our application)?
    Focus not on files and directories, but on modules. The principal unit of decomposition in Perl is the module.

    When designing modules, focus first on the module interface. Perl Best Practices, Chapter 17 (Modules), "Design the module's interface first" advises how to go about this (play testing and so on). For a detailed discussion of software interfaces in general, see On Interfaces and APIs.

    What should be the maximum number of lines in a file?
    Don't focus on lines in a file. Focus on sound software design. For example:
    • Design highly cohesive, loosely coupled modules.
    • Ensure modules can be tested in isolation.
    • Minimize the exposure of implementation details and avoid global data.
    If you do that, code maintenance becomes easier, and none of your files should be grotesquely huge. See also:

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1004303]
Approved by Old_Gray_Bear
Front-paged by 2teez
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2014-04-23 23:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (556 votes), past polls