Skip to content
Snippets Groups Projects
Commit b50a5603 authored by Andy Yates's avatar Andy Yates
Browse files

better version of this code I hope

parent 0d5d85f2
No related branches found
No related tags found
No related merge requests found
......@@ -1573,14 +1573,12 @@ sub load_registry_from_db {
if(! defined $db_version) {
# Do checking for the -DB_VERSION flag which can be mis-spelt. Regex assembled using:
# perl -MRegexp::Assemble -e '$r=Regexp::Assemble->new(); $r->add($_) for ("-dbversion","-version","-verion","-verison"); print $r->re, "\n";'
my $db_version_flag_re = qr/(?-xism:-(?:ver(?:is?|si)|dbversi)on)/xism;
for(my $i = 0; $i < scalar(@args); $i = $i+2) {
if($args[$i] =~ $db_version_flag_re) {
my $msg = sprintf(q{Detected no -DB_VERSION flag but found '%s'; assuming a mis-spelling. Please fix}, $args[$i]);
warning($msg);
$db_version = $args[$i+1];
last;
}
my %hashed_args = @args;
my ($possible_key) = grep { $_ =~ /(?-xism:-(?:ver(?:is?|si)|dbversi)on)/xism } keys %hashed_args;
if($possible_key) {
my $msg = sprintf(q{Detected no -DB_VERSION flag but found '%s'; assuming a mis-spelling. Please fix}, $possible_key);
warning($msg);
$db_version = $hashed_args{$possible_key};
}
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment