Michael G Schwern wrote:
> 
> I think you misunderstand.  This isn't named parameters vs prototyped
> parameters vs args as list.  The problem is the idea that functions
> should accept *multiple styles by default* which the proposed
> Module::Interface does.

No, it doesn't. Unfortunately, I used just one example of what you could
do with it, an example which many people didn't like. Which is fine.

In the simplest case it would just let you do:

   use Module::Interface qw(args);
   sub my_func (@) {
       my %args = args( {required => [qw/name email/]}, @_);
   }

That is, specify what arguments are required, allowing you to call it
with the standard hash form:

   my_func(name => 'Nate', email => '[EMAIL PROTECTED]');

And if you didn't specify the required args you'd get something like:

   Missing required 'name' parameter to my_func() at - line 1

This is very similar to what Params::Validate does right now; in fact,
the module could well inherit from it.
 
> Saying that most core functions should be callable both ways is
> overkill.  This is what CGI.pm does (for historical reasons, I
> believe, and not by design).  It's unnecessarily confusing and
> requires a not insignificant amount of life-support to make work.

I do agree with this statement.

> Having Module::Interface around to do this sort of thing when desired
> is nice, but please don't cannonize it.
> 
> PS I shudder to think what will happen with an even number of
> arguments in the Module::Interface scheme.

Well, that's one of the reasons to have something like Module::Interface
around - to handle problems with how arguments are passed in. :-)

-Nate

Reply via email to