You say "I see named parameters having value, but the value is only obtained where exposed to the public.", but then go on to say "I prefer the shorter single case format.".
But the public interface is for other people to call, not you, so surely you should cater to their preferences, not yours?
But of course you couldn't possibly cater to all their preferences, no more than they are all likely to cater for your preferences.
So the problem remains that even if you could guess what the names of the arguments might be (highly unlikely), for some new module you are using, you'd still have to look up the documentation to discover the casing of those names. And as soon as you have to look the up, any "easier to learn" justifiction for named arguments goes right out the window.
And once you've looked it up, the ordering of parameters are far easier to remember than the names and casing, so the "easier to remember" justifiction crashes and burns also.
All that leaves is the nebulous old standby, the "easier to read" justifiction. But that doesn't stand up to logical analysis either.
Take your 'foo' function, as poor an example as it is. The crux of your defence is that this;
my $dbh = foo(
q{debug} => 0,
q{db} => SQL_DB,
q{host} => SQL_SERVER,
q{port} => SQL_PORT,
q{user} => SQL_USER,
q{pass} => SQL_PASS,
);
Is somehow easier to read than:
my $dbh = foo( SQL_SERVER, SQL_PORT, SQL_DB, SQL_USER, SQL_PASS, DEBUG
+ );
Note the reordering of the parameters into their 'natural ordering'. Ie. A server responds on a port, contains the DB which can be accessed by a user with an appropriate password, who may want to debug this code.
And that just ain't true. Regardless of whether you are passing constants (symbolic or inlined) or variables, the names of the variables or symbolic constants, or the values of the inlined constants makes the naming of the parameters just redundant noise. (And ignoring the quoting properties of the fat comma by using 'fat quoting' is just more redundant noise.)
Far better and simpler would be:
my $dbh = foo( SQL_DSN, SQL_USER, SQL_PASS, DEBUG );
There is no point in breaking out the DSN sub-fields as there is nothing you can do to validate them. Can you check the name of the server or database or user? Tell the guy he has supplied the wrong password? I guess you could check that the supplied port number is in the range 0..65535, but then your users might be using a named pipe connection anyway.
And defaulting them individually makes no sense at all. You've said this is a public API, so what are you going to use as the default for the server name (for all your users!): MySqlServer? The DB name: myDB? The user name:root? Password?
For a more thorough examination of the futility of breaking apart DBI DSNs see Re^5: Avoiding compound data in software and system design.
Even port number, unless this is an open DB, security suggests that it makes a lot of sense to not use the default port number. No point in making it easy for the hackers.
The fact that your example is contrived for the purposes of supporting your emotive argument, suggests that you didn't have a real example somewhere in your codebase. And that further suggests that this is an idea you subscribe to, not a practice that you er... practice.
And ideas born of purely theoretical, high ideology, are rarely practical in practice. They become burdens to ingenuity and productivity for no payback.
I was reading an article the other day about a bunch of people and companies trying to come up with standards for cloud computing. The crux of piece is that as yet, no one really knows what "cloud computing" is, never mind the best way to do it. It is therefore way too premature to be considering draughting a standard, much less to impose it upon anyone.
The best (I would say:only good) standards are the de-facto standards that get codified, cleaned up and adopted. You have a free-for-all period where everyone tries to do things whatever way seems to work, and slowly, over a period of practical usage, certain practices fall out as being easier to use, or more effective or more efficient. Ie. More practical. That's when standardisation should be considered.
IMO the biggest problem with CPAN, is that the APIs for many of the modules there where defined on the basis of the author sitting down and inventing them, rather than them falling out of writing an application that needs to do what the module does. Which means that applications end up having to be structured to fit the exposed API, rather than the API fitting the way you would want to write the application. (There are also many good exceptions to that!)