]> git.sesse.net Git - wloh/commitdiff
Factor out the parameter saving into its own function.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 25 Mar 2012 15:25:58 +0000 (17:25 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 25 Mar 2012 15:25:58 +0000 (17:25 +0200)
www/index.pl

index ec6428c5f6072545110821b20adec298c8f4f9c7..0ce8cc6d444d844338f03d51b0304e21b3545b4f 100755 (executable)
@@ -136,15 +136,8 @@ sub get_covariance_matrix {
        return $cov;
 }
 
-sub make_table {
-       my ($lowest_division, $used_ratings, $used_cov) = @_;
-
-       print <<"EOF";
-
-    <table>
-      <tr>
-        <th></th>
-EOF
+sub write_parms_to_file {
+       my ($used_ratings, $used_cov) = @_;
 
        POSIX::setlocale(&POSIX::LC_ALL, 'C');
 
@@ -179,6 +172,20 @@ EOF
 
        POSIX::setlocale(&POSIX::LC_ALL, 'nb_NO.UTF-8');
 
+       return $tmpnam;
+}
+
+sub make_table {
+       my ($lowest_division, $used_ratings, $used_cov) = @_;
+
+       print <<"EOF";
+
+    <table>
+      <tr>
+        <th></th>
+EOF
+
+       my $tmpnam = write_parms_to_file($used_ratings, $used_cov);
        my %prob = ();
 
        open MCCALC, "$config::base_dir/mcwordfeud $trials < $tmpnam |"