Acrux
view release on metacpan or search on metacpan
lib/Acme/Crux.pm view on Meta::CPAN
$self->{docdir} = File::Spec->catdir(DOCDIR, $moniker);
}
# Cache dir
my $cachedir = $self->{cachedir};
unless (defined($cachedir) && length($cachedir)) {
$self->{cachedir} = File::Spec->catdir(CACHEDIR, $moniker);
}
# Spool dir
my $spooldir = $self->{spooldir};
unless (defined($spooldir) && length($spooldir)) {
$self->{spooldir} = File::Spec->catdir(SPOOLDIR, $moniker);
}
# Run dir
my $rundir = $self->{rundir};
unless (defined($rundir) && length($rundir)) {
$rundir = $self->{rundir} = File::Spec->catdir(RUNDIR, $moniker);
}
# Lock dir
my $lockdir = $self->{lockdir};
unless (defined($lockdir) && length($lockdir)) {
$self->{lockdir} = File::Spec->catdir(LOCKDIR, $moniker);
}
# Web dir
my $webdir = $self->{webdir};
unless (defined($webdir) && length($webdir)) {
$self->{webdir} = File::Spec->catdir(WEBDIR, $moniker);
}
# Config file
my $configfile = $self->{configfile};
unless (defined($configfile) && length($configfile)) {
$self->{configfile} = $configfile = File::Spec->catfile($root, sprintf("%s.conf", $moniker));
}
unless (File::Spec->file_name_is_absolute($configfile)) {
$self->{configfile} = $configfile = File::Spec->rel2abs($configfile);
}
# Log file
my $logfile = $self->{logfile};
unless (defined($logfile) && length($logfile)) {
$self->{logfile} = $logfile = File::Spec->catfile($logdir, sprintf("%s.log", $moniker));
}
unless (File::Spec->file_name_is_absolute($logfile)) {
$self->{logfile} = $logfile = File::Spec->rel2abs($logfile);
}
# PID file
my $pidfile = $self->{pidfile};
unless (defined($pidfile) && length($pidfile)) {
$self->{pidfile} = $pidfile = File::Spec->catfile($rundir, sprintf("%s.pid", $moniker));
}
unless (File::Spec->file_name_is_absolute($pidfile)) {
$self->{pidfile} = $pidfile = File::Spec->rel2abs($pidfile);
}
# Define plugins list to plugin map
$self->plugins(as_hash_ref($args->{plugins}));
# Preloading plugins
my $preload_plugins = $self->{preload_plugins};
$preload_plugins = [$preload_plugins] unless is_array_ref($preload_plugins);
my $pplgns = words(@$preload_plugins);
$self->plugin($_) for @$pplgns;
#foreach my $p (@$preload_plugins) {
# next unless defined($p) && is_value($p);
# $self->plugin($_) for split(/[\s;,]+/, $p);
#}
return $self->startup(%$args);
}
sub startup { shift }
# Attributes
sub options {
my $self = shift;
if (scalar(@_) >= 1) {
$self->{options} = shift;
return $self;
}
return $self->{options};
}
sub project {
my $self = shift;
if (scalar(@_) >= 1) {
$self->{project} = shift;
return $self;
}
return $self->{project};
}
sub moniker {
my $self = shift;
if (scalar(@_) >= 1) {
$self->{moniker} = shift;
return $self;
}
return $self->{moniker};
}
# Files and directories
sub pwd { shift->{pwd} }
sub root {
my $self = shift;
if (scalar(@_) >= 1) {
$self->{root} = shift;
return $self;
}
return $self->{root};
}
sub tempdir {
my $self = shift;
if (scalar(@_) >= 1) {
$self->{tempdir} = shift;
return $self;
}
return $self->{tempdir};
}
( run in 2.828 seconds using v1.01-cache-2.11-cpan-5837b0d9d2c )