neversaint has asked for the wisdom of the Perl Monks concerning the following question:
My problem is how can I print out the value of "fullViewableName" under the value above? I tried this:print Dumper $re->directoryCategory(); # which gives $VAR1 = bless( { 'fullViewableName' => 'foo', 'specialEncoding' => '' }, 'DirectoryCategory' );
But doesn't work. What's the correct way to do it?foreach my $dc ( %{ $re->directoryCategory() } ) { print $dc->fullViewableName()."\n" ; }
use warnings; use strict; use Data::Dumper; use Net::Google; use constant LOCAL_GOOGLE_KEY =>"***********************"; my $service = Net::Google->new( key => LOCAL_GOOGLE_KEY ); my $session = $service->search(); $session->query(qw (beadwork )); $session->starts_at(5); $session->max_results(15); my $responses = $session->response(); #print Dumper $responses ; foreach my $r ( @{$responses} ) { print sprintf( "%s : %s\n", $r->searchQuery(), $r->estimatedTotalResultsCount() ); foreach my $re ( @{ $r->resultElements() } ) { print $re->URL() . "\n"; print Dumper $re->directoryCategory(); foreach my $dc ( %{ $re->directoryCategory() } ) { print $dc->fullViewableName()."\n"; } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Accessing a blessed hash reference - Google API
by BerntB (Deacon) on Apr 10, 2006 at 06:14 UTC | |
|
Re: Accessing a blessed hash reference - Google API
by japhy (Canon) on Apr 10, 2006 at 13:34 UTC | |
by neversaint (Deacon) on Apr 12, 2006 at 00:30 UTC |