Skip Menu |
 

This queue is for tickets about the Net-Blogger CPAN distribution.

Report information
The Basics
Id: 2616
Status: resolved
Priority: 0/
Queue: Net-Blogger

People
Owner: Nobody in particular
Requestors: morbus [...] disobey.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: Undocumented postid in Engine::Userland::metaWeblog.pm
According to the Net::Blogger::Engine::Userland::metaWeblog POD docs (which ::MT uses), an editPost can be passed 'title', 'link', 'description', 'categories' and 'publish'. As such, I erroneously expected this code to work: my $id = $mt->metaWeblog()->newPost( title => "$item->{title}", description => "$item->{description}", publish => 1) or die "[err] ", $mt->LastError(), "\n"; # "edit" the post with no changes so # that our category change activates. $mt->metaWeblog()->editPost( title => "$item->{title}", description => "$item->{description}", publish => 1) since they're sharing the same $mt object. That's not the case - there's an undocumented 'postid' for editPost (see your metaWeblog.pm source). The minute I pass that in, with a publish => 1, MT properly rebuilds the entry. The following does what I want (which is to create a new entry, rebuild, assign a category, rebuild): # it is! yes! now, post to the blog. print "Publishing item '$item->{title}'.\n"; my $id = $mt->metaWeblog()->newPost( title => "$item->{title}", description => "$item->{description}", publish => 1) or die "[err] ", $mt->LastError(), "\n"; # set the category? if ($opts{catid}) { $mt->mt()->setPostCategories( postid => $id, categories => [ {categoryId => $opts{catid}}]) or die "[err] ", $mt->LastError(), "\n"; # "edit" the post with no changes so # that our category change activates. $mt->metaWeblog()->editPost( title => "$item->{title}", description => "$item->{description}", postid => $id, publish => 1) }
Download (untitled) / with headers
text/plain 2.2k
This has been fixed in version 0.86 [guest - Wed May 21 00:21:54 2003]: Show quoted text
> According to the Net::Blogger::Engine::Userland::metaWeblog POD docs > (which ::MT uses), an editPost can be passed 'title', 'link', > 'description', 'categories' and 'publish'. As such, I erroneously > expected this code to work: > > my $id = $mt->metaWeblog()->newPost( > title => "$item->{title}", > description => "$item->{description}", > publish => 1) > or die "[err] ", $mt->LastError(), "\n"; > > # "edit" the post with no changes so > # that our category change activates. > $mt->metaWeblog()->editPost( > title => "$item->{title}", > description => "$item->{description}", > publish => 1) > > since they're sharing the same $mt object. That's not the case - > there's an undocumented 'postid' for editPost (see your > metaWeblog.pm source). The minute I pass that in, with a publish => > 1, MT properly rebuilds the entry. The following does what I want > (which is to create a new entry, rebuild, assign a category, > rebuild): > > # it is! yes! now, post to the blog. > print "Publishing item '$item->{title}'.\n"; > my $id = $mt->metaWeblog()->newPost( > title => "$item->{title}", > description => "$item->{description}", > publish => 1) > or die "[err] ", $mt->LastError(), "\n"; > > # set the category? > if ($opts{catid}) { > $mt->mt()->setPostCategories( > postid => $id, > categories => [ {categoryId => $opts{catid}}]) > or die "[err] ", $mt->LastError(), "\n"; > > # "edit" the post with no changes so > # that our category change activates. > $mt->metaWeblog()->editPost( > title => "$item->{title}", > description => "$item->{description}", > postid => $id, > publish => 1) > }


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.