題名通りなんだけど、こんな感じでしょうか。 拙作WebService::Simpleの模範的な使い方。
use strict; use warnings; use URI; use WebService::Simple; my $permalink = shift || "http://33rpm.tumblr.com/post/211527548"; my $uri = URI->new($permalink); my $id = $uri->as_string =~ m!post/(\d+)! ? $1 : die "can't detect post id!"; my $base_url = $uri->scheme . "://" . $uri->host; my $service = WebService::Simple->new( base_url => $base_url ); my $res = $service->get( 'api/read', { id => $id } ); my $ref = $res->parse_response(); die "this post does not have photos!" unless defined $ref->{posts}->{post}->{'photo-url'}; for my $photo_url ( @{ $ref->{posts}->{post}->{'photo-url'} } ) { print "$photo_url->{content}\n"; }