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