File Coverage

blib/lib/Daje/Document/Load/Template.pm
Criterion Covered Total %
statement 8 19 42.1
branch n/a
condition n/a
subroutine 3 4 75.0
pod 1 1 100.0
total 12 24 50.0


line stmt bran cond sub pod time code
1             package Daje::Document::Load::Template;
2 1     1   26 use Mojo::Base -base;
  1         3  
  1         12  
3 1     1   316 use v5.42;
  1         7  
4              
5 1     1   683 use Daje::Tools::Datasections;
  1         1476  
  1         9  
6              
7             #
8             # NAME
9             # ====
10             #
11             # Daje::Document::Load::Template - It finds and loads a template
12             #
13             # SYNOPSIS
14             # ========
15             #
16             # use Daje::Document::Load::Template;
17             #
18             # my $templates = Daje::Document::Load::Template->new(
19             # data_sections => $data_sections,
20             # source => $source,
21             # error => $error,
22             # )->load_templates();
23             #
24              
25              
26             # REQUIRES
27             # ========
28             #
29             # use Mojo::Base;
30             #
31             # use Daje::Tools::Datasections;
32             #
33             #
34             # DESCRIPTION
35             # ===========
36             #
37             # Daje::Document::Load::Template load templates from
38             # installed perl classes.
39             #
40             # LICENSE
41             # =======
42             #
43             # Copyright (C) janeskil1525.
44             #
45             # This library is free software; you can redistribute it and/or modify
46             # it under the same terms as Perl itself.
47             #
48             # AUTHOR
49             # ======
50             #
51             # janeskil1525 Ejaneskil1525@gmail.comE
52             #
53              
54              
55             our $VERSION = "0.02";
56              
57             has 'data_sections';
58             has 'source';
59             has 'error';
60             has 'template';
61              
62 0     0 1   sub load_templates($self) {
  0            
  0            
63 0           my $template;
64 0           try {
65 0           $template = Daje::Tools::Datasections->new(
66             data_sections => $self->data_sections(),
67             source => $self->source(),
68             );
69             } catch ($e) {
70 0           $self->error->add_error($e);
71             };
72              
73              
74 0           $template->load_data_sections();
75 0           $self->error->add_error($template->error());
76 0           $self->template($template);
77 0           return 1;
78             }
79              
80             1;
81             __END__