| 1 | package WebService::Technorati::SearchMatch; | ||
| 2 | use strict; | ||
| 3 | use utf8; | ||
| 4 | use fields qw(blog created title excerpt); | ||
| 5 | |||
| 6 | use WebService::Technorati::Blog; | ||
| 7 | |||
| 8 | use WebService::Technorati::BaseTechnoratiObject; | ||
| 9 | use base 'WebService::Technorati::BaseTechnoratiObject'; | ||
| 10 | |||
| 11 | |||
| 12 | BEGIN { | ||
| 13 | use vars qw ($VERSION $DEBUG); | ||
| 14 | $VERSION = 0.04; | ||
| 15 | $DEBUG = 0; | ||
| 16 | } | ||
| 17 | |||
| 18 | =head2 getBlog | ||
| 19 | |||
| 20 | Usage : getBlog(); | ||
| 21 | Purpose : | ||
| 22 | Returns : a scalar WebService::Technorati::Blog | ||
| 23 | Argument : none | ||
| 24 | Throws : none | ||
| 25 | Comments : | ||
| 26 | See Also : WebService::Technorati | ||
| 27 | |||
| 28 | =cut | ||
| 29 | |||
| 30 | |||
| 31 | =head2 setBlog | ||
| 32 | |||
| 33 | Usage : setBlog(blog); | ||
| 34 | Purpose : | ||
| 35 | Returns : void | ||
| 36 | Argument : a scalar WebService::Technorati::Blog | ||
| 37 | Throws : none | ||
| 38 | Comments : | ||
| 39 | See Also : WebService::Technorati | ||
| 40 | |||
| 41 | =cut | ||
| 42 | |||
| 43 | |||
| 44 | |||
| 45 | =head2 getCreated | ||
| 46 | |||
| 47 | Usage : getCreated(); | ||
| 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 setCreated | ||
| 59 | |||
| 60 | Usage : setCreated(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 | =head2 getTitle | ||
| 72 | |||
| 73 | Usage : getTitle(); | ||
| 74 | Purpose : | ||
| 75 | Returns : a scalar string | ||
| 76 | Argument : none | ||
| 77 | Throws : none | ||
| 78 | Comments : | ||
| 79 | See Also : WebService::Technorati | ||
| 80 | |||
| 81 | =cut | ||
| 82 | |||
| 83 | |||
| 84 | =head2 setTitle | ||
| 85 | |||
| 86 | Usage : setTitle(string); | ||
| 87 | Purpose : | ||
| 88 | Returns : void | ||
| 89 | Argument : a scalar string | ||
| 90 | Throws : none | ||
| 91 | Comments : | ||
| 92 | See Also : WebService::Technorati | ||
| 93 | |||
| 94 | =cut | ||
| 95 | |||
| 96 | |||
| 97 | |||
| 98 | =head2 getExcerpt | ||
| 99 | |||
| 100 | Usage : getExcerpt(); | ||
| 101 | Purpose : | ||
| 102 | Returns : a scalar string | ||
| 103 | Argument : none | ||
| 104 | Throws : none | ||
| 105 | Comments : | ||
| 106 | See Also : WebService::Technorati | ||
| 107 | |||
| 108 | =cut | ||
| 109 | |||
| 110 | |||
| 111 | =head2 setExcerpt | ||
| 112 | |||
| 113 | Usage : setExcerpt(string); | ||
| 114 | Purpose : | ||
| 115 | Returns : void | ||
| 116 | Argument : a scalar string | ||
| 117 | Throws : none | ||
| 118 | Comments : | ||
| 119 | See Also : WebService::Technorati | ||
| 120 | |||
| 121 | =cut | ||
| 122 | |||
| 123 | |||
| 124 | |||
| 125 | { | ||
| 126 | my %_attrs = ( | ||
| 127 | blog => undef, | ||
| 128 | created => undef, | ||
| 129 | title => undef, | ||
| 130 | excerpt => undef | ||
| 131 | ); | ||
| 132 | sub _accessible { | ||
| 133 | if ($DEBUG) { | ||
| 134 | print __PACKAGE__ . ": checking for attr [$_[1]]\n"; | ||
| 135 | } | ||
| 136 | return exists($_attrs{$_[1]}); | ||
| 137 | } | ||
| 138 | } | ||
| 139 | |||
| 140 | sub new_from_node { | ||
| 141 | my $class = shift; | ||
| 142 | my $node = shift; | ||
| 143 | my $blog_node = $node->find('weblog')->pop; | ||
| 144 | my $data = { | ||
| 145 | blog => WebService::Technorati::Blog->new_from_node($blog_node), | ||
| 146 | created => $node->findvalue('created')->string_value, | ||
| 147 | excerpt => $node->findvalue('excerpt')->string_value(), | ||
| 148 | title => $node->findvalue('title')->string_value(), | ||
| 149 | }; | ||
| 150 | my $self = bless ($data, ref ($class) || $class); | ||
| 151 | return $self; | ||
| 152 | } | ||
| 153 | |||
| 154 | 1; |