blib/lib/Net/Blogger/Engine/Movabletype.pm

filter: Statementstmt 36.5% 15 / 41 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 3 / 6 Podpod 100% 3 / 3 totaltotal 33.8% 21 / 62 SCAR 32.2
CC
7
Cov
28%
getRecentPosts
30.0
mt
6.0
metaWeblog
6.0
CRAP 25.1
« blib/lib/Net/Blogger/Engine/Slash/slashcode.pm ↑ Summary blib/lib/Net/Blogger.pm »
1 {
2
3 1 =head1 NAME
4
5 Net::Blogger::Engine::Movabletype - Movabletype Blogger API engine
6
7 =head1 SYNOPSIS
8
9 my $mt = Net::Blogger->new(engine=>"movabletype");
10
11 $mt->Proxy("http://mtserver.com/mt-xmlrpc.cgi");
12 $mt->Username("foo");
13 $mt->Password("bar");
14
15 my $postid_1 = $mt->newPost(postbody=>\"hello world")
16 || croak $mt->LastError();
17
18 my $postid_2 = $mt->metaWeblog()->newPost(
19 title=>"hello",
20 description=>"world",
21 publish=>1,
22 );
23
24 =head1 DESCRIPTION
25
26 This package inherits I<Net::Blogger::Engine::Base> and implements
27 methods specific to a MovableType XML-RPC server.
28
29 =cut
30
31 package Net::Blogger::Engine::Movabletype;
32 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
33
34 1 $Net::Blogger::Engine::Movabletype::VERSION = '1.0';
35 1 @Net::Blogger::Engine::Movabletype::ISA = qw ( Exporter Net::Blogger::Engine::Base );
36 1 @Net::Blogger::Engine::Movabletype::EXPORT = qw ();
37 1 @Net::Blogger::Engine::Movabletype::EXPORT_OK = qw ();
38
39 1 ▶use Exporter;
Subroutine BEGIN: called CC=1 SCAR=0.0
40 1 ▶use Net::Blogger::Engine::Base;
Subroutine BEGIN: called CC=1 SCAR=0.0
41
42 =head1 Blogger API OBJECT METHODS
43
44 =cut
45
46 =head2 $pkg->getRecentPosts(\%args)
47
48 Releases prior to Net::Blogger 0.85 accepted a list of arguments
49 rather than a reference. Version 0.85+ are backwards compatible.
50
51 =cut
52
53 sub getRecentPosts {
54 0 ▶ my $self = shift;
Subroutine getRecentPosts: not called CC=5 SCAR=34.0
Pod documented
55 0 ▶ my $args = (ref($_[0]) eq "HASH") ? shift : {@_};
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] eq 'HASH' ? : 0 0 0
56
57 0 ▶ my $num = (defined $args->{'numposts'}) ? $args->{'numposts'} : 1;
Branch: 1 branch
BranchTrueFalseTotal
defined $args->{'numposts'} ? : 0 0 0
58 0 my $posts = [];
59
60 0 ▶ unless ($num =~ /^(-)*(\d+)$/) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($num =~ /^(-)*(\d+)$/) 0 0 0
61 0 $self->LastError("Argument $args->{'numposts'} isn't numeric.");
62 0 return 0;
63 }
64
65 0 ▶ if ($num > -1) { $num = 0; }
Branch: 1 branch
BranchTrueFalseTotal
if ($num > -1) 0 0 0
66
67 0 return $self->SUPER::getRecentPosts($args);
68 }
69
70 =head1 Movable Type (mt) API OBJECT METHODS
71
72 =cut
73
74 =head2 $pkg->mt()
75
76 Returns an object. Woot!
77
78 =cut
79
80 sub mt {
81 0 ▶ my $self = shift;
Subroutine mt: not called CC=2 SCAR=17.9
Pod documented
82
83 0 ▶ if (! $self->{'__mt'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"__mt"}) 0 0 0
84
85 0 require Net::Blogger::Engine::Movabletype::mt;
86 0 my $mt = Net::Blogger::Engine::Movabletype::mt->new(debug=>$self->{debug});
87
88 0 map { $mt->$_($self->$_()); } qw (BlogId Proxy Username Password);
89 0 $self->{'__mt'} = $mt;
90 }
91
92 0 return $self->{'__mt'};
93 }
94
95 =head1 metaWeblog API OBJECT METHODS
96
97 =cut
98
99 =head2 $pkg->metaWeblog()
100
101 Returns an object. Woot!
102
103 =cut
104
105 sub metaWeblog {
106 0 ▶ my $self = shift;
Subroutine metaWeblog: not called CC=2 SCAR=17.9
Pod documented
107
108 0 ▶ if (! $self->{__meta}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"__meta"}) 0 0 0
109
110 0 require Net::Blogger::Engine::Userland::metaWeblog;
111 0 my $meta = Net::Blogger::Engine::Userland::metaWeblog->new(debug=>$self->{debug});
112
113 0 map { $meta->$_($self->$_()); } qw (BlogId Proxy Username Password);
114 0 $self->{__meta} = $meta;
115 }
116
117 0 return $self->{__meta};
118 }
119
120 =head1 VERSION
121
122 1.0
123
124 =head1 DATE
125
126 $Date: 2005/03/26 19:29:08 $
127
128 =head1 AUTHOR
129
130 Aaron Straup Cope
131
132 =head1 SEE ALSO
133
134 L<Net::Blogger::Engine::Base>
135
136 L<Net::Blogger::Engine::Movabletype::mt>
137
138 L<Net::Blogger::Engine::Userland::metaWeblog>
139
140 http://aaronland.net/weblog/archive/3719
141
142 =head1 LICENSE
143
144 Copyright (c) 2001-2005 Aaron Straup Cope.
145
146 This is free software, you may use it and distribute it under the same terms as Perl itself.
147
148 =cut
149
150 1 return 1;
151
152 }
« blib/lib/Net/Blogger/Engine/Slash/slashcode.pm ↑ Summary blib/lib/Net/Blogger.pm »