more useful options | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Very good points you've made. "IMO, there doesn't need to be a sharp distinction between the two." Agreed, and in fact, in certain modules I've written, I provide a new() function that returns a standard blessed-hash object and the other functions then become methods, but internally it's an illusion, as there's no ties to OO at all, and the functions can be exported as well for those who prefer functional (this is a module that wraps a C library, so I wanted a user to be able to use it in the same way they would the real library, or Perl OO if they chose: Example:
That effectively wipes out a class or object. No param checking as I just pass that off to the C library which already takes care of that. The same module also exports the C function calls in their original naming convention (camelCase) if desired alongside the more perlish snake_case. A functional module that also acts OO-ish. Perl: TMTOWTDI ;) In reply to Re^3: Moving from scripting to programming
by stevieb
|
|