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

Legend:
Removed from v.412  
changed lines
  Added in v.422

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9