File Coverage

blib/lib/WebService/GData/YouTube/Feed/UserProfile.pm
Criterion Covered Total %
statement 43 44 97.7
branch 2 4 50.0
condition 1 2 50.0
subroutine 15 15 100.0
pod 4 4 100.0
total 65 69 94.2


line stmt bran cond sub pod time code
1             package WebService::GData::YouTube::Feed::UserProfile;
2              
3 1     1   37443 use WebService::GData;
  1         2  
  1         5  
4 1     1   6 use base 'WebService::GData::Feed::Entry';
  1         1  
  1         659  
5 1     1   6 use WebService::GData::Constants qw(:all);
  1         1  
  1         390  
6 1     1   518 use WebService::GData::YouTube::Constants qw(:all);
  1         2  
  1         216  
7              
8 1     1   525 use WebService::GData::YouTube::YT::Statistics ();
  1         2  
  1         15  
9 1     1   483 use WebService::GData::Node::GD::FeedLink ();
  1         3  
  1         23  
10 1     1   8 use WebService::GData::Collection;
  1         2  
  1         7  
11              
12             our $VERSION = 0.01_01;
13              
14             sub __init {
15 1     1   3 my ( $this, $feed, $req ) = @_;
16              
17 1 50       5 if ( ref($feed) eq 'HASH' ) {
18 1         12 $this->SUPER::__init( $feed, $req );
19             }
20             else {
21 0         0 $this->SUPER::__init( {}, $feed );#$feed ==$req here
22             }
23            
24 1         16 $this->{_statistics}= new WebService::GData::YouTube::YT::Statistics($this->{_feed}->{'yt$statistics'});
25             $this->{_feed_links}= new WebService::GData::Collection($this->{_feed}->{'gd$feedLink'}||[],undef,sub {
26 7     7   9 my $elm=shift;
27 7 50       45 $elm= WebService::GData::Node::GD::FeedLink->new($elm) if ref $elm ne 'WebService::GData::Node::GD::FeedLink';
28 7         22 return $elm;
29 1   50     10 });
30 1         4 $this->_entity->child($this->{_statistics})
31             ->child($this->{_feed_links});
32             }
33              
34             sub about_me {
35 1     1 1 3 my $this = shift;
36 1         9 return $this->{_feed}->{'yt$aboutMe'}->{'$t'};
37             }
38             sub first_name {
39 1     1 1 3 my $this = shift;
40 1         7 return $this->{_feed}->{'yt$firstName'}->{'$t'};
41             }
42             sub last_name {
43 1     1 1 4 my $this = shift;
44 1         16 return $this->{_feed}->{'yt$lastName'}->{'$t'};
45             }
46             sub thumbnail {
47 1     1 1 2 my $this = shift;
48 1         6 return $this->{_feed}->{'media$thumbnail'}->{'url'};
49             }
50 1     1   5 no strict 'refs';
  1         2  
  1         125  
51             foreach my $node (qw(age username books gender company hobbies hometown location movies
52             music relationship occupation school)) {
53              
54             *{ __PACKAGE__ . '::' . $node . '' } = sub {
55 5     5   10 my $this = shift;
56 5         37 return $this->{_feed}->{'yt$'.$node}->{'$t'};
57             }
58             }
59              
60              
61              
62              
63             "The earth is blue like an orange.";
64              
65             __END__