#!/usr/bin/perl use strict; use warnings; use Config::Simple; use Flickr::API; use XML::Parser::Lite::Tree::XPath; my $cfg = new Config::Simple('FlickrAuthenticate.ini'); my $flickr_api_key = $cfg->param('Flickr.API_KEY'); my $flickr_secret = $cfg->param('Flickr.API_SHARED_SECRET'); my $flickr_email = $cfg->param('Flickr.email'); my $flickr_password = $cfg->param('Flickr.password'); my $api = new Flickr::API({'key' => $flickr_api_key, 'secret' => $flickr_secret}); my $response = $api->execute_method('flickr.auth.getFrob', { api_key => $flickr_api_key } ); my $xpath = new XML::Parser::Lite::Tree::XPath($response->{tree}); my @nodes = $xpath->select_nodes('/frob'); use Data::Dumper; print Dumper($xpath); print Dumper(\@nodes); print Dumper($nodes[0]->{children}); print Dumper($nodes[0]->{self}); #### $VAR1 = bless( { 'max_order' => 6, 'tree' => { 'parent' => undef, 'order' => 1, 'name' => 'rsp', 'children' => [ { 'parent' => $VAR1->{'tree'}, 'order' => 2, 'content' => ' ', 'children' => [], 'type' => 'data' }, { 'parent' => $VAR1->{'tree'}, 'seq_num' => 1, 'name' => 'frob', 'children' => [ { 'parent' => $VAR1->{'tree'}{'children'}[1], 'order' => 4, 'content' => '72157604013085297-45646646467d-280706', 'children' => [], 'type' => 'data' } ], 'seq_count' => 1, 'order' => 3, 'type' => 'tag', 'attributes' => {} }, { 'parent' => $VAR1->{'tree'}, 'order' => 5, 'content' => ' ', 'children' => [], 'type' => 'data' } ], 'type' => 'tag', 'attributes' => { 'stat' => 'ok' } } }, 'XML::Parser::Lite::Tree::XPath' ); $VAR1 = [ { 'parent' => { 'parent' => undef, 'order' => 1, 'name' => 'rsp', 'children' => [ { 'parent' => $VAR1->[0]{'parent'}, 'order' => 2, 'content' => ' ', 'children' => [], 'type' => 'data' }, $VAR1->[0], { 'parent' => $VAR1->[0]{'parent'}, 'order' => 5, 'content' => ' ', 'children' => [], 'type' => 'data' } ], 'type' => 'tag', 'attributes' => { 'stat' => 'ok' } }, 'seq_num' => 1, 'name' => 'frob', 'children' => [ { 'parent' => $VAR1->[0], 'order' => 4, 'content' => '72157604013085297-45646646467d-280706', 'children' => [], 'type' => 'data' } ], 'seq_count' => 1, 'order' => 3, 'type' => 'tag', 'attributes' => {} } ]; $VAR1 = [ { 'parent' => { 'parent' => { 'parent' => undef, 'order' => 1, 'name' => 'rsp', 'children' => [ { 'parent' => $VAR1->[0]{'parent'}{'parent'}, 'order' => 2, 'content' => ' ', 'children' => [], 'type' => 'data' }, $VAR1->[0]{'parent'}, { 'parent' => $VAR1->[0]{'parent'}{'parent'}, 'order' => 5, 'content' => ' ', 'children' => [], 'type' => 'data' } ], 'type' => 'tag', 'attributes' => { 'stat' => 'ok' } }, 'seq_num' => 1, 'name' => 'frob', 'children' => $VAR1, 'seq_count' => 1, 'order' => 3, 'type' => 'tag', 'attributes' => {} }, 'order' => 4, 'content' => '72157604013085297-45646646467d-280706', 'children' => [], 'type' => 'data' } ]; $VAR1 = undef; #### #!/usr/bin/perl use strict; use warnings; use Config::Simple; use Flickr::API; use XML::Parser::Lite::Tree::XPath; my $cfg = new Config::Simple('FlickrAuthenticate.ini'); my $flickr_api_key = $cfg->param('Flickr.API_KEY'); my $flickr_secret = $cfg->param('Flickr.API_SHARED_SECRET'); my $flickr_email = $cfg->param('Flickr.email'); my $flickr_password = $cfg->param('Flickr.password'); my $api = new Flickr::API({'key' => $flickr_api_key, 'secret' => $flickr_secret}); my $response = $api->execute_method('flickr.auth.getFrob', { api_key => $flickr_api_key } ); my $xpath = new XML::Parser::Lite::Tree::XPath($response->{tree}); my @nodes = $xpath->select_nodes('/frob'); my $frob = $nodes[0]->{children}[0]->{content}; print "Frob: $frob\n";