line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catalyst::Helper::Model::MongoDB; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:GETTY'; |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
# ABSTRACT: Helper for MongoDB models |
5
|
1
|
|
|
1
|
|
1136
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
28
|
|
6
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
137
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.14'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub mk_compclass { |
12
|
0
|
|
|
0
|
1
|
|
my ( $self, $helper, $host, $port, $dbname, $collectionname, $gridfs ) = @_; |
13
|
|
|
|
|
|
|
|
14
|
0
|
|
|
|
|
|
my %args = ( |
15
|
|
|
|
|
|
|
host => $host, |
16
|
|
|
|
|
|
|
port => $port, |
17
|
|
|
|
|
|
|
dbname => $dbname, |
18
|
|
|
|
|
|
|
collectionname => $collectionname, |
19
|
|
|
|
|
|
|
gridfs => $gridfs, |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
$helper->render_file('modelclass', $helper->{file}, \%args); |
23
|
0
|
|
|
|
|
|
return 1; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub mk_comptest { |
27
|
0
|
|
|
0
|
1
|
|
my ($self, $helper) = @_; |
28
|
0
|
|
|
|
|
|
$helper->render_file('modeltest', $helper->{test}); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=pod |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 NAME |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Catalyst::Helper::Model::MongoDB - Helper for MongoDB models |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 VERSION |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
version 0.14 |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 SYNOPSIS |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
script/myapp_create.pl model MyModel MongoDB [host] [port] [dbname] [collectionname] [gridfs] |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 DESCRIPTION |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Helper for the L<Catalyst> MongoDB model. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 USAGE |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 METHODS |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 mk_compclass |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Makes the model class. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 mk_comptest |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Makes tests. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 SUPPORT |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
IRC |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Join #catalyst on irc.perl.org and ask for Getty. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 AUTHOR |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Torsten Raudssus <torsten@raudssus.de> L<http://www.raudssus.de/> |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
This software is copyright (c) 2010 by Raudssus Social Software. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
79
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
__DATA__ |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=begin pod_to_ignore |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
__modelclass__ |
88
|
|
|
|
|
|
|
package [% class %]; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
use Moose; |
91
|
|
|
|
|
|
|
BEGIN { extends 'Catalyst::Model::MongoDB' }; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
__PACKAGE__->config( |
94
|
|
|
|
|
|
|
host => '[% host || 'localhost' %]', |
95
|
|
|
|
|
|
|
port => '[% port || '27017' %]', |
96
|
|
|
|
|
|
|
dbname => '[% dbname %]', |
97
|
|
|
|
|
|
|
collectionname => '[% collectionname %]', |
98
|
|
|
|
|
|
|
gridfs => '[% gridfs %]', |
99
|
|
|
|
|
|
|
); |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 NAME |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
[% class %] - MongoDB Catalyst model component |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 SYNOPSIS |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
See L<[% app %]>. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 DESCRIPTION |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
MongoDB Catalyst model component. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 AUTHOR |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
[% author %] |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 LICENSE |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
120
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=cut |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
no Moose; |
125
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
1; |
128
|
|
|
|
|
|
|
__modeltest__ |
129
|
|
|
|
|
|
|
use strict; |
130
|
|
|
|
|
|
|
use warnings; |
131
|
|
|
|
|
|
|
use Test::More tests => 2; |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
use_ok('Catalyst::Test', '[% app %]'); |
134
|
|
|
|
|
|
|
use_ok('[% class %]'); |