in reply to Re^2: Subroutines vs Modules
in thread Subroutines vs Modules
you are looking at the consequences of modules vs. subroutines, and your observations are correct, but only because there are technical reasons that make them so
Fundamentally speaking, a subroutine and the subroutines IN a module are identical (note that your "subroutine to module" comparison is not quite apples to apples)*, they differ by being subroutines that exist in different namespaces (aka., in perl, packages)
it's because you can segregate your subroutines by namespace in this way that makes it easy to move the code between programs (and programmers) - it also helps that modules typically exist in separate files too (of course).
*footnote: it's an easy mixup to make, because most modules present themselves as offering a single object, sometimes a single subroutine even
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Subroutines vs Modules
by Anonymous Monk on Jan 04, 2006 at 13:59 UTC |