package Daje::Document::Load::Template;
use Mojo::Base  -base;
use v5.42;

use Daje::Tools::Datasections;

#
# NAME
# ====
#
# Daje::Document::Load::Template - It finds and loads a template
#
# SYNOPSIS
# ========
#
#     use Daje::Document::Load::Template;
#
#     my $templates = Daje::Document::Load::Template->new(
#         data_sections => $data_sections,
#         source        => $source,
#         error         => $error,
#     )->load_templates();
#


# REQUIRES
# ========
#
# use Mojo::Base;
#
# use Daje::Tools::Datasections;
#
# 
# DESCRIPTION
# ===========
#
# Daje::Document::Load::Template load templates from
# installed perl classes.
#
# LICENSE
# =======
#
# Copyright (C) janeskil1525.
#
# This library is free software; you can redistribute it and/or modify
# it under the same terms as Perl itself.
#
# AUTHOR
# ======
#
# janeskil1525 E<lt>janeskil1525@gmail.comE<gt>
#


our $VERSION = "0.02";

has 'data_sections';
has 'source';
has 'error';
has 'template';

sub load_templates($self) {
    my $template;
    try {
        $template = Daje::Tools::Datasections->new(
            data_sections => $self->data_sections(),
            source        => $self->source(),
        );
    } catch ($e) {
        $self->error->add_error($e);
    };


    $template->load_data_sections();
    $self->error->add_error($template->error());
    $self->template($template);
    return 1;
}

1;
__END__








#################### pod generated by Pod::Autopod - keep this line to make pod updates possible ####################

=head1 NAME


Daje::Document::Load::Template - It finds and loads a template



=head1 SYNOPSIS


    use Daje::Document::Load::Template;

    my $templates = Daje::Document::Load::Template->new(
        data_sections => $data_sections,
        source        => $source,
        error         => $error,
    )->load_templates();



=head1 DESCRIPTION




=head1 REQUIRES

L<Daje::Tools::Datasections> 

L<v5.42> 

L<Mojo::Base> 


=head1 METHODS

=head2 load_templates($self)

 load_templates($self)();


=cut

