line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MojoMojo::Schema::ResultSet::Person; |
2
|
|
|
|
|
|
|
|
3
|
40
|
|
|
40
|
|
51673
|
use strict; |
|
40
|
|
|
|
|
116
|
|
|
40
|
|
|
|
|
1089
|
|
4
|
40
|
|
|
40
|
|
204
|
use warnings; |
|
40
|
|
|
|
|
92
|
|
|
40
|
|
|
|
|
1250
|
|
5
|
40
|
|
|
40
|
|
220
|
use parent qw/MojoMojo::Schema::Base::ResultSet/; |
|
40
|
|
|
|
|
91
|
|
|
40
|
|
|
|
|
257
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
MojoMojo::Schema::ResultSet::Person - resultset methods on users |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 METHODS |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head2 get_person |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Get a person by login. |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub get_person { |
20
|
1
|
|
|
1
|
1
|
30038
|
my ( $self, $login ) = @_; |
21
|
1
|
|
|
|
|
12
|
return $self->search( { login => $login } )->single; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head2 get_user |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Same as L</get_person>. |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=cut |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub get_user { |
31
|
70
|
|
|
70
|
1
|
45449
|
my ( $self, $user ) = @_; |
32
|
70
|
|
|
|
|
510
|
return $self->search( { login => $user } )->next(); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 user_free |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Check if a username is available. Returns 1 for available, 0 for in use. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub user_free { |
42
|
0
|
|
|
0
|
1
|
|
my ( $class, $schema, $login ) = @_; |
43
|
0
|
|
0
|
|
|
|
$login ||= $class; |
44
|
0
|
|
|
|
|
|
my $user = $class->result_source->resultset->get_user($login); |
45
|
0
|
0
|
|
|
|
|
return ( $user ? 0 : 1 ); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 AUTHOR |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Marcus Ramberg <mramberg@cpan.org> |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 LICENSE |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
This library is free software. You can redistribute it and/or modify |
55
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |