+sub add_mod_deps
+{
+ my ($depth, $mod, $mod2, $module, $this_module) = @_;
+
+ $depth .= " ";
+ warn "${depth}loading deps of module: $this_module\n" if $verbose;
+ if (length($depth) > 50) {
+ die "too much recursion (circular dependencies in modules?)";
+ }
+
+ foreach my $md (keys %{$mod->{$this_module}}) {
+ add_mod_deps ($depth, $mod, $mod2, $module, $md);
+ warn "${depth} outputting $md\n" if $verbose;
+ maybe_unshift (\@{$$mod2->{$module}}, $md);
+ }
+
+ if (!%{$mod->{$this_module}}) {
+ warn "${depth} no deps\n" if $verbose;
+ }
+}