Class-Usul
view release on metacpan or search on metacpan
lib/Class/Usul.pm view on Meta::CPAN
# Attribute constructors
my $_build_debug = sub {
return !!ns_environment( $_[ 0 ]->config->appclass, 'debug' ) ? TRUE : FALSE;
};
# Public attributes
has 'config' => is => 'lazy', isa => ConfigProvider,
builder => sub { $_[ 0 ]->config_class->new( $_[ 0 ]->_config_attr)},
init_arg => undef;
has '_config_attr' => is => 'ro', isa => HashRef, builder => sub { {} },
init_arg => 'config';
has 'config_class' => is => 'ro', isa => LoadableClass, coerce => TRUE,
default => 'Class::Usul::Config';
has 'debug' => is => 'lazy', isa => Bool, builder => $_build_debug;
has 'l10n' => is => 'lazy', isa => Localiser,
builder => sub { $_[ 0 ]->l10n_class->new( builder => $_[ 0 ] ) },
handles => [ 'loc', 'localize' ];
lib/Class/Usul/Config.pm view on Meta::CPAN
has 'extension' => is => 'lazy', isa => NonEmptySimpleStr,
default => CONFIG_EXTN;
has 'home' => is => 'lazy', isa => Directory, coerce => TRUE,
default => DEFAULT_CONFHOME;
has 'locale' => is => 'ro', isa => NonEmptySimpleStr, default => LANG;
has 'localedir' => is => 'lazy', isa => Directory, coerce => TRUE;
has 'locales' => is => 'ro', isa => ArrayRef[NonEmptySimpleStr],
builder => sub { [ LANG ] };
has 'logfile' => is => 'lazy', isa => Path, coerce => TRUE;
has 'logsdir' => is => 'lazy', isa => Directory, coerce => TRUE;
has 'name' => is => 'lazy', isa => NonEmptySimpleStr;
has 'no_thrash' => is => 'ro', isa => NonZeroPositiveInt, default => 3;
lib/Class/Usul/Config.pm view on Meta::CPAN
has 'l10n_attributes' => is => 'lazy', isa => HashRef,
builder => $_build_l10n_attributes, init_arg => undef;
has 'l10n_domains' => is => 'lazy', isa => ArrayRef[NonEmptySimpleStr],
builder => sub { [ DEFAULT_L10N_DOMAIN, $_[ 0 ]->name ] };
has '_l10n_attributes' => is => 'lazy', isa => HashRef,
builder => sub { {} }, init_arg => 'l10n_attributes';
has 'lock_attributes' => is => 'ro', isa => HashRef, builder => sub { {} };
has 'log_attributes' => is => 'ro', isa => HashRef, builder => sub { {} };
# Private functions
my $_is_inflated = sub {
my ($attr, $attr_name) = @_;
return exists $attr->{ $attr_name } && defined $attr->{ $attr_name }
&& $attr->{ $attr_name } !~ m{ \A __ }mx ? TRUE : FALSE;
};
my $_unpack = sub {
lib/Class/Usul/Config.pm view on Meta::CPAN
=head1 Synopsis
use Class::Usul::Constants qw( TRUE );
use Class::Usul::Types qw( ConfigType HashRef LoadableClass );
use Moo;
has 'config' => is => 'lazy', isa => ConfigType, builder => sub {
$_[ 0 ]->config_class->new( $_[ 0 ]->_config_attr ) },
init_arg => undef;
has '_config_attr' => is => 'ro', isa => HashRef, builder => sub { {} },
init_arg => 'config';
has 'config_class' => is => 'ro', isa => LoadableClass, coerce => TRUE,
default => 'Class::Usul::Config';
=head1 Description
Defines the configuration object. Attributes have sensible defaults that
can be overridden by values in configuration files which are loaded on
request
lib/Class/Usul/Config/Programs.pm view on Meta::CPAN
};
my $_build_script = sub {
return basename( $_[ 0 ]->inflate_path( $_[ 1 ], 'pathname' ) );
};
# Public attributes
has 'doc_title' => is => 'ro', isa => NonEmptySimpleStr,
default => 'User Contributed Documentation';
has 'man_page_cmd' => is => 'ro', isa => ArrayRef,
builder => sub { [ 'nroff', '-man' ] };
has 'my_home' => is => 'lazy', isa => Path, coerce => TRUE,
builder => sub { File::HomeDir->my_home };
has 'os' => is => 'lazy', isa => HashRef, builder => $_build_os;
has 'owner' => is => 'lazy', isa => NonEmptySimpleStr,
builder => $_build_owner;
lib/Class/Usul/IPC/Cmd.pm view on Meta::CPAN
use Moo; use warnings NONFATAL => 'all';
our ($CHILD_ENUM, $CHILD_PID);
# Public attributes
has 'async' => is => 'ro', isa => Bool, default => FALSE;
has 'close_all_files' => is => 'ro', isa => Bool, default => FALSE;
has 'cmd' => is => 'ro', isa => ArrayRef | Str,
required => TRUE;
has 'detach' => is => 'ro', isa => Bool, default => FALSE;
has 'err' => is => 'ro', isa => Path | SimpleStr, default => NUL;
has 'expected_rv' => is => 'ro', isa => PositiveInt, default => 0;
has 'ignore_zombies' => is => 'lazy', isa => Bool, builder => sub {
($_[ 0 ]->async || $_[ 0 ]->detach) ? TRUE : FALSE };
lib/Class/Usul/Schema.pm view on Meta::CPAN
# Public attributes
option 'all' => is => 'ro', isa => Bool, default => FALSE,
documentation => 'Perform operation for all possible schema',
short => 'a';
option 'database' => is => 'rwp', isa => NonEmptySimpleStr,
documentation => 'The database to connect to',
format => 's', lazy => TRUE, required => TRUE,
trigger => $_rebuild_qdb;
option 'db_admin_accounts' => is => 'ro', isa => HashRef,
documentation => 'For each RDBMS the name of the system database',
default => sub { { mysql => 'mysql',
pg => 'postgres',
sqlite => NUL, } },
format => 's%';
option 'db_admin_ids' => is => 'ro', isa => HashRef,
documentation => 'The default admin user ids for each RDBMS',
default => sub { { mysql => 'root',
pg => 'postgres',
sqlite => NUL, } },
format => 's%';
option 'db_attr' => is => 'ro', isa => HashRef,
documentation => 'Default database connection attributes',
default => sub { { add_drop_table => TRUE,
no_comments => TRUE,
quote_identifiers => TRUE, } },
format => 's%';
option 'dry_run' => is => 'ro', isa => Bool, default => FALSE,
documentation => 'Prints out commands, do not execute them',
short => 'd';
lib/Class/Usul/TraitFor/RunningMethods.pm view on Meta::CPAN
use Class::Usul::Options;
requires qw( app_version can_call debug error exit_usage
extra_argv file next_argv output quiet );
# Public attributes
option 'method' => is => 'rwp', isa => SimpleStr, format => 's',
documentation => 'Name of the method to call',
default => NUL, order => 1, short => 'c';
option 'options' => is => 'ro', isa => HashRef, format => 's%',
documentation =>
'Zero, one or more key=value pairs available to the method call',
builder => sub { {} }, short => 'o';
option 'umask' => is => 'rw', isa => OctalNum, format => 's',
documentation => 'Set the umask to this octal number',
builder => sub { $_[ 0 ]->config->umask }, coerce => TRUE,
lazy => TRUE;
option 'verbose' => is => 'ro', isa => Int,
( run in 0.596 second using v1.01-cache-2.11-cpan-5f2e87ce722 )