From: František Dvořák Date: Fri, 8 Sep 2006 09:05:16 +0000 (+0000) Subject: Works good, fixed the output (forgotten hash, test for existence). X-Git-Tag: glite-jp-index_R_1_2_2~7 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=3b4dca71996d9e7387fe5880b2c86b7db5a91db9;p=jra1mw.git Works good, fixed the output (forgotten hash, test for existence). --- diff --git a/org.glite.jp.index/examples/pch06/query3.pl b/org.glite.jp.index/examples/pch06/query3.pl index a9ac5ca..2546707 100644 --- a/org.glite.jp.index/examples/pch06/query3.pl +++ b/org.glite.jp.index/examples/pch06/query3.pl @@ -91,8 +91,8 @@ foreach my $jobid (@according_jobs) { print "Results\n"; print "=======\n"; print "\n"; -foreach my $jobid (sort { $according_jobs{$b}{attributes}{"$pch::jplbtag:IPAW_STAGE"}[0] <=> $according_jobs{$a}{attributes}{"$pch::jplbtag:IPAW_STAGE"}[0] } keys %according_jobs) { - my %job = %{$according_jobs{jobid}}; +foreach my $jobid (sort { $according_jobs{$b}{attributes}{"$pch::jplbtag:IPAW_STAGE"}{value}[0] <=> $according_jobs{$a}{attributes}{"$pch::jplbtag:IPAW_STAGE"}{value}[0] } keys %according_jobs) { + my %job = %{$according_jobs{$jobid}}; my %attributes = %{$job{attributes}}; my $stage = $attributes{"$pch::jplbtag:IPAW_STAGE"}{value}[0]; @@ -101,10 +101,16 @@ foreach my $jobid (sort { $according_jobs{$b}{attributes}{"$pch::jplbtag:IPAW_ST # query & output all desired atributes foreach my $attr (@view_attributes) { - my %attr = %{$attributes{$attr}}; my $attr_name = $attr; $attr_name =~ s/.*://; - print " attr $attr_name: "; print join(", ", @{$attr{value}}); print "\n"; + print " attr $attr_name: "; + if (exists $attributes{$attr}) { + my %attr = %{$attributes{$attr}}; + + print join(", ", @{$attr{value}}); print "\n"; + } else { + print "N/A\n"; + } } print "\n";