| 1 | package WebService::Technorati::BlogLink; | ||
| 2 | use strict; | ||
| 3 | use utf8; | ||
| 4 | |||
| 5 | use fields qw(blog nearestpermalink excerpt linkcreated linkurl); | ||
| 6 | |||
| 7 | use WebService::Technorati::Blog; | ||
| 8 | |||
| 9 | use WebService::Technorati::BaseTechnoratiObject; | ||
| 10 | use base 'WebService::Technorati::BaseTechnoratiObject'; | ||
| 11 | |||
| 12 | |||
| 13 | BEGIN { | ||
| 14 | use vars qw ($VERSION $DEBUG); | ||
| 15 | $VERSION = 0.04; | ||
| 16 | $DEBUG = 0; | ||
| 17 | } | ||
| 18 | |||
| 19 | =head2 getBlog | ||
| 20 | |||
| 21 | Usage : getBlog(); | ||
| 22 | Purpose : | ||
| 23 | Returns : a scalar WebService::Technorati::Blog | ||
| 24 | Argument : none | ||
| 25 | Throws : none | ||
| 26 | Comments : | ||
| 27 | See Also : WebService::Technorati | ||
| 28 | |||
| 29 | =cut | ||
| 30 | |||
| 31 | |||
| 32 | =head2 setBlog | ||
| 33 | |||
| 34 | Usage : setBlog(blog); | ||
| 35 | Purpose : | ||
| 36 | Returns : void | ||
| 37 | Argument : a scalar WebService::Technorati::Blog | ||
| 38 | Throws : none | ||
| 39 | Comments : | ||
| 40 | See Also : WebService::Technorati | ||
| 41 | |||
| 42 | =cut | ||
| 43 | |||
| 44 | |||
| 45 | =head2 getNearestpermalink | ||
| 46 | |||
| 47 | Usage : getNearestpermalink(); | ||
| 48 | Purpose : | ||
| 49 | Returns : a scalar string | ||
| 50 | Argument : none | ||
| 51 | Throws : none | ||
| 52 | Comments : | ||
| 53 | See Also : WebService::Technorati | ||
| 54 | |||
| 55 | =cut | ||
| 56 | |||
| 57 | |||
| 58 | =head2 setNearestpermalink | ||
| 59 | |||
| 60 | Usage : setNearestpermalink(string); | ||
| 61 | Purpose : | ||
| 62 | Returns : void | ||
| 63 | Argument : a scalar string | ||
| 64 | Throws : none | ||
| 65 | Comments : | ||
| 66 | See Also : WebService::Technorati | ||
| 67 | |||
| 68 | =cut | ||
| 69 | |||
| 70 | |||
| 71 | |||
| 72 | =head2 getExcerpt | ||
| 73 | |||
| 74 | Usage : getExcerpt(); | ||
| 75 | Purpose : | ||
| 76 | Returns : a scalar string | ||
| 77 | Argument : none | ||
| 78 | Throws : none | ||
| 79 | Comments : | ||
| 80 | See Also : WebService::Technorati | ||
| 81 | |||
| 82 | =cut | ||
| 83 | |||
| 84 | |||
| 85 | =head2 setExcerpt | ||
| 86 | |||
| 87 | Usage : setExcerpt(string); | ||
| 88 | Purpose : | ||
| 89 | Returns : void | ||
| 90 | Argument : a scalar string | ||
| 91 | Throws : none | ||
| 92 | Comments : | ||
| 93 | See Also : WebService::Technorati | ||
| 94 | |||
| 95 | =cut | ||
| 96 | |||
| 97 | |||
| 98 | |||
| 99 | =head2 getLinkcreated | ||
| 100 | |||
| 101 | Usage : getLinkcreated(); | ||
| 102 | Purpose : | ||
| 103 | Returns : a scalar string | ||
| 104 | Argument : none | ||
| 105 | Throws : none | ||
| 106 | Comments : | ||
| 107 | See Also : WebService::Technorati | ||
| 108 | |||
| 109 | =cut | ||
| 110 | |||
| 111 | |||
| 112 | =head2 setLinkcreated | ||
| 113 | |||
| 114 | Usage : setLinkcreated(string); | ||
| 115 | Purpose : | ||
| 116 | Returns : void | ||
| 117 | Argument : a scalar string | ||
| 118 | Throws : none | ||
| 119 | Comments : | ||
| 120 | See Also : WebService::Technorati | ||
| 121 | |||
| 122 | =cut | ||
| 123 | |||
| 124 | |||
| 125 | =head2 getLinkurl | ||
| 126 | |||
| 127 | Usage : getLinkurl(); | ||
| 128 | Purpose : | ||
| 129 | Returns : a scalar string | ||
| 130 | Argument : none | ||
| 131 | Throws : none | ||
| 132 | Comments : | ||
| 133 | See Also : WebService::Technorati | ||
| 134 | |||
| 135 | =cut | ||
| 136 | |||
| 137 | |||
| 138 | =head2 setLinkurl | ||
| 139 | |||
| 140 | Usage : setLinkurl(string); | ||
| 141 | Purpose : | ||
| 142 | Returns : void | ||
| 143 | Argument : a scalar string | ||
| 144 | Throws : none | ||
| 145 | Comments : | ||
| 146 | See Also : WebService::Technorati | ||
| 147 | |||
| 148 | =cut | ||
| 149 | |||
| 150 | |||
| 151 | |||
| 152 | |||
| 153 | { | ||
| 154 | my %_attrs = ( | ||
| 155 | blog => undef, | ||
| 156 | nearestpermalink => undef, | ||
| 157 | excerpt => undef, | ||
| 158 | linkcreated => undef, | ||
| 159 | linkurl => undef | ||
| 160 | ); | ||
| 161 | sub _accessible { | ||
| 162 | if ($DEBUG) { | ||
| 163 | print __PACKAGE__ . ": checking for attr [$_[1]]\n"; | ||
| 164 | } | ||
| 165 | return exists($_attrs{$_[1]}); | ||
| 166 | } | ||
| 167 | } | ||
| 168 | |||
| 169 | sub new_from_node { | ||
| 170 | my $class = shift; | ||
| 171 | my $node = shift; | ||
| 172 | my $blog_node = $node->find('weblog')->pop; | ||
| 173 | my $data = { | ||
| 174 | blog => WebService::Technorati::Blog->new_from_node($blog_node), | ||
| 175 | nearestpermalink => $node->findvalue('nearestpermalink')->string_value, | ||
| 176 | excerpt => $node->findvalue('excerpt')->string_value(), | ||
| 177 | linkcreated => $node->findvalue('linkcreated')->string_value(), | ||
| 178 | linkurl => $node->findvalue('linkurl')->string_value() | ||
| 179 | }; | ||
| 180 | my $self = bless ($data, ref ($class) || $class); | ||
| 181 | return $self; | ||
| 182 | } | ||
| 183 | |||
| 184 | 1; |