MrCBofBCinTX
Technical User
I am trying to accomplish two things, speed and readability.
I have moved from an if elsif list of options to this:
This has excellent readability, but how does this effect speed and memory usage?
I am running mod_perl.
I have moved from an if elsif list of options to this:
Perl:
# earlier:
my @available_commands # In modules
= qw(ViewRecords
InsertRecordGroupForm
UpdateRecordForm
InsertRecordGroup
UpdateRecord
DeleteDuplicates
ShowColumns
ShowTables
);
# later:
if (! grep {$_ eq $command} @available_commands) {
ErrorMessages($r, $lang, "un comando valido", "a valid command");
goto ERROR_END;
}
else {
$dbh->{AutoCommit} = 0;
my $sub = \&{"$command"};
&$sub( $r, $dbh, $q, $database, $program, $lang );
$dbh->commit();
$dbh->{AutoCommit} = 1;
}
This has excellent readability, but how does this effect speed and memory usage?
I am running mod_perl.