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"; } } }
In reply to Accessing a blessed hash reference - Google API by neversaint
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |