[svn:parrot] r36263 - trunk/config/gen

fperrad at svn.parrot.org fperrad at svn.parrot.org
Sun Feb 1 22:25:30 UTC 2009


Author: fperrad
Date: Sun Feb  1 22:25:30 2009
New Revision: 36263
URL: https://trac.parrot.org/parrot/changeset/36263

Log:
[config] check the type of each value during config_lib.pasm generation

Modified:
   trunk/config/gen/config_pm.pm

Modified: trunk/config/gen/config_pm.pm
==============================================================================
--- trunk/config/gen/config_pm.pm	Sun Feb  1 21:46:02 2009	(r36262)
+++ trunk/config/gen/config_pm.pm	Sun Feb  1 22:25:30 2009	(r36263)
@@ -93,15 +93,20 @@
 
     while (<$IN>) {
         if (/\@PCONFIG\@/) {
-            my $k;
-            for $k ( sort { lc $a cmp lc $b || $a cmp $b } $conf->data->keys ) {
+            for my $k ( sort { lc $a cmp lc $b || $a cmp $b } $conf->data->keys ) {
                 my $v = $conf->data->get($k);
                 if ( defined $v ) {
+                    my $type = ref $v;
+                    if ( $type ) {
+                        die "type of '$k' is not supported : $type\n";
+                    }
+                    # Scalar
                     $v =~ s/(["\\])/\\$1/g;
                     $v =~ s/\n/\\n/g;
                     print {$OUT} qq(    set P0["$k"], "$v"\n);
                 }
                 else {
+                    # Undef
                     print {$OUT} qq(    set P0["$k"], P1\n);
                 }
             }


More information about the parrot-commits mailing list