AutoCRUD/Controller/Join.pm untested

filter: Statementstmt 0.0% 0 / 44 Branchbran n/a Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 13 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 70 CC 1 SCAR 6.9
CC
1
Cov
0%
serve
2.0
descr
2.0
list
2.0
CRAP 2.0
1 package App::AutoCRUD::Controller::Join;
2
3 # WORK IN PROGRESS
4
5 use 5.010;
6 use strict;
7 use warnings;
8
9 use Moose;
10 extends 'App::AutoCRUD::Controller';
11 use SQL::Abstract::More;
12 use Clone qw/clone/;
13 use JSON;
14 use URI;
15
16 use namespace::clean -except => 'meta';
17
18 #----------------------------------------------------------------------
19 # entry point to the controller
20 #----------------------------------------------------------------------
21 sub serve {
22 my ($self) = @_;
23
24 my $context = $self->context;
25
26 # extract from path : join specification and method to dispatch to
27 my ($join_spec, $meth_name) = $context->extract_path_segments(2)
28 or die "URL too short, missing join specification and method name";
29 my $method = $self->can($meth_name)
30 or die "no such method: $meth_name";
31 my @join_args = split /\s*([<=>]+)\s*/, $join_spec;
32 @join_args >= 3
33 or die "incorrect join specification: $join_spec";
34
35 #CONTINUE HERE
36
37 # set default template and title
38 $context->set_template("join/$meth_name.tt");
39 $context->set_title($context->title . "-" . $table);
40
41 # dispatch to method
42 return $self->$method(\@join_args);
43 }
44
45
46 #----------------------------------------------------------------------
47 # published methods
48 #----------------------------------------------------------------------
49
50 sub descr {
51 my ($self, $join_args) = @_;
52
53 die "TODO";
54 }
55
56
57 sub list {
58 my ($self, $join_args) = @_;
59
60 die "TODO";
61 }
62
63
64
65
66
67 sub search {
68 my ($self, $join_args) = @_;
69
70 die "TODO";
71 }
72
73
74
75 1;
76
77 __END__