Plugin/Languages.pm

filter: Statementstmt 33.3% 1 / 3 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 1 / 1 Podpod n/a totaltotal 50.0% 2 / 4 CC 1 SCAR 2.6
CC
1
Cov
33%
BEGIN
1.3
CRAP 1.3
« Database/Model/LanguagesTypes.pm ↑ Summary
1 package Daje::Plugin::Languages;
2 0 ▶use Mojo::Base 'Mojolicious::Plugin', -base, -signatures;
Subroutine BEGIN: called CC=1 SCAR=2.6
3 use v5.42;
4  
5 # NAME
6 # ====
7 #
8 # Daje::Plugin::Languages - Mojolicious Plugin
9 #
10 # SYNOPSIS
11 # ========
12 #
13 # Mojolicious
14 # ===========
15 #
16 # $self->plugin('Languages');
17 #
18 # Mojolicious::Lite
19 # =================
20 #
21 # plugin 'Languages';
22 #
23 # DESCRIPTION
24 # ===========
25 #
26 # Daje::Plugin::Languages is a Mojolicious plugin.
27 #
28 # METHODS
29 # =======
30 #
31 # Daje::Plugin::Languages inherits all methods from
32 # Mojolicious::Plugin and implements the following new ones.
33 #
34 # register
35 # ========
36 # $plugin->register(Mojolicious->new);
37 #
38 # Register plugin in L<Mojolicious> application.
39 #
40 # SEE ALSO
41 # ========
42 #
43 # Mojolicious, Mojolicious::Guides, https://mojolicious.org.
44 #
45 # LICENSE
46 # =======
47 #
48 # Copyright (C) janeskil1525.
49 #
50 # This library is free software; you can redistribute it and/or modify
51 # it under the same terms as Perl itself.
52 #
53 # AUTHOR
54 # ======
55 #
56 # janeskil1525 E<lt>janeskil1525@gmail.com
57 #
58  
59 # This file is generated once automatically by Daje Tools 2026-02-21 07:32:38.
60 # It will not be touched by Daje Tools again.
61  
62 # <!-- Autogenerated file 2026-02-21 07:32:38 -->
63  
64 use Daje::Plugin::Languages::Routes;
65 use Daje::Plugin::Languages::Helpers;
66 use Daje::Plugin::Languages::Authorities;
67 use Daje::Plugin::Languages::Languages;
68  
69 use Daje::Helper::Languages::Translations;
70 use Daje::Database::Migrator;
71  
72 our $VERSION = '0.01';
73  
74 sub register ($self, $app, $config) {
75 $app->log->debug("Daje::Plugin::Languages::register start");
76  
77 my $r = $app->routes();
78  
79 $r->get($app->config->{project} . '/translations/')->to('Translations#translations_list');
80  
81 $app->helper(
82 translations => sub {
83 state $translations = Daje::Helper::Languages::Translations->new(db => shift->pg->db)
84 });
85  
86 my $migration->{class} = 'Daje::Database::Languages';
87 $migration->{name} = 'languages';
88 $migration->{migration} = 1;
89 my $migrations;
90 push @{$migrations}, $migration;
91 try {
92 Daje::Database::Migrator->new(
93 pg => $app->pg,
94 migrations => $migrations,
95 )->migrate();
96 } catch ($e) {
97 $app->log->error($e);
98 };
99  
100 Daje::Plugin::Languages::Routes->new()->routes($app, $config);
101 Daje::Plugin::Languages::Helpers->new()->helpers($app, $config);
102 Daje::Plugin::Languages::Authorities->new(
103 db => $app->pg->db
104 )->authorize();
105 Daje::Plugin::Languages::Languages->new(
106 db => $app->pg->db
107 )->language();
108  
109  
110 $app->log->debug("Daje::Plugin::Languages::register ends");
111 }
112  
113 1;
114  
115  
116 #################### pod generated by Pod::Autopod - keep this line to make pod updates possible ####################
117  
118 =head1 NAME
119  
120  
121 Daje::Plugin::Languages - Mojolicious Plugin
122  
123  
124  
125 =head1 SYNOPSIS
126  
127  
128  
129  
130 =head1 DESCRIPTION
131  
132  
133 Daje::Plugin::Languages is a Mojolicious plugin.
134  
135  
136  
137 =head1 REQUIRES
138  
139 L<Daje::Database::Migrator>
140  
141 L<Daje::Plugin::Languages::Languages>
142  
143 L<Daje::Plugin::Languages::Authorities>
144  
145 L<Daje::Plugin::Languages::Helpers>
146  
147 L<Daje::Plugin::Languages::Routes>
148  
149 L<v5.42>
150  
151 L<Mojo::Base>
152  
153  
154 =head1 METHODS
155  
156  
157 Daje::Plugin::Languages inherits all methods from
158 Mojolicious::Plugin and implements the following new ones.
159  
160  
161  
162 =head1 Mojolicious::Lite
163  
164  
165 plugin 'Languages';
166  
167  
168  
169 =head1 Mojolicious
170  
171  
172 $self->plugin('Languages');
173  
174  
175  
176 =head1 register
177  
178 $plugin->register(Mojolicious->new);
179  
180 Register plugin in L<Mojolicious> application.
181  
182  
183  
184 =head1 SEE ALSO
185  
186  
187 Mojolicious, Mojolicious::Guides, https://mojolicious.org.
188  
189  
190  
191 =head1 AUTHOR
192  
193  
194 janeskil1525 E<lt>janeskil1525@gmail.com
195  
196  
197  
198 =head1 LICENSE
199  
200  
201 Copyright (C) janeskil1525.
202  
203 This library is free software; you can redistribute it and/or modify
204 it under the same terms as Perl itself.
205  
206  
207  
208 =cut
209  
« Database/Model/LanguagesTypes.pm ↑ Summary