| 1 | package WebService::Technorati::LinkQuerySubject; | ||
| 2 | use strict; | ||
| 3 | use utf8; | ||
| 4 | |||
| 5 | use fields qw(blog rankingstart); | ||
| 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 | =head2 getRankingstart | ||
| 45 | |||
| 46 | Usage : getRankingstart(); | ||
| 47 | Purpose : | ||
| 48 | Returns : a scalar string | ||
| 49 | Argument : none | ||
| 50 | Throws : none | ||
| 51 | Comments : | ||
| 52 | See Also : WebService::Technorati | ||
| 53 | |||
| 54 | =cut | ||
| 55 | |||
| 56 | |||
| 57 | =head2 setRankingstart | ||
| 58 | |||
| 59 | Usage : setRankingstart(string); | ||
| 60 | Purpose : | ||
| 61 | Returns : void | ||
| 62 | Argument : a scalar string | ||
| 63 | Throws : none | ||
| 64 | Comments : | ||
| 65 | See Also : WebService::Technorati | ||
| 66 | |||
| 67 | =cut | ||
| 68 | |||
| 69 | |||
| 70 | { | ||
| 71 | my %_attrs = ( | ||
| 72 | blog => undef, | ||
| 73 | inboundlinks => undef, | ||
| 74 | inboundblogs => undef, | ||
| 75 | url => undef, | ||
| 76 | rankingstart => undef | ||
| 77 | ); | ||
| 78 | sub _accessible { | ||
| 79 | if ($DEBUG) { | ||
| 80 | print __PACKAGE__ . ": checking for attr [$_[1]]\n"; | ||
| 81 | } | ||
| 82 | return exists($_attrs{$_[1]}); | ||
| 83 | } | ||
| 84 | } | ||
| 85 | |||
| 86 | sub new_from_node { | ||
| 87 | my $class = shift; | ||
| 88 | my $node = shift; | ||
| 89 | my $blog_node = $node->find('weblog')->pop; | ||
| 90 | my $data = { | ||
| 91 | rankingstart => $node->findvalue('rankingstart')->string_value, | ||
| 92 | inboundlinks => $node->findvalue('inboundlinks')->string_value, | ||
| 93 | inboundblogs => $node->findvalue('inboundblogs')->string_value, | ||
| 94 | url => $node->findvalue('url')->string_value | ||
| 95 | }; | ||
| 96 | if ($blog_node) { | ||
| 97 | $data->{'blog'} = WebService::Technorati::Blog->new_from_node($blog_node); | ||
| 98 | } | ||
| 99 | my $self = bless ($data, ref ($class) || $class); | ||
| 100 | return $self; | ||
| 101 | } | ||
| 102 | |||
| 103 | 1; |