App-JobLog
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/App/JobLog/Config.pm view on Meta::CPAN
package App::JobLog::Config;
$App::JobLog::Config::VERSION = '1.042';
# ABSTRACT: central depot for App::JobLog configuration parameters and controller allowing their modification
use Exporter 'import';
our @EXPORT_OK = qw(
columns
day_length
dir
editor
hidden_columns
init_file
is_hidden
is_workday
log
merge
pay_period_length
precision
readme
start_pay_period
sunday_begins_week
time_zone
_tz
vacation
workdays
DAYS
DIRECTORY
HIDABLE_COLUMNS
HOURS
MERGE
NONE_COLUMN
PERIOD
PRECISION
SUNDAY_BEGINS_WEEK
TIME_ZONE
WORKDAYS
);
use Class::Autouse qw{
File::HomeDir
File::Spec
Config::Tiny
FileHandle
App::JobLog::Command::info
};
use autouse 'File::Path' => qw(mkpath);
use autouse 'Cwd' => qw(abs_path);
use autouse 'Term::ReadKey' => qw(GetTerminalSize);
use Modern::Perl;
# default precision
use constant PRECISION => 2;
# default pay period
use constant PERIOD => 14;
# hours worked in day
use constant HOURS => 8;
# whether Sunday is the first day of the week
# otherwise it's Monday, as in DateTime
use constant SUNDAY_BEGINS_WEEK => 1;
# environment variables
# identifies directory to write files into
use constant DIRECTORY => 'JOB_LOG_DIRECTORY';
# expected abbreviations for working days in week
use constant WORKDAYS => 'MTWHF';
# expected abbreviations for weekdays
use constant DAYS => 'S' . WORKDAYS . 'A';
# default level of merging
use constant MERGE => 'adjacent same tags';
# name of hide nothing "column"
use constant NONE_COLUMN => 'none';
# array of hidable columns
use constant HIDABLE_COLUMNS => [
NONE_COLUMN, qw(
date
description
duration
tags
time
)
];
# default time zone; necessary because Cygwin doesn't support local
use constant TIME_ZONE => $^O eq 'cygwin' ? 'floating' : 'local';
sub init_file {
my ($path) = @_;
unless ( -e $path ) {
my ( $volume, $directories, $file ) = File::Spec->splitpath($path);
my $dir = File::Spec->catfile( $volume, $directories );
mkpath( $dir, { verbose => 0, mode => 0711 } ) unless -d $dir;
unless ( -e readme() ) {
my $fh = FileHandle->new( readme(), 'w' )
or die 'could not create file ' . readme();
my $executable = abs_path($0);
# to protect against refactoring
my $command = App::JobLog::Command::info->name;
print $fh <<END;
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.588 second using v1.00-cache-2.02-grep-82fe00e-cpan-d29e8ade9f55 )