line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::Steam; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1100
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
29
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
14
|
use Exporter; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
7
|
1
|
|
|
1
|
|
5
|
use IO::All; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
13
|
|
8
|
1
|
|
|
1
|
|
378
|
use WebService::Steam::Group; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use WebService::Steam::User; |
10
|
|
|
|
|
|
|
use XML::Bare; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $AUTOLOAD; |
13
|
|
|
|
|
|
|
our @EXPORT = qw/steam_group steam_user/; |
14
|
|
|
|
|
|
|
our @ISA = 'Exporter'; |
15
|
|
|
|
|
|
|
our $VERSION = .4; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub flatten { map { my $v = $_[0]{ $_ }; ref $v eq 'HASH' ? flatten( $v ) : ( $_ => $v ) } keys %{ $_[0] } } |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub AUTOLOAD |
20
|
|
|
|
|
|
|
{ |
21
|
|
|
|
|
|
|
$AUTOLOAD =~ s/steam_(\w)/\u$1/; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my @objects = map { |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my $_ < io( $AUTOLOAD->path( $_ ) ); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
/^<\?xml/ ? $AUTOLOAD->new( flatten( XML::Bare->new( text => $_ )->simple ) ) : (); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
} ref $_[0] ? @{ $_[0] } : @_; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
wantarray ? @objects : $objects[0]; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 NAME |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
WebService::Steam - A Perl interface to the |
39
|
|
|
|
|
|
|
L<Steam community data|https://partner.steamgames.com/documentation/community_data> |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 SYNOPSIS |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
use WebService::Steam; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
my $user = steam_user 'jraspass'; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
print $user->name, |
48
|
|
|
|
|
|
|
' joined steam in ', |
49
|
|
|
|
|
|
|
$user->registered, |
50
|
|
|
|
|
|
|
', has a rating of ', |
51
|
|
|
|
|
|
|
$user->rating, |
52
|
|
|
|
|
|
|
', is from ', |
53
|
|
|
|
|
|
|
$user->location, |
54
|
|
|
|
|
|
|
', and belongs to the following ', |
55
|
|
|
|
|
|
|
scalar( $user->groups ), |
56
|
|
|
|
|
|
|
' groups: ', |
57
|
|
|
|
|
|
|
join( ', ', $user->groups ); |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 EXPORTED METHODS |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head2 steam_group |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Returns instance(s) of L<WebService::Steam::Group>, can take any combination of group names and IDs. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
In scalar context returns the first element of the array. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
my $group = steam_group( 'valve' ); |
68
|
|
|
|
|
|
|
my $group = steam_group( 103582791429521412 ); |
69
|
|
|
|
|
|
|
my @groups = steam_group( 'valve', 103582791429521412 ); |
70
|
|
|
|
|
|
|
my @groups = steam_group( [ 'valve', 103582791429521412 ] ); |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 steam_user |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Returns instance(s) of L<WebService::Steam::User>, can take any combination of usernames and IDs. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
In scalar context returns the first element of the array. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
my $user = steam_user( 'jraspass' ); |
79
|
|
|
|
|
|
|
my $user = steam_user( 76561198005755687 ); |
80
|
|
|
|
|
|
|
my @users = steam_user( 'jraspass', 76561198005755687 ); |
81
|
|
|
|
|
|
|
my @users = steam_user( [ 'jraspass', 76561198005755687 ] ); |