line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package # hide from PAUSE |
2
|
|
|
|
|
|
|
DBIx::Class::Schema::PopulateMore::Test::Schema; |
3
|
|
|
|
|
|
|
|
4
|
3
|
|
|
3
|
|
37332
|
use Path::Class; |
|
3
|
|
|
|
|
113616
|
|
|
3
|
|
|
|
|
192
|
|
5
|
3
|
|
|
3
|
|
22
|
use parent 'DBIx::Class::Schema'; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
14
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
DBIx::Class::Schema::PopulateMore::Test::Schema; Test Schema |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 DESCRIPTION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Defines the base case for loading DBIC Schemas. This schema currently defines |
15
|
|
|
|
|
|
|
three sources, Person, FriendList, and Gender |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 PACKAGE METHODS |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
The following is a list of package methods declared with this class. |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head2 load_components |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
Load the components |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
__PACKAGE__->load_components(qw/ |
28
|
|
|
|
|
|
|
Schema::PopulateMore |
29
|
|
|
|
|
|
|
/); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head2 load_namespaces |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Automatically load the classes and resultsets from their default namespaces. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=cut |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__PACKAGE__->load_namespaces( |
39
|
|
|
|
|
|
|
default_resultset_class => 'ResultSet', |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
This class defines the following attributes. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 METHODS |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
This module declares the following methods |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head2 connect_and_setup |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Creates a schema, deploys a database and sets the testing data. By default we |
54
|
|
|
|
|
|
|
use a L<DBD::SQLite> database created |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub connect_and_setup { |
59
|
2
|
|
|
2
|
1
|
29
|
my $class = shift @_; |
60
|
|
|
|
|
|
|
|
61
|
2
|
|
33
|
|
|
14
|
my ($dsn, $user, $pass) = ( |
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
62
|
|
|
|
|
|
|
$ENV{DBIC_POPULATE_DSN} || $class->default_dsn, |
63
|
|
|
|
|
|
|
$ENV{DBIC_POPULATE_USER} || '', |
64
|
|
|
|
|
|
|
$ENV{DBIC_POPULATE_PASS} || '', |
65
|
|
|
|
|
|
|
); |
66
|
|
|
|
|
|
|
|
67
|
2
|
|
|
|
|
28
|
return $class |
68
|
|
|
|
|
|
|
->connect($dsn, $user, $pass, { AutoCommit => 1 }) |
69
|
|
|
|
|
|
|
->setup; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 default_dsn |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
returns a dsn string, suitable for passing to L<DBD::SQLite>, creating the |
75
|
|
|
|
|
|
|
database as a temporary file. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=cut |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub default_dsn |
80
|
|
|
|
|
|
|
{ |
81
|
2
|
|
|
2
|
1
|
24
|
return "dbi:SQLite:dbname=:memory:"; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head2 setup |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
deploy a database and populate it with the initial data |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=cut |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub setup { |
91
|
2
|
|
|
2
|
1
|
97239
|
my $self = shift @_; |
92
|
2
|
|
|
|
|
18
|
$self->deploy(); |
93
|
2
|
|
|
|
|
756005
|
return $self; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head2 cleanup |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
cleanup any temporary files |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=cut |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub cleanup { |
103
|
0
|
|
|
0
|
1
|
|
my $self = shift @_; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub DESTROY { |
107
|
0
|
|
|
0
|
|
|
(shift)->cleanup; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 AUTHOR |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Please see L<DBIx::Class::Schema::PopulateMore> For authorship information |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 LICENSE |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Please see L<DBIx::Class::Schema::PopulateMore> For licensing terms. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=cut |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
1; |