use WWW::wordpress;
use Data::Dumper;

$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;
					
my $wordpress = WWW::wordpress->new( blog => 'blog.wordpress.com',
					blog_id => '000',
					access_token => 'XXX');					
		


# site info 
$site_info = $wordpress->site_info;
$post_count = $site_info->{post_count};
$subscribers_count = $site_info->{subscribers_count};
print "post_count $post_count \n";
print "subscribers_count $subscribers_count \n";

sleep 10;

# post 
$content = "this is my test body ";
$title = "New Raspberry Pi Model B+";
$tags = "linux";
my $post_data = { content => $content,title => $title,tags => $tags };
$post_info = $wordpress->post(post_data => $post_data );
$id = $post_info->{id};
$URL = $post_info->{URL};
print "id $id URL $URL  \n";

# edit post 
$new_content = "The Raspberry Pi foundation has just announced the Raspberry Pi B+. The basic specs haven't changed much";
$post_id = 19;
my $post_data = { content => $new_content};
$status = $wordpress->edit_post(post_data => $post_data, post_id => $post_id);
print "status $status \n";


#follow
my $post_data = { pretty => 1};
$status = $wordpress->follow(blog => 'blog2.wordpress.com',post_data => $post_data);  
print "status $status \n";
sleep 4;

#unfollow
my $post_data = { pretty => 1};
$status = $wordpress->unfollow(blog => 'blog2.wordpress.com',post_data => $post_data);  
print "status $status \n";


