line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBIx::Class::Candy::Exports; |
2
|
|
|
|
|
|
|
$DBIx::Class::Candy::Exports::VERSION = '0.005002'; |
3
|
|
|
|
|
|
|
# ABSTRACT: Create sugar for your favorite ORM, DBIx::Class |
4
|
|
|
|
|
|
|
|
5
|
5
|
|
|
5
|
|
17
|
use strict; |
|
5
|
|
|
|
|
6
|
|
|
5
|
|
|
|
|
118
|
|
6
|
5
|
|
|
5
|
|
17
|
use warnings; |
|
5
|
|
|
|
|
21
|
|
|
5
|
|
|
|
|
481
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our %methods; |
9
|
|
|
|
|
|
|
our %aliases; |
10
|
|
|
|
|
|
|
|
11
|
0
|
|
|
0
|
1
|
|
sub export_methods { $methods{scalar caller(0)} = $_[0] } |
12
|
0
|
|
|
0
|
1
|
|
sub export_method_aliases { $aliases{scalar caller(0)} = $_[0] } |
13
|
|
|
|
|
|
|
|
14
|
5
|
|
|
|
|
44
|
use Sub::Exporter -setup => { |
15
|
|
|
|
|
|
|
exports => [ qw(export_methods export_method_aliases) ], |
16
|
|
|
|
|
|
|
groups => { default => [ qw(export_methods export_method_aliases) ] }, |
17
|
5
|
|
|
5
|
|
23
|
}; |
|
5
|
|
|
|
|
4
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
1; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
__END__ |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=pod |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 NAME |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
DBIx::Class::Candy::Exports - Create sugar for your favorite ORM, DBIx::Class |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 SYNOPSIS |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
package DBIx::Class::Widget; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub create_a_widget { ... } |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# so you don't depend on ::Candy |
36
|
|
|
|
|
|
|
eval { |
37
|
|
|
|
|
|
|
require DBIx::Class::Candy::Exports; |
38
|
|
|
|
|
|
|
DBIx::Class::Candy::Exports->import; |
39
|
|
|
|
|
|
|
export_methods ['create_a_widget']; |
40
|
|
|
|
|
|
|
export_method_aliases { |
41
|
|
|
|
|
|
|
widget => 'create_a_widget' |
42
|
|
|
|
|
|
|
}; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
The above will make it such that users of your component who use it with |
48
|
|
|
|
|
|
|
L<DBIx::Class::Candy> will have the methods you designate exported into |
49
|
|
|
|
|
|
|
their namespace. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 DESCRIPTION |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
The whole point of this module is to make sugar a first class citizen in |
54
|
|
|
|
|
|
|
the component world that dominates L<DBIx::Class>. I make enough components |
55
|
|
|
|
|
|
|
and like this sugar idea enough that I want to be able to have both at the |
56
|
|
|
|
|
|
|
same time. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 IMPORTED SUBROUTINES |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 export_methods |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
export_methods [qw( foo bar baz )]; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Use this subroutine to define methods that get exported as subroutines of the |
65
|
|
|
|
|
|
|
same name. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head2 export_method_aliases |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
export_method_aliases { |
70
|
|
|
|
|
|
|
old_method_name => 'new_sub_name', |
71
|
|
|
|
|
|
|
}; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Use this subroutine to define methods that get exported as subroutines of a |
74
|
|
|
|
|
|
|
different name. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 AUTHOR |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com> |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
This software is copyright (c) 2016 by Arthur Axel "fREW" Schmidt. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
85
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=cut |