in reply to Can we have C-style Modularity?

... In this way, the client program simply invoke the services of the program implementing sub-routines.

But that's exactly what you'd get with a normal Perl module, too... so why not simply implement one?

Replies are listed 'Best First'.
Re^2: Can we have C-style Modularity?
by sumeetgrover (Monk) on Jan 19, 2011 at 15:09 UTC

    Thanks for your reply.

    Agreed, that it's a Perl module and just do it. However, therein lies my question:

    Should a Perl Module only aim at re-usability across different scripts,
    OR
    Can it simply be used for the sake of 'Modularity' of 1 script, even if it might not be used by other scripts?

    Thank you!

      Either. There is more than one way to organize code. You are free to use modules in whatever manner makes the most sense for the organization of your own code.

      Should a Perl Module only aim at re-usability across different scripts,

      If you mean "Should a module only be written when it'll only be used by many scripts?", then the answer is no. Feel free to write modules that will only be used by one script.

      The way you phrased possibly indicates an intention to tightly couple the modules, and that's bad practice in any language.

      I don't see any problem using it only for the sake of modularity of one script :)