From 3b4dca71996d9e7387fe5880b2c86b7db5a91db9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= Date: Fri, 8 Sep 2006 09:05:16 +0000 Subject: [PATCH] Works good, fixed the output (forgotten hash, test for existence). --- org.glite.jp.index/examples/pch06/query3.pl | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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"; -- 1.8.2.3