[system] / trunk / webwork2 / lib / WeBWorK / CourseEnvironment.pm Repository:
ViewVC logotype

Diff of /trunk/webwork2/lib/WeBWorK/CourseEnvironment.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 323 Revision 324
69 69
70 bless $self, $class; 70 bless $self, $class;
71 return $self; 71 return $self;
72} 72}
73 73
74sub hash2string {
75 my $hr = shift;
76 my $indent = shift || 0;
77 my $result;
78 foreach (keys %$hr) {
79 $result .= "\t"x$indent . "{$_} =";
80 if (ref $hr->{$_} eq 'HASH') {
81 $result .= "\n";
82 $result .= hash2string($hr->{$_}, $indent+1);
83 } elsif (ref $hr->{$_} eq 'ARRAY') {
84 $result .= "\n";
85 $result .= array2string($hr->{$_}, $indent+1);
86 } else {
87 $result .= " " . $hr->{$_} . "\n";
88 }
89 }
90 return $result;
91}
92
93sub array2string {
94 my $ar = shift;
95 my $indent = shift || 0;
96 my $result;
97 foreach (0 .. @$ar-1) {
98 $result .= "\t"x$indent . "[$_] =";
99 if (ref $ar->[$_] eq 'HASH') {
100 $result .= "\n";
101 $result .= hash2string($ar->[$_], $indent+1);
102 } elsif (ref $ar->[$_] eq 'ARRAY') {
103 $result .= "\n";
104 $result .= array2string($ar->[$_], $indent+1);
105 } else {
106 $result .= " " . $ar->[$_] . "\n";
107 }
108 }
109 return $result;
110}
111
74# ----- utils ----- 112# ----- utils -----
75 113
76sub readFile { 114sub readFile {
77 my $fileName = shift; 115 my $fileName = shift;
78 open INPUTFILE, "<", $fileName 116 open INPUTFILE, "<", $fileName

Legend:
Removed from v.323  
changed lines
  Added in v.324

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9