[Fai-commit] r3606 - people/michael/features/setup_harddisks_2/implementation

fai-commit at lists.alioth.debian.org fai-commit at lists.alioth.debian.org
Sat Jul 22 11:02:39 UTC 2006


Author: michael-guest
Date: 2006-07-22 11:02:38 +0000 (Sat, 22 Jul 2006)
New Revision: 3606

Modified:
   people/michael/features/setup_harddisks_2/implementation/shdd2-parser
Log:
more beautiful code


Modified: people/michael/features/setup_harddisks_2/implementation/shdd2-parser
===================================================================
--- people/michael/features/setup_harddisks_2/implementation/shdd2-parser	2006-07-22 10:40:41 UTC (rev 3605)
+++ people/michael/features/setup_harddisks_2/implementation/shdd2-parser	2006-07-22 11:02:38 UTC (rev 3606)
@@ -351,52 +351,22 @@
     
 }
 
-
 sub print_hash
 {
-  my ($hash_ref_ref) = @_;
-
-
-  my %hash_ref = %$hash_ref_ref;
-  printf "----\n";
-  print (keys %hash_ref, "\n"); 
-  foreach my $key ( keys %hash_ref)  # Cycle through all key
+  my ($hash_ref, $k) = @_;
+  $k=$k.">";
+  foreach my $key (keys %$hash_ref)
   {
-    print $hash_ref{$key}."\n";
-
-    foreach my $key2 (keys %{$hash_ref{$key}})
+    printf "$k Schluessel: ". $key." Wert: ".$hash_ref->{$key}."\n";
+    if (ref($hash_ref->{$key}))
     {
-
-
-      printf "Schluessel: ". $key2." Wert: ".$hash_ref{$key}{$key2}."\n"; 
-      if($key2 eq "partitions")
-      {
-        foreach my $key3 (keys %{$hash_ref{$key}{$key2}})
-        {
-          printf "--> Schluessel: ". $key3." Wert: ".$hash_ref{$key}{$key2}{$key3}."\n";
-          foreach my $key4 (keys %{$hash_ref{$key}{$key2}{$key3}})
-          {
-            printf "---> Schluessel: ". $key4." Wert: ".$hash_ref{$key}{$key2}{$key3}{$key4}."\n";
-            if($key4 eq "size")
-            {
-              foreach my $key5 (keys %{$hash_ref{$key}{$key2}{$key3}{$key4}})
-              {
-                printf "----> Schluessel: ". $key5." Wert: ".$hash_ref{$key}{$key2}{$key3}{$key4}{$key5}."\n";     
-              }
-            }
-
-          }
-
-
-        }
-      }
-
+      &print_hash_rec($hash_ref->{$key}, $k);
     }
 
   }
-  printf "----\n";
 }
 
+
 my $ifs = $/;
 undef $/;
 my $input = <STDIN>;




More information about the Fai-commit mailing list