| 1 | { | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | =head1 NAME | |||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | Net::Blogger::Engine::Userland::metaWeblog - UserLand metaWeblog API engine | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | my $radio = Blogger->new(engine=>"radio"); | ||||||||||||||||||||||||||||
| 10 | $radio->Proxy(PROXY); | ||||||||||||||||||||||||||||
| 11 | $radio->Username(USERNAME); | ||||||||||||||||||||||||||||
| 12 | $radio->Password(PASSWORD); | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | $radio->metaWeblog()->newPost( | ||||||||||||||||||||||||||||
| 15 | title=>"hello", | ||||||||||||||||||||||||||||
| 16 | description=>"world", | ||||||||||||||||||||||||||||
| 17 | publish=>1, | ||||||||||||||||||||||||||||
| 18 | ); | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | Implements the UserLand metaWeblog API functionality. | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | This package is meant to be subclassed. It should not be used on it's own. | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | =cut | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | package Net::Blogger::Engine::Userland::metaWeblog; | ||||||||||||||||||||||||||||
| 29 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 1 | $Net::Blogger::Engine::Userland::metaWeblog::VERSION = '1.0'; | |||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 1 | @Net::Blogger::Engine::Userland::metaWeblog::ISA = qw ( Exporter Net::Blogger::Engine::Base ); | |||||||||||||||||||||||||||
| 34 | 1 | @Net::Blogger::Engine::Userland::metaWeblog::EXPORT = qw (); | |||||||||||||||||||||||||||
| 35 | 1 | @Net::Blogger::Engine::Userland::metaWeblog::EXPORT_OK = qw (); | |||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 1 | ▶ | use Exporter; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 38 | 1 | ▶ | use Net::Blogger::Engine::Base; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | =head1 OBJECTS METHODS | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | =head2 $pkg->newPost(\%args) | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | Valid arguments are : | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | =over 4 | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | =item * | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | B<title> | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | String. | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | =item * | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | B<link> | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | =item * | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | B<description> | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | String. | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | =item * | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | B<categories> | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | Array reference. | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | =item * | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | B<publish> | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | Boolean. | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | =back | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | Releases prior to Net::Blogger 0.85 accepted a list of arguments | ||||||||||||||||||||||||||||
| 79 | rather than a reference. Version 0.85+ are backwards compatible. | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | Returns an int, or false. | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | =head2 $pkg->getRecentPosts(\%args) | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | Returns the most recent posts | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | Valid arguments are: | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | =over | ||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | =item numberOfPosts | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | The maximum number of posts to return | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | =back | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | =cut | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | sub getRecentPosts { | ||||||||||||||||||||||||||||
| 100 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
getRecentPosts: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 101 | 0 | ▶ | my $args = (ref($_[0]) eq "HASH") ? shift : {@_}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 102 | my $call = $self->_Client()->call( | ||||||||||||||||||||||||||||
| 103 | "metaWeblog.getRecentPosts", | ||||||||||||||||||||||||||||
| 104 | $self->_Type(string=>$self->BlogId()), | ||||||||||||||||||||||||||||
| 105 | $self->_Type(string=>$self->Username()), | ||||||||||||||||||||||||||||
| 106 | $self->_Type(string=>$self->Password()), | ||||||||||||||||||||||||||||
| 107 | 0 | $self->_Type(int=>$args->{'numberOfPosts'}), | |||||||||||||||||||||||||||
| 108 | ); | ||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | 0 | ▶ | my @posts = ($call) ? (1,@{$call->result()}) : (0,undef); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 111 | 0 | return @posts; | |||||||||||||||||||||||||||
| 112 | }; | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | sub newPost { | ||||||||||||||||||||||||||||
| 115 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
newPost: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||
| 116 | 0 | ▶ | my $args = (ref($_[0]) eq "HASH") ? shift : {@_}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | 0 | my $publish = 0; | |||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | 0 | ▶ | if (exists $args->{publish}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 121 | 0 | $publish = $args->{publish}; | |||||||||||||||||||||||||||
| 122 | 0 | delete $args->{publish}; | |||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | 0 | ▶ | if (($args->{categories}) && (ref($args->{categories}) ne "ARRAY")) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$args->{"categories"} and ref $args->{"categories"} ne "ARRAY"
MC/DC0%0/2
$args->{"categories"} and ref $args->{"categories"} ne "ARRAY"
$args->{"categories"}
ref $args->{"categories"} ne "ARRAY"
Truth table0%0/3
A and B
A= $args->{"categories"}B= ref $args->{"categories"} ne "ARRAY"
| |||||||||||||||||||||||||||||
| 126 | 0 | $self->LastError("Categories must be passed as an array reference."); | |||||||||||||||||||||||||||
| 127 | 0 | return 0; | |||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | 0 | my $call = $self->_Client->call( | |||||||||||||||||||||||||||
| 131 | "metaWeblog.newPost", | ||||||||||||||||||||||||||||
| 132 | $self->_Type(string=>$self->BlogId()), | ||||||||||||||||||||||||||||
| 133 | $self->_Type(string=>$self->Username()), | ||||||||||||||||||||||||||||
| 134 | $self->_Type(string=>$self->Password()), | ||||||||||||||||||||||||||||
| 135 | $self->_Type(hash=>$args), | ||||||||||||||||||||||||||||
| 136 | $self->_Type(boolean=>$publish), | ||||||||||||||||||||||||||||
| 137 | ); | ||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | 0 | ▶ | return ($call) ? $call->result() : return 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | =head2 $pkg->newMediaObject(\%args) | ||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | Valid argument are : | ||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | =over | ||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | =item * | ||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | B<file> | ||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | String. Path to the file you're trying to upload. | ||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||
| 154 | If this argument is present the package will try to load I<MIME::Base64> | ||||||||||||||||||||||||||||
| 155 | for automagic encoding. | ||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||
| 157 | =item * | ||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | B<name> | ||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | String. "It may be used to determine the name of the file that stores the object, | ||||||||||||||||||||||||||||
| 162 | or to display it in a list of objects. It determines how the weblog refers to | ||||||||||||||||||||||||||||
| 163 | the object. If the name is the same as an existing object stored in the weblog, | ||||||||||||||||||||||||||||
| 164 | it replaces the existing object." [1] | ||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | If a I<file> argument is present and no I<name> argument is defined, this property | ||||||||||||||||||||||||||||
| 167 | will be defined using the I<File::Basename::basename> function. | ||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | =item * | ||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||
| 171 | B<type> | ||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||
| 173 | String. "It indicates the type of the object, it's a standard MIME type, | ||||||||||||||||||||||||||||
| 174 | like audio/mpeg or image/jpeg or video/quicktime." [1] | ||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | If a I<file> argument is present and no I<type> argument is defined, the package | ||||||||||||||||||||||||||||
| 177 | will try setting this property using the I<File::MMagic> package. | ||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||
| 179 | =item * | ||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||
| 181 | B<bits> | ||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||
| 183 | Base64-encoded binary value. The content of the object. | ||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||
| 185 | If a I<file> argument is present, the package will try setting this property | ||||||||||||||||||||||||||||
| 186 | using the I<MIME::Base64> package. | ||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | =back | ||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||
| 190 | Releases prior to Net::Blogger 0.85 accepted a list of arguments | ||||||||||||||||||||||||||||
| 191 | rather than a reference. Version 0.85+ are backwards compatible. | ||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||
| 193 | Returns a hash reference, or undef. | ||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||
| 195 | =cut | ||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||
| 197 | sub newMediaObject { | ||||||||||||||||||||||||||||
| 198 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
newMediaObject: not called CC=14 SCAR=53.5
Pod
documented
| |||||||||||||||||||||||||||||
| 199 | 0 | ▶ | my $args = (ref($_[0]) eq "HASH") ? shift : {@_}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||
| 201 | # | ||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||
| 203 | 0 | ▶ | if ($args->{file}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||
| 205 | 0 | my $pkg = "MIME::Base64"; | |||||||||||||||||||||||||||
| 206 | 0 | eval "require $pkg"; | |||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||
| 208 | 0 | ▶ | if ($@) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 209 | 0 | $self->LastError("Failed to load $pkg for automagic encoding, $@"); | |||||||||||||||||||||||||||
| 210 | 0 | return undef; | |||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||
| 213 | open(FILE, $args->{file}) or &{ | ||||||||||||||||||||||||||||
| 214 | 0 | ▶ | $self->LastError("Failed to open $args->{file} for reading, $!"); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 215 | 0 | return undef; | |||||||||||||||||||||||||||
| 216 | }; | ||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||
| 218 | 0 | my $buf = undef; | |||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||
| 220 | 0 | ▶ | while (read(FILE, $buf, 60*57)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 221 | 0 | $args->{bits} .= &{$pkg."::encode_base64"}($buf); | |||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||
| 224 | 0 | close FILE; | |||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||
| 226 | # | ||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | 0 | ▶ | if (! $args->{type}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 229 | 0 | eval "require $pkg"; | |||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||
| 231 | 0 | ▶ | if ($@) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 232 | 0 | $self->LastError("Failed to load $pkg for automagic type checking $@"); | |||||||||||||||||||||||||||
| 233 | 0 | return undef; | |||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||
| 236 | # | ||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||
| 238 | 0 | my $mm = undef; | |||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||
| 240 | 0 | eval { $mm = $pkg->new(); }; | |||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||
| 242 | 0 | ▶ | if ($@) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 243 | 0 | $self->LastError("Failed to instantiate $pkg for automagic type checking, $@"); | |||||||||||||||||||||||||||
| 244 | 0 | return undef; | |||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||
| 247 | 0 | $args->{type} = $mm->checktype_filename($args->{file}); | |||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||
| 249 | 0 | ▶ | if (! $args->{type}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 250 | 0 | $self->LastError("Unable to determine file type "); | |||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||
| 254 | # | ||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | 0 | ▶ | if (! $args->{name}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 257 | 0 | require "File::Basename"; | |||||||||||||||||||||||||||
| 258 | 0 | $args->{name} = File::Basename::basename($args->{file}); | |||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | # | ||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||
| 264 | else { | ||||||||||||||||||||||||||||
| 265 | 0 | foreach ("name","type","bin") { | |||||||||||||||||||||||||||
| 266 | 0 | ▶ | if (! $args->{$_}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 267 | 0 | $self->LastError("You must define a value for the $_ property."); | |||||||||||||||||||||||||||
| 268 | 0 | return undef; | |||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||
| 273 | # | ||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||
| 275 | 0 | my $call = $self->_Client->call( | |||||||||||||||||||||||||||
| 276 | "metaWeblog.newMediaObject", | ||||||||||||||||||||||||||||
| 277 | $self->_Type(string=>$self->BlogId()), | ||||||||||||||||||||||||||||
| 278 | $self->_Type(string=>$self->Username()), | ||||||||||||||||||||||||||||
| 279 | $self->_Type(string=>$self->Password()), | ||||||||||||||||||||||||||||
| 280 | $self->_Type(hash=>$args), | ||||||||||||||||||||||||||||
| 281 | ); | ||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||
| 283 | 0 | ▶ | return ($call) ? $call->result() : undef; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||
| 286 | =head2 $pkg->editPost(\%args) | ||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||
| 288 | =over 4 | ||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||
| 290 | =item * | ||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||
| 292 | B<postid> | ||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||
| 294 | Int. I<required> | ||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||
| 296 | =item * | ||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||
| 298 | B<title> | ||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||
| 300 | String. | ||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||
| 302 | =item * | ||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||
| 304 | B<link> | ||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||
| 306 | =item * | ||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||
| 308 | B<description> | ||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||
| 310 | String. | ||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||
| 312 | =item * | ||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||
| 314 | B<categories> | ||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||
| 316 | Array reference. | ||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||
| 318 | =item * | ||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||
| 320 | B<publish> | ||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||
| 322 | Boolean. | ||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||
| 324 | =back | ||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||
| 326 | Releases prior to Net::Blogger 0.85 accepted a list of arguments | ||||||||||||||||||||||||||||
| 327 | rather than a reference. Version 0.85+ are backwards compatible. | ||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||
| 329 | Returns true or false. | ||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||
| 331 | =cut | ||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||
| 333 | sub editPost { | ||||||||||||||||||||||||||||
| 334 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
editPost: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||
| 335 | 0 | ▶ | my $args = (ref($_[0]) eq "HASH") ? shift : {@_}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||
| 337 | 0 | my $postid = $args->{postid}; | |||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||
| 339 | 0 | ▶ | if (! $postid) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 340 | 0 | $self->LastError("You must specify a postid"); | |||||||||||||||||||||||||||
| 341 | 0 | return 0; | |||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||
| 344 | 0 | delete $args->{postid}; | |||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||
| 346 | 0 | ▶ | if (($args->{categories}) && (ref($args->{categories}) ne "ARRAY")) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$args->{"categories"} and ref $args->{"categories"} ne "ARRAY"
MC/DC0%0/2
$args->{"categories"} and ref $args->{"categories"} ne "ARRAY"
$args->{"categories"}
ref $args->{"categories"} ne "ARRAY"
Truth table0%0/3
A and B
A= $args->{"categories"}B= ref $args->{"categories"} ne "ARRAY"
| |||||||||||||||||||||||||||||
| 347 | 0 | $self->LastError("Categories must be passed as an array reference."); | |||||||||||||||||||||||||||
| 348 | 0 | return 0; | |||||||||||||||||||||||||||
| 349 | } | ||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||
| 351 | 0 | my $publish = 0; | |||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||
| 353 | 0 | ▶ | if (exists $args->{publish}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 354 | 0 | $publish = $args->{publish}; | |||||||||||||||||||||||||||
| 355 | 0 | delete $args->{publish}; | |||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||
| 358 | 0 | my $call = $self->_Client->call( | |||||||||||||||||||||||||||
| 359 | "metaWeblog.editPost", | ||||||||||||||||||||||||||||
| 360 | $postid, | ||||||||||||||||||||||||||||
| 361 | $self->_Type(string=>$self->Username()), | ||||||||||||||||||||||||||||
| 362 | $self->_Type(string=>$self->Password()), | ||||||||||||||||||||||||||||
| 363 | $self->_Type(hash=>$args), | ||||||||||||||||||||||||||||
| 364 | $self->_Type(boolean=>$publish), | ||||||||||||||||||||||||||||
| 365 | ); | ||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||
| 367 | 0 | ▶ | return ($call) ? $call->result() : undef; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 368 | } | ||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||
| 370 | =head2 $pkg->getPost(\%args) | ||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||
| 372 | Valid arguments are : | ||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||
| 374 | =over 4 | ||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||
| 376 | =item * | ||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||
| 378 | B<postid> | ||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||
| 380 | Int. I<required> | ||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||
| 382 | =back | ||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||
| 384 | Releases prior to Net::Blogger 0.85 accepted a list of arguments | ||||||||||||||||||||||||||||
| 385 | rather than a reference. Version 0.85+ are backwards compatible. | ||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||
| 387 | Returns a hash reference or undef. | ||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||
| 389 | =cut | ||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||
| 391 | sub getPost { | ||||||||||||||||||||||||||||
| 392 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
getPost: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 393 | 0 | ▶ | my $args = (ref($_[0]) eq "HASH") ? shift : {@_}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||
| 395 | 0 | my $postid = $args->{postid}; | |||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||
| 397 | 0 | ▶ | if (! $postid) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 398 | 0 | $self->LastError("You must specify a postid"); | |||||||||||||||||||||||||||
| 399 | 0 | return 0; | |||||||||||||||||||||||||||
| 400 | } | ||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||
| 402 | 0 | my $call = $self->_Client->call( | |||||||||||||||||||||||||||
| 403 | "metaWeblog.getPost", | ||||||||||||||||||||||||||||
| 404 | $postid, | ||||||||||||||||||||||||||||
| 405 | $self->_Type(string=>$self->Username()), | ||||||||||||||||||||||||||||
| 406 | $self->_Type(string=>$self->Password()), | ||||||||||||||||||||||||||||
| 407 | ); | ||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||
| 409 | 0 | ▶ | return ($call) ? $call->result() : undef; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 410 | } | ||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||
| 412 | =head2 $pkg->getCategories() | ||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||
| 414 | Returns an array reference or undef. | ||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||
| 416 | =cut | ||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||
| 418 | sub getCategories { | ||||||||||||||||||||||||||||
| 419 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
getCategories: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||
| 421 | 0 | ▶ | if ($self->{'__parent'} eq "Movabletype") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 422 | 0 | $self->LastError("This method is not supported by the $self->{'__parent'} engine."); | |||||||||||||||||||||||||||
| 423 | 0 | return undef; | |||||||||||||||||||||||||||
| 424 | } | ||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||
| 426 | 0 | my $call = $self->_Client()->call( | |||||||||||||||||||||||||||
| 427 | "metaWeblog.getCategories", | ||||||||||||||||||||||||||||
| 428 | $self->_Type(string=>$self->BlogId()), | ||||||||||||||||||||||||||||
| 429 | $self->_Type(string=>$self->Username()), | ||||||||||||||||||||||||||||
| 430 | $self->_Type(string=>$self->Password()), | ||||||||||||||||||||||||||||
| 431 | ); | ||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||
| 433 | 0 | ▶ | return ($call) ? $call->result() : undef; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 434 | } | ||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||
| 436 | =head1 VERSION | ||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||
| 438 | 1.0 | ||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||
| 440 | =head1 DATE | ||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||
| 442 | $Date: 2005/03/26 19:29:08 $ | ||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||
| 444 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||
| 446 | Aaron Straup Cope | ||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||
| 448 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||
| 450 | http://www.xmlrpc.com/metaWeblogApi | ||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||
| 452 | http://groups.yahoo.com/group/weblog-devel/message/200 | ||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||
| 454 | =head1 FOOTNOTES | ||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||
| 456 | =over | ||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||
| 458 | =item [1] | ||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||
| 460 | http://www.xmlrpc.com/discuss/msgReader$2393 | ||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||
| 462 | =back | ||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||
| 464 | =head1 LICENSE | ||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||
| 466 | Copyright (c) 2002-2005 Aaron Straup Cope. All Rights Reserved. | ||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||
| 468 | This is free software, you may use it and distribute it under the | ||||||||||||||||||||||||||||
| 469 | same terms as Perl itself. | ||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||
| 471 | =cut | ||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||
| 473 | 1 | return 1; | |||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||
| 475 | } | ||||||||||||||||||||||||||||