in reply to Re: Re: passing subroutine args as a hash: why not?
in thread passing subroutine args as a hash: why not?

Why aren't those 61 arguments encapsulated in an easy to use data structure? If they were, your question would be moot. Consider how much improved your life would be if you changed the code so that it things looked like this:

my $query = CGI->new; my %reg_info = parse_registration_info($query); my $success = store_registration_info(\%reg_info, $database_handle);
or, alternatively, like this:
my $query = CGI->new; my $registration = OurWebsite::User::Registration->new($query); my $success = $registration->store($database_handle);
Sure, that's contrived. But the point is that passing around dozens of arguments is ridiculous. If you changed the function to take named arguments, you'd be passing twice as many arguments total (the args and their names.) Working with that much cruft is neither easy nor necessary. Build a data structure that holds that information once, as you parse it, and then pass around a single reference to that structure.

-sauoq
"My two cents aren't worth a dime.";

Replies are listed 'Best First'.
Re: Re: Re: Re: passing subroutine args as a hash: why not?
by Willard B. Trophy (Hermit) on Jun 05, 2003 at 21:37 UTC
    They're not wrapped in a data structure, 'cos that's the way the code is, and modifications are needed by tomorrow.

    --
    bowling trophy thieves, die!