| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Terse::Model; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
805
|
use base 'Terse'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
240
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
sub new { |
|
6
|
1
|
|
|
1
|
1
|
14
|
my ($pkg, @args) = @_; |
|
7
|
1
|
|
|
|
|
18
|
my $self = $pkg->SUPER::new(@args); |
|
8
|
1
|
|
|
|
|
6
|
(my $namespace = $pkg) =~ s/^.*Model:://; |
|
9
|
1
|
|
|
|
|
5
|
$namespace =~ s/\:\:/\//g; |
|
10
|
1
|
|
|
|
|
14
|
$self->namespace = lc( $namespace ); |
|
11
|
1
|
50
|
|
|
|
11
|
$self->build_model($self->app_config) if ($self->can('build_model')); |
|
12
|
1
|
|
|
|
|
9
|
return $self; |
|
13
|
|
|
|
|
|
|
} |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub connect { |
|
16
|
0
|
|
|
0
|
0
|
|
my ($self, $t) = @_; |
|
17
|
0
|
|
|
|
|
|
return $self; |
|
18
|
|
|
|
|
|
|
} |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
1; |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 NAME |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Terse::Controller - models made simple. |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 VERSION |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Version 0.20 |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=cut |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
package My::App::Model::Data; |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
use base 'Terse::Model'; |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub do_something { |
|
39
|
|
|
|
|
|
|
... |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
... If using Terse::App |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
package My::App::Controller::Overview; |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
use base 'Terse::Controller'; |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub overview :get { |
|
51
|
|
|
|
|
|
|
$_[1]->response->data = $_[1]->model('data')->do_something(); |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
... else |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
package MyApp; |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
use base 'Terse::Controller'; |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
use MyAppModel; |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub build_controller { |
|
63
|
|
|
|
|
|
|
$_[0]->models->data = MyAppModel->new(); |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub overview :get { |
|
67
|
|
|
|
|
|
|
$_[1]->response->data = $_[1]->model('data')->do_something(); |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 AUTHOR |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
LNATION, C<< >> |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
L. |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |
|
82
|
|
|
|
|
|
|
|