Matt Spinler | bbd66d2 | 2019-04-09 13:18:29 -0500 | [diff] [blame] | 1 | #! /usr/bin/perl |
| 2 | |
| 3 | use strict; |
| 4 | use warnings; |
| 5 | use mrw::Targets; |
| 6 | |
| 7 | my $targetObj; |
| 8 | my $serverwizFile = $ARGV[0]; |
| 9 | if ((not defined $serverwizFile) || (! -e $serverwizFile)) { |
| 10 | die "Usage: $0 [XML filename]\n"; |
| 11 | } |
| 12 | |
| 13 | $targetObj = Targets->new; |
| 14 | $targetObj->loadXML($serverwizFile); |
| 15 | |
| 16 | dumpMRW($targetObj); |
| 17 | |
| 18 | sub dumpMRW |
| 19 | { |
| 20 | my ($targetObj) = @_; |
| 21 | |
| 22 | for my $target (sort keys %{$targetObj->getAllTargets()}) { |
| 23 | print "-----------------------------------------------------------\n"; |
| 24 | print "Target $target\n"; |
| 25 | my $thash = $targetObj->getTarget($target); |
| 26 | |
| 27 | for my $attr (keys %{$thash->{ATTRIBUTES}}) { |
| 28 | print "\t$attr: "; |
| 29 | |
| 30 | if (ref($thash->{ATTRIBUTES}->{$attr}->{default}) eq "HASH") { |
| 31 | print "\n"; |
| 32 | |
| 33 | for my $f (sort keys %{$thash->{ATTRIBUTES}-> |
| 34 | {$attr}->{default}->{field}}) { |
| 35 | |
| 36 | my $val = $thash->{ATTRIBUTES}-> |
| 37 | {$attr}->{default}->{field}->{$f}->{value}; |
| 38 | print "\t\t$f: $val\n"; |
| 39 | } |
| 40 | } |
| 41 | else { |
| 42 | print $thash->{ATTRIBUTES}->{$attr}->{default} . "\n"; |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 | } |