line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
24
|
use 5.20.0; |
|
2
|
|
|
|
|
6
|
|
2
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
33
|
|
3
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
147
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package DBIx::Class::Smooth::Helper::Util; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# ABSTRACT: Short intro |
8
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY |
9
|
|
|
|
|
|
|
our $VERSION = '0.0102'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
2
|
|
|
|
|
27
|
use Sub::Exporter::Progressive -setup => { |
13
|
|
|
|
|
|
|
exports => [ |
14
|
|
|
|
|
|
|
qw( |
15
|
|
|
|
|
|
|
result_source_to_relation_name |
16
|
|
|
|
|
|
|
result_source_to_class |
17
|
|
|
|
|
|
|
clean_source_name |
18
|
|
|
|
|
|
|
), |
19
|
|
|
|
|
|
|
], |
20
|
2
|
|
|
2
|
|
13
|
}; |
|
2
|
|
|
|
|
4
|
|
21
|
2
|
|
|
2
|
|
284
|
use experimental qw/signatures/; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
10
|
|
22
|
|
|
|
|
|
|
|
23
|
22
|
|
|
22
|
0
|
33
|
sub result_source_to_relation_name($result_source_name, $plural = 0) { |
|
22
|
|
|
|
|
27
|
|
|
22
|
|
|
|
|
31
|
|
|
22
|
|
|
|
|
27
|
|
24
|
22
|
|
|
|
|
30
|
my $relation_name = clean_source_name($result_source_name); |
25
|
|
|
|
|
|
|
|
26
|
22
|
|
|
|
|
39
|
$relation_name =~ s{::}{_}g; |
27
|
22
|
|
|
|
|
49
|
my @parts = split /\|/, $relation_name, 2; |
28
|
22
|
|
|
|
|
31
|
$relation_name = $parts[-1]; |
29
|
22
|
|
|
|
|
45
|
$relation_name = String::CamelCase::decamelize($relation_name); |
30
|
|
|
|
|
|
|
|
31
|
22
|
100
|
66
|
|
|
535
|
return $relation_name.($plural && substr ($relation_name, -1, 1) ne 's' ? 's' : ''); |
32
|
|
|
|
|
|
|
} |
33
|
10
|
|
|
10
|
0
|
16
|
sub result_source_to_class($calling_class, $other_result_source) { |
|
10
|
|
|
|
|
13
|
|
|
10
|
|
|
|
|
12
|
|
|
10
|
|
|
|
|
13
|
|
34
|
10
|
|
|
|
|
17
|
$other_result_source =~ s{\|}{}; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# Make it possible to use fully qualified result sources, with a leading hât ("^Fully::Qualified::Result::Source"). |
37
|
10
|
50
|
|
|
|
38
|
return substr($other_result_source, 1) if substr($other_result_source, 0, 1) eq '^'; |
38
|
10
|
|
|
|
|
20
|
return base_namespace($calling_class) . clean_source_name($other_result_source); |
39
|
|
|
|
|
|
|
} |
40
|
10
|
|
|
10
|
0
|
13
|
sub base_namespace($class) { |
|
10
|
|
|
|
|
15
|
|
|
10
|
|
|
|
|
13
|
|
41
|
10
|
|
|
|
|
43
|
$class =~ m{^(.*?::Result::)}; |
42
|
10
|
|
|
|
|
33
|
return $1; |
43
|
|
|
|
|
|
|
} |
44
|
32
|
|
|
32
|
0
|
37
|
sub clean_source_name($source_name) { |
|
32
|
|
|
|
|
35
|
|
|
32
|
|
|
|
|
60
|
|
45
|
32
|
|
|
|
|
71
|
$source_name =~ s{^.*?::Result::}{}; |
46
|
32
|
|
|
|
|
67
|
return $source_name; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
__END__ |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=pod |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=encoding UTF-8 |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 NAME |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
DBIx::Class::Smooth::Helper::Util - Short intro |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 VERSION |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Version 0.0102, released 2019-12-22. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 SOURCE |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
L<https://github.com/Csson/p5-DBIx-Class-Smooth> |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 HOMEPAGE |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
L<https://metacpan.org/release/DBIx-Class-Smooth> |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 AUTHOR |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Erik Carlsson <info@code301.com> |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
This software is copyright (c) 2018 by Erik Carlsson. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
82
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |