Re: How to implement both object->method and module::function interfa ce?
[email protected] (Hildo Biersma) Wed, 09 Aug 2000 08:40:32 +0100
| Newsgroups | perl.perl6.stdlib |
|---|---|
| Organization | Morgan Stanley Dean Witter & Co. |
| Message-ID | <[email protected]> |
Jonathan Scott Duff wrote: > Perhaps. But I believe that all of the modules provided as part of > the standard perl distribution should have both procedural and OO > interfaces where possible. CGI.pm does this in the best way the > author knew how. In perl 6 we'll (hopefully!) have Damian Conway's > want() that'll make it a little easier :-) I sure hope not! There's a reason people use objects - if only to give the user a handle to wrap the module's state. Any module that supports both OO and procedural usage is basically a singleton - only one instance exists at any one time (at least in procedural mode). For most modules, this doesn't and shouldn't make sense. IMHO, what the CGI module should have done is to (a) force people to use OO mode or (b) split into a procedural and an OO module, possibly generated from a common source code. Supporting both at run-time is bizarre. Hildo