line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WWW::SourceForge::User; |
2
|
2
|
|
|
2
|
|
28092
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
89
|
|
3
|
2
|
|
|
2
|
|
1317
|
use WWW::SourceForge; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
use WWW::SourceForge::Project; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.20'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head2 new |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Usage: |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my $user = new WWW::SourceForge::User( id => 1234 ); |
13
|
|
|
|
|
|
|
my $user2 = new WWW::SourceForge::User( username => 'rbowen' ); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Returns: WWW::SourceForge::User object; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub new { |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my ( $class, %parameters ) = @_; |
22
|
|
|
|
|
|
|
my $self = bless( {}, ref($class) || $class ); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my $api = new WWW::SourceForge; |
25
|
|
|
|
|
|
|
my $json; |
26
|
|
|
|
|
|
|
if ( $parameters{id} ) { |
27
|
|
|
|
|
|
|
$json = $api->call( |
28
|
|
|
|
|
|
|
method => 'user', |
29
|
|
|
|
|
|
|
id => $parameters{id} |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
} elsif ( $parameters{username} ) { |
32
|
|
|
|
|
|
|
$json = $api->call( |
33
|
|
|
|
|
|
|
method => 'user', |
34
|
|
|
|
|
|
|
username => $parameters{username} |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
} else { |
37
|
|
|
|
|
|
|
warn('You must provide an id or username. Bad monkey.'); |
38
|
|
|
|
|
|
|
return 0; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
$self->{data} = $json->{User}; |
42
|
|
|
|
|
|
|
return $self; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub email { return shift->sf_email(); } |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 projects |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Returns an array of Project objects |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub projects { |
55
|
|
|
|
|
|
|
my $self = shift; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
return @{ $self->{data}->{_projects} } if $self->{data}->{_projects}; |
58
|
|
|
|
|
|
|
my $p_ref = $self->{data}->{projects}; |
59
|
|
|
|
|
|
|
my @projects; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
foreach my $p ( @$p_ref ) { |
62
|
|
|
|
|
|
|
my $proj = new WWW::SourceForge::Project( id => $p->{id} ); |
63
|
|
|
|
|
|
|
push (@projects, $proj ); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
$self->{data}->{_projects} = \@projects; |
67
|
|
|
|
|
|
|
return @projects; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head2 Data access AUTOLOADER |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Handles most of the data access for the Project object. Some parts of |
73
|
|
|
|
|
|
|
the data require special treatment. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=cut |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub AUTOLOAD { |
78
|
|
|
|
|
|
|
my $self = shift; |
79
|
|
|
|
|
|
|
our $AUTOLOAD; |
80
|
|
|
|
|
|
|
my $sub = $AUTOLOAD; |
81
|
|
|
|
|
|
|
$sub =~ s/^.*:://; |
82
|
|
|
|
|
|
|
( my $method = $sub ) =~ s/.*:://; |
83
|
|
|
|
|
|
|
return $self->{data}->{$sub}; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 NAME |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
WWW::SourceForge::User - SourceForge user objects |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 SYNOPSIS |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Uses the SourceForge API to load user details. This is a work in |
93
|
|
|
|
|
|
|
progress, and the interface will change. Mostly I'm just poking about to |
94
|
|
|
|
|
|
|
see what this needs to support. Please feel free to play along. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
http://sf.net/projects/sfprojecttools/ |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 DESCRIPTION |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Implements a Perl interface to SourceForge users. See http://sourceforge.net/p/forge/documentation/API/ |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 USAGE |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
use WWW::SourceForge::User; |
105
|
|
|
|
|
|
|
my $user = WWW::SourceForge::User->new( username => 'rbowen' ); |
106
|
|
|
|
|
|
|
print $user->timezone; |
107
|
|
|
|
|
|
|
print Dumper( $user->projects ); |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 BUGS |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
None |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 SUPPORT |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
http://sourceforge.net/p/sfprojecttools/tickets/ |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 AUTHOR |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Rich Bowen |
120
|
|
|
|
|
|
|
CPAN ID: RBOW |
121
|
|
|
|
|
|
|
SourceForge |
122
|
|
|
|
|
|
|
rbowen@sourceforge.net |
123
|
|
|
|
|
|
|
http://sf.net |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 COPYRIGHT |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
This program is free software; you can redistribute |
128
|
|
|
|
|
|
|
it and/or modify it under the same terms as Perl itself. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
The full text of the license can be found in the |
131
|
|
|
|
|
|
|
LICENSE file included with this module. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 SEE ALSO |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
perl(1). |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=cut |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
#################### main pod documentation end ################### |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
1; |
143
|
|
|
|
|
|
|
|