Bot-Cobalt
view release on metacpan or search on metacpan
lib/Bot/Cobalt/Lang.pm view on Meta::CPAN
package Bot::Cobalt::Lang;
$Bot::Cobalt::Lang::VERSION = '0.021003';
use v5.10;
use strictures 2;
use Carp;
use Bot::Cobalt::Common qw/:types/;
use Bot::Cobalt::Serializer;
use File::ShareDir 'dist_dir';
use Types::Path::Tiny -types;
use Path::Tiny;
use Try::Tiny;
use Moo;
## Configurable:
has lang_dir => (
# BUILD dies without me or absolute_path (unless use_core_only => 1)
lazy => 1,
is => 'ro',
isa => Dir,
coerce => 1,
predicate => 'has_lang_dir',
writer => '_set_lang_dir',
);
has lang => (
required => 1,
is => 'rwp',
isa => Str,
);
has absolute_path => (
# BUILD dies without me or lang_dir (unless use_core_only => 1)
lazy => 1,
is => 'ro',
isa => AbsPath,
coerce => 1,
predicate => 'has_absolute_path',
writer => '_set_absolute_path',
);
has _full_lang_path => (
lazy => 1,
is => 'ro',
isa => Path,
coerce => 1,
builder => sub {
my ($self) = @_;
return $self->absolute_path if $self->has_absolute_path;
path( $self->lang_dir .'/'. $self->lang .'.yml' )
},
);
has use_core => (
is => 'rwp',
isa => Bool,
builder => sub { 0 },
);
has use_core_only => (
is => 'rwp',
isa => Bool,
builder => sub { 0 },
trigger => sub {
my ($self, $val) = @_;
$self->_set_use_core(1) if $val
},
);
has _core_set => (
( run in 2.384 seconds using v1.01-cache-2.11-cpan-75ffa21a3d4 )