-
Notifications
You must be signed in to change notification settings - Fork 1
/
debug_dryrun.pl
executable file
·57 lines (45 loc) · 1.15 KB
/
debug_dryrun.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/perl
#
use Data::Dumper ;
use strict;
use warnings;
our %p17;
require ('./P17_def.pl');
my $grp = shift @ARGV or die "usage: \"$0 usecode\"";
# print Dumper(\%p17);
# my @keys = (keys %p17) ;
my @keys = sortedkeys (\%p17, $grp) ;
foreach my $querytag ( @keys ) {
my $query = $p17{$querytag};
# print Dumper(\$query);
# print $query->{'tag'};
# die "#### DEBUG ####";
printf "key: %s , label: %s \n", $querytag, $query->{'tag'} ;
# my @fieldlist = @$query{'fields'} ;
my $flptr = $query->{'fields'} ;
my $usage= $query->{'use'} ;
# print Dumper($usage);
# printf "usage %s %d | %s %d" , (@$usage) ;
print "\t\tusage: ";
while ( my ($k, $v) = each %$usage ) {
print "\t $k $v ";
}
print "\n";
# print Dumper(@$flptr);
foreach my $field ( @$flptr ) {
printf "\tfield: %s\n", $field ;
}
# die "#### DEBUG ####";
}
exit;
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# sortedkeys ($p17, 'tag' )
sub sortedkeys {
my ($p, $tag) = @_;
# my %p =
return (
sort { $$p{$a}->{'use'}->{ $tag } <=> $$p{$b}->{'use'}->{ $tag } }
grep { defined ( $$p{$_}->{'use'}->{ $tag } ) }
keys %$p ) ;
}