Facturer/lib/Owlcode/Tech/Facturer.pm

53 lines
962 B
Perl

package Owlcode::Tech::Facturer;
use v5.36.0;
use strict;
use warnings;
use feature 'signatures';
use Moo;
use Path::Tiny;
use Mojo::JSON qw(decode_json encode_json);
has config => ( is => 'lazy' );
my $ROOT_PATH = path(__FILE__)->parent->parent->parent->parent->realpath;
sub fullname ($self) {
return $self->config->{fullname};
}
sub dni ($self) {
return $self->config->{dni};
}
sub address ($self) {
return $self->config->{address};
}
sub postal_code ($self) {
return $self->config->{postal_code};
}
sub image ($self) {
if (!defined $self->config->{img}) {
return
}
return $ROOT_PATH->child($self->config->{img});
}
sub _build_config {
my $config_path = $ROOT_PATH->child('config.json');
return decode_json( $config_path->slurp_utf8 );
}
sub run ($self) {
require Owlcode::Tech::Facturer::MainCommand;
my $main_command = Owlcode::Tech::Facturer::MainCommand->new;
$main_command->run;
}
1;