Gossamer Forum
Home : Products : DBMan : Installation :

sub get_defaults

Quote Reply
sub get_defaults
Hi,

is there a bug in the get_defaults function?
because i had to rewrite it, to work:

sub get_defaults {

my (%default, $field);

foreach $field (keys %db_defaults) {

if (($db_defaults{$field} eq "now") and ($db_def{$field}[1] eq "DATE")) {
$default{$field} = &get_date;
}

elsif (($db_defaults{$field} eq "now") and ($db_def{$field}[1] eq "TIME")) {
$default{$field} = &get_time;
}
else {
$default{$field} = $db_defaults{$field};

}

}

return %default;

}


the old version is like this:

sub get_defaults {

my (%default, $field);

foreach $field (keys %db_defaults) {

if (($db_defaults{$field} eq "now") and ($db_def{$field}[0] eq "DATE")) {
$default{$field} = &get_date;
}

elsif (($db_defaults{$field} eq "now") and ($db_def{$field}[0] eq "TIME")) {
$default{$field} = &get_time;
}
else {
$default{$field} = $db_defaults{$field};

}

}

return %default;

}



[This message has been edited by Oliver Antosch (edited January 14, 1999).]
Quote Reply
Re: sub get_defaults In reply to
Yes, you are right it is a bug. I added that into the SQL version so you could put 'now' into the defaults to get the current date or time.

I did this instead of just putting &get_date as I had a problem running the setup script.

That fix looks good.

Cheers,

Alex
Quote Reply
Re: sub get_defaults In reply to
Hello Alex,

yes i noticed that the nph-setup.cgi script
hangs when i use the get date function.

Another question is, why is it nph? it has to be called nph... at the beginning right?