view release on metacpan or search on metacpan
lib/App/CSE.pm view on Meta::CPAN
use Moose;
use Class::Load;
use Cwd;
use App::CSE::Colorizer;
use DateTime;
use File::MimeInfo::Magic;
use IO::Interactive;
use JSON;
use String::CamelCase;
lib/App/CSE.pm view on Meta::CPAN
# The arguments after any option
has 'args' => ( is => 'ro' , isa => 'ArrayRef[Str]', lazy_build => 1);
has 'index_dir' => ( is => 'ro' , isa => 'Path::Class::Dir', lazy_build => 1);
has 'index_mtime' => ( is => 'ro' , isa => 'DateTime' , lazy_build => 1);
has 'index_dirty_file' => ( is => 'ro' , isa => 'Path::Class::File', lazy_build => 1);
has 'dirty_files' => ( is => 'ro', isa => 'HashRef[Str]', lazy_build => 1);
has 'index_meta_file' => ( is => 'ro' , isa => 'Path::Class::File' , lazy_build => 1);
has 'index_meta' => ( is => 'ro', isa => 'HashRef[Str]', lazy_build => 1);
lib/App/CSE.pm view on Meta::CPAN
}
sub _build_index_mtime{
my ($self) = @_;
my $st = File::stat::stat($self->index_dir());
return DateTime->from_epoch( epoch => $st->mtime() );
}
sub _build_max_size{
my ($self) = @_;
return $self->options()->{max_size} || 1048576; # 1 MB default. This is the buffer size of File::Slurp
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/CSVUtils/csv_grep.pm view on Meta::CPAN
test => 0,
'x.doc.show_result' => 0,
},
{
summary => 'Only show rows where date is a Wednesday',
argv => ['-He', 'BEGIN { use DateTime::Format::Natural; $parser = DateTime::Format::Natural->new } $dt = $parser->parse_datetime($_->{date}); $dt->day_of_week == 3', 'file.csv'],
test => 0,
'x.doc.show_result' => 0,
},
],
links => [
lib/App/CSVUtils/csv_grep.pm view on Meta::CPAN
=item * Only show rows where date is a Wednesday:
csv_grep(
input_filename => "file.csv",
eval => "BEGIN { use DateTime::Format::Natural; \$parser = DateTime::Format::Natural->new } \$dt = \$parser->parse_datetime(\$_->{date}); \$dt->day_of_week == 3",
hash => 1
);
=back
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/CalId.pm view on Meta::CPAN
use strict;
use warnings;
use experimental 'smartmatch';
use Calendar::Indonesia::Holiday qw(list_id_holidays);
use DateTime;
use List::Util qw(max);
use Term::ANSIColor;
use Text::ANSI::Util qw(ta_length);
my $month_names = [qw(Januari Februari Maret April Mei Juni Juli Agustus September Oktober November Desember)];
lib/App/CalId.pm view on Meta::CPAN
my $m = $args{month};
my $y = $args{year};
my @lines;
my $tz = $args{time_zone} // $ENV{TZ} // "UTC";
my $dt = DateTime->new(year=>$y, month=>$m, day=>1, time_zone=>$tz);
my $dtl = DateTime->last_day_of_month(year=>$y, month=>$m, time_zone=>$tz);
my $dt_today = DateTime->today(time_zone=>$tz);
my $hol = list_id_holidays(
detail => 1, year => $y, month => $m,
(is_joint_leave => 0) x !$args{show_joint_leave},
)->[2];
lib/App/CalId.pm view on Meta::CPAN
for (1..$dtl->day) {
if ($dt->day_of_week == 1) {
push @lines, "";
}
my $col = "white";
if (($args{highlight_today}//1) && DateTime->compare($dt, $dt_today) == 0) {
$col = "reverse";
} else {
for (@$hol) {
if ($dt->day == $_->{day}) {
$col = "bright_red";
lib/App/CalId.pm view on Meta::CPAN
$margs{show_prev_month_days} = 0;
$margs{show_next_month_days} = 0;
}
my @moncals;
my $dt = DateTime->new(year=>$y, month=>$m, day=>1, time_zone=>$tz);
for (1..$mm) {
push @moncals, gen_monthly_calendar(
month=>$dt->month, year=>$dt->year, time_zone=>$tz, %margs);
$dt->add(months => 1);
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/CamelPKI/Time.pm view on Meta::CPAN
I<App::CamelPKI::Time> objects are pure data; they do not carry privileges.
=cut
use App::CamelPKI::Error;
use DateTime;
use DateTime::Duration;
=head1 CONSTRUCTORS
=head2 parse($time)
lib/App/CamelPKI/Time.pm view on Meta::CPAN
throw App::CamelPKI::Error::Internal("INCORRECT_ARGS",
-details => "cannot parse time")
unless my ($Y, $M, $D, $h, $m, $s) =
($time =~ m/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z$/);
return bless
{ dt => DateTime->new(year => $Y, month => $M, day => $D,
hour => $h, minute => $m, second => $s),
}, $class;
}
=head2 now()
lib/App/CamelPKI/Time.pm view on Meta::CPAN
=cut
sub now {
my ($class) = @_;
return bless { dt => DateTime->now() }, $class;
}
=head1 METHODS
=head2 zulu()
lib/App/CamelPKI/Time.pm view on Meta::CPAN
sub advance_days {
my ($self, $days) = @_;
throw App::CamelPKI::Error::Internal("WRONG_NUMBER_ARGS")
if (! defined $days);
my $dt = $self->{dt}->clone;
my $duration = DateTime::Duration->new(days => abs($days));
$days >= 0 ? $dt->add_duration($duration) :
$dt->subtract_duration($duration);
return bless { dt => $dt }, ref($self);
}
lib/App/CamelPKI/Time.pm view on Meta::CPAN
sub advance_years {
my ($self, $days) = @_;
throw App::CamelPKI::Error::Internal("WRONG_NUMBER_ARGS")
if (! defined $days);
my $dt = $self->{dt}->clone;
my $duration = DateTime::Duration->new(years => abs($days));
$days >= 0 ? $dt->add_duration($duration) :
$dt->subtract_duration($duration);
return bless { dt => $dt }, ref($self);
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Cerberus/Plugin/Throttle.pm view on Meta::CPAN
use strict;
use warnings;
use Carp;
use parent 'App::Cerberus::Plugin';
use Net::IP::Match::Regexp qw(create_iprange_regexp_depthfirst match_ip);
use DateTime();
my %Periods = (
second => 5,
minute => 4,
hour => 3,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Changelog2x.pm view on Meta::CPAN
# credits
# transform_changelog
#
# Libraries: XML::LibXML
# XML::LibXSLT
# DateTime
# DateTime::Format::ISO8601
# File::Spec
#
# Global Consts: $VERSION
# URI
#
lib/App/Changelog2x.pm view on Meta::CPAN
use File::Spec;
use XML::LibXML;
use XML::LibXSLT;
use DateTime;
use DateTime::Format::ISO8601;
BEGIN
{
$VERSION = '0.11';
lib/App/Changelog2x.pm view on Meta::CPAN
###############################################################################
sub format_date
{
my ($self, $date, $to_utc) = @_;
my $dt = DateTime::Format::ISO8601->parse_datetime($date);
$dt->set_time_zone('UTC') if $to_utc;
my $string = $dt->strftime($self->date_format);
if ($string =~ /TZ_/)
{
lib/App/Changelog2x.pm view on Meta::CPAN
below).
=item default_date_format
Returns the default date format, a string that is passed to the C<strftime>
method of B<DateTime>. The default format is a slightly more-verbose
version of the UNIX "date" format, with full day- and month-names and a
12-hour clock rather than 24-hour. A typical date formatted this way would
look like this:
Friday September 19, 2008, 02:23:12 AM -0700
lib/App/Changelog2x.pm view on Meta::CPAN
Get or set the date-format to use when C<format_date> is called. If the user
does not explicitly set a format, the value returned by C<default_date_format>
is used.
See L<DateTime/"strftime Patterns"> for a description of the formatting
codes to use in a format string.
One special value is recognized: C<unix>. If C<date_format> is called with
this value as a format string, a pre-defined format is used that emulates the
UNIX C<date> command as closely as possible (but see L</CAVEATS> for notes
on B<DateTime> limitations with regards to timezone names and the special
patterns recognized in date format strings to try and work around this). A
string formatted this way looks like this:
Mon Aug 10 09:21:46 -0700 2009
lib/App/Changelog2x.pm view on Meta::CPAN
=back
=head1 CAVEATS
The B<DateTime> package does not attempt to map timezone values to the old
3-letter codes that were once the definitive representation of timezones.
Because timezones are now much more granular in definition, a timezone offset
cannot be canonically mapped to a specific name. The only timezone that can be
canonically mapped is UTC. Thus, for now, timezones in dates are given as their
offsets from UTC, unless the date is being rendered in UTC directly.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Chart/Series/GT.pm view on Meta::CPAN
use base 'App::Chart::Series';
use GT::Prices;
use GT::Conf;
use GT::Eval;
use GT::DateTime;
use GT::Tools;
use constant DEBUG => 0;
view all matches for this distribution
view release on metacpan or search on metacpan
# Get absolute path to a file (works same for link and regular files,DES)
perl -MCwd=realpath -le '$_="file"; print realpath($_)'
#############################################################
## Perl Modules - DateTime
#############################################################
# Create expiration dates (Start of tomorrow,start of next week)
perl -MDateTime -E '$dt = DateTime->now; say $dt->add(days => 1)->truncate(to => "day" )'
# 2021-08-06T00:00:00
perl -MDateTime -E '$dt = DateTime->now; say $dt->add(weeks => 1)->truncate(to => "local_week" )'
# 2021-08-08T00:00:00
# Truncate date to start of this week (Monday).
perl -MDateTime -E '$dt = DateTime->now; say $dt->truncate(to => "week" )->strftime("%e %b %Y")'
# Truncate date to end of 3 weeks from now on a Friday.
perl -MDateTime -E '$dt = DateTime->now; say $dt->truncate(to => "week" )->add(weeks => 3, days => 4)->strftime("%e %b %Y")'
#############################################################
## Perl Modules - Data::DPath
#############################################################
#############################################################
## Perl Modules - Time::Piece
#############################################################
# Prefer using Time::Piece over DateTime if possible
#
# 1. Less dependencies:
cpanm --showdeps Time::Piece -q | wc -l # 4
cpanm --showdeps DateTime -q | wc -l # 35
#
# 2. Issues with using DateTime and cron.
# Could be due to also perlbrew trying a different
# library path (which I could not resolve).
# Print the currect time, the inputed time, and difference in seconds (accounts for timezone offset)
perl -MTime::Piece -le '$now=localtime; $t=Time::Piece->strptime("20170320 095200 -0400","%Y%m%d %H%M%S %z"); print $_->strftime," ",$_->tzoffset for $now,$t; print $now-$t'
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Cinema/Schema/Result/Comment.pm view on Meta::CPAN
BEGIN {
extends 'DBIx::Class';
our $VERSION = $App::Cinema::VERSION;
}
__PACKAGE__->load_components( "InflateColumn::DateTime", "Core" );
__PACKAGE__->table("comment");
__PACKAGE__->add_columns(
"id",
{
data_type => "INT",
view all matches for this distribution
view release on metacpan or search on metacpan
build-from-git.md view on Meta::CPAN
a `TZ` environement variable. E.g run `dzil` this way:
TZ="Europe/Paris" dzil test
The list of possible timezones is provided by
[DateTime::TimeZone::Catalog](https://metacpan.org/pod/DateTime::TimeZone::Catalog)
documentation.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/datetime.pod view on Meta::CPAN
An alternative to the functional solutions described above is an
object-oriented solution that involves creating and manipulating
true "datetime" objects.
=head2 DateTime
http://datetime.perl.org/
http://datetime.perl.org/modules.html
http://search.cpan.org/~drolsky/DateTime/
http://search.cpan.org/~drolsky/DateTime/lib/DateTime.pm
The latest significant entrant (and quite promising) in the perl
date/time area is Datetime.pm. It attempts to be the definitive
date/time module for perl, building on the work of Time::Piece
and Class::Date.
Furthermore, the DateTime module is not alone. Rather, it is
part of a project where many date/time developers collaborate
for an entire framework of date/time modules.
* OO interface
* Parsing of dates provided by DateTime::Format::* modules
* Flexible formatting using POSIX strftime() format specifiers.
(formatting done automatically during object stringification)
* Limited internationalization support.
* Good date math support.
* Unknown support for dates outside [1970-2038]
view all matches for this distribution
view release on metacpan or search on metacpan
t/01_resolver.t view on Meta::CPAN
);
$resolver->read_cpanfile_requirements;
$resolver->merge_snapshot_versions('exact_version', 0);
is $resolver->get_version_range('DateTime'), '== 1.50';
is $resolver->get_version_range('JSON::XS'), '== 3.04';
is $resolver->get_version_range('Data::Printer'), '== 0.40';
is $resolver->get_version_range('Test::More'), undef;
# The version of core module is depends on interpreter version. So it's not fiexed.
t/01_resolver.t view on Meta::CPAN
);
$resolver->read_cpanfile_requirements;
$resolver->merge_snapshot_versions('add_minimum', 0);
is $resolver->get_version_range('DateTime'), '1.50';
is $resolver->get_version_range('JSON::XS'), '3.04';
is $resolver->get_version_range('Data::Printer'), '0.40';
is $resolver->get_version_range('Test::More'), undef;
};
t/01_resolver.t view on Meta::CPAN
);
$resolver->read_cpanfile_requirements;
$resolver->merge_snapshot_versions('add_maximum', 0);
is $resolver->get_version_range('DateTime'), '<= 1.50';
is $resolver->get_version_range('JSON::XS'), '<= 3.04';
is $resolver->get_version_range('Data::Printer'), '<= 0.40';
is $resolver->get_version_range('Test::More'), undef;
};
t/01_resolver.t view on Meta::CPAN
);
$resolver->read_cpanfile_requirements;
$resolver->merge_snapshot_versions('add_minimum', 0);
is $resolver->get_version_range('DateTime'), '1.50';
is $resolver->get_version_range('JSON::XS'), undef;
is $resolver->get_version_range('Data::Printer'), undef;
is $resolver->get_version_range('Test::More'), '0.99';
};
t/01_resolver.t view on Meta::CPAN
cpanfile => test_cpanfile('versioned'),
snapshot => test_snapshot('versioned'),
);
$resolver->read_cpanfile_requirements;
is $resolver->get_version_range('DateTime'), undef;
is $resolver->get_version_range('JSON::XS'), 3.00;
is $resolver->get_version_range('Data::Printer'), '== 0.38';
is $resolver->get_version_range('Test::More'), '> 0.9, < 1.0, != 0.98';
$resolver->merge_snapshot_versions('add_minimum', 0);
is $resolver->get_version_range('DateTime'), '1.50'; # inserted installed version as minimum
is $resolver->get_version_range('JSON::XS'), '3.04'; # updated installed version as minimum
is $resolver->get_version_range('Data::Printer'), '== 0.38'; # not changed
is $resolver->get_version_range('Test::More'), '>= 0.99, < 1.0'; # udpate and merged minimum version
};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/DBBrowser/GetContent/Filter.pm view on Meta::CPAN
my $fill_up_rows = 'Fill_up_Rows';
my $empty_to_null = ' Empty_2_null';
my $choose_cols = 'Choose_Columns';
my $append_col = 'Append_Columns';
my $cols_to_rows = 'Columns_to_Rows';
my $convert_date = 'Convert_DateTime';
my $s_and_replace = 'Search_&_Replace';
my $field_count = @{$sql->{insert_args}} * @{$sql->{insert_args}[0]};
my $bu_insert_args = [ map { [ @$_ ] } @{$sql->{insert_args}} ]; # copy the entire data
$sf->{empty_to_null} = $sf->{o}{insert}{empty_to_null_file};
my $working = $field_count > 500_000 ? 'Working ... ' : undef;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Dapper.pm view on Meta::CPAN
use Data::Dumper;
$Data::Dumper::Indent = 1;
$Data::Dumper::Sortkeys = 1;
use DateTime;
use DateTime::Format::XSD;
use App::Dapper::Serve;
use App::Dapper::Init;
use App::Dapper::Utils;
use App::Dapper::Defaults;
lib/App/Dapper.pm view on Meta::CPAN
layout => shift,
config => shift,
};
$self->{site} = App::Dapper::Defaults::get_defaults();
$self->{site}->{time} = DateTime->now( time_zone => DateTime::TimeZone->new( name => 'local' ) );
$self->{source} = "_source" unless defined($self->{source});
$self->{output} = "_output" unless defined($self->{output});
$self->{layout} = "_layout" unless defined($self->{layout});
$self->{config} = "_config.yml" unless defined($self->{config});
lib/App/Dapper.pm view on Meta::CPAN
$page{slug} = App::Dapper::Utils::slugify($page{title});
my $date;
if (not $page{date}) {
$date = DateTime::Format::XSD->parse_datetime(App::Dapper::Utils::get_modified_time($source_file_name));
# print "Didn't find date for $source_file_name. Setting to file modified date of $date\n";
$page{date} = $date;
} else {
$date = DateTime::Format::XSD->parse_datetime($page{date});
}
$page{date} = $date;
$page{year} = $date->year();
$page{month} = $date->month();
lib/App/Dapper.pm view on Meta::CPAN
# hour, minute or second is less than 10
$page{$_} < 10 and $page{$_} = '0' . $page{$_}
for ('year', 'month', 'day', 'hour', 'minute', 'second');
if(not $page{timezone}) {
$page{timezone} = DateTime::TimeZone->new( name => 'local' );
}
$page{url} = defined $page{urlpattern} ? $page{urlpattern} : $self->{site}->{urlpattern};
$page{url} =~ s/\:category/$page{categories}/g unless not defined $page{categories};
$page{url} =~ s/\:year/$page{year}/g unless not defined $page{year};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/DateUtils.pm view on Meta::CPAN
cmdline_aliases => {a=>{}},
},
);
my @parse_date_modules = (
#'DateTime::Format::Alami::EN',
#'DateTime::Format::Alami::ID',
'DateTime::Format::Flexible',
'DateTime::Format::Flexible(de)',
'DateTime::Format::Flexible(es)',
'DateTime::Format::Natural',
'Date::Parse',
);
my @parse_duration_modules = (
#'DateTime::Format::Alami::EN',
#'DateTime::Format::Alami::ID',
'DateTime::Format::Natural',
'Time::Duration::Parse',
);
$SPEC{parse_date} = {
v => 1.1,
summary => 'Parse date string(s) using one of several modules',
args => {
module => {
schema => ['str*', in=>\@parse_date_modules],
default => 'DateTime::Format::Flexible',
cmdline_aliases => {m=>{}},
},
%all_modules_arg,
%time_zone_arg,
%dates_arg,
lib/App/DateUtils.pm view on Meta::CPAN
argv => ['23 sep 2015','tomorrow','foo'],
},
],
};
sub parse_date {
require DateTime::Format::ISO8601::Format;
my %args = @_;
my %mods; # val = 1 if installed
if ($args{all_modules}) {
lib/App/DateUtils.pm view on Meta::CPAN
for my $mod (sort keys %mods) {
my $mod_is_installed = $mods{$mod};
my $parser;
if ($mod_is_installed) {
if ($mod eq 'DateTime::Format::Alami::EN') {
require DateTime::Format::Alami::EN;
$parser = DateTime::Format::Alami::EN->new(
( time_zone => $args{time_zone} ) x
!!(defined($args{time_zone})),
);
} elsif ($mod eq 'DateTime::Format::Alami::ID') {
require DateTime::Format::Alami::ID;
$parser = DateTime::Format::Alami::ID->new(
( time_zone => $args{time_zone} ) x
!!(defined($args{time_zone})),
);
} elsif ($mod =~ /^DateTime::Format::Flexible/) {
require DateTime::Format::Flexible;
$parser = DateTime::Format::Flexible->new(
);
} elsif ($mod eq 'DateTime::Format::Natural') {
require DateTime::Format::Natural;
$parser = DateTime::Format::Natural->new(
( time_zone => $args{time_zone} ) x
!!(defined($args{time_zone})),
);
} elsif ($mod eq 'Date::Parse') {
require Date::Parse;
require DateTime; # to show as_datetime_obj
} else {
return [400, "Unknown module '$mod'"];
}
}
lib/App/DateUtils.pm view on Meta::CPAN
my $rec = { original => $date, module => $mod };
unless ($mod_is_installed) {
$rec->{error_msg} = "module not installed";
goto PUSH_RESULT;
}
if ($mod =~ /^DateTime::Format::Alami/) {
my $res;
eval { $res = $parser->parse_datetime($date, {format=>'combined'}) };
if ($@) {
$rec->{is_parseable} = 0;
} else {
$rec->{is_parseable} = 1;
$rec->{as_epoch} = $res->{epoch};
$rec->{as_datetime_obj} = "$res->{DateTime}";
$rec->{as_datetime_obj_tz_local} = DateTime::Format::ISO8601::Format->new->format_datetime($res->{DateTime}->set_time_zone("local"));
$rec->{as_datetime_obj_tz_utc} = DateTime::Format::ISO8601::Format->new->format_datetime($res->{DateTime}->set_time_zone("UTC"));
$rec->{pattern} = $res->{pattern};
}
} elsif ($mod =~ /^DateTime::Format::Flexible/) {
my $dt;
my %opts;
$opts{lang} = [$1] if $mod =~ /\((\w+)\)$/;
eval { $dt = $parser->parse_datetime(
$date,
lib/App/DateUtils.pm view on Meta::CPAN
my $err = $@;
if (!$err) {
$rec->{is_parseable} = 1;
$rec->{as_epoch} = $dt->epoch;
$rec->{as_datetime_obj} = "$dt";
$rec->{as_datetime_obj_tz_local} = DateTime::Format::ISO8601::Format->new->format_datetime($dt->set_time_zone("local"));
$rec->{as_datetime_obj_tz_utc} = DateTime::Format::ISO8601::Format->new->format_datetime($dt->set_time_zone("UTC"));
} else {
$err =~ s/\n/ /g;
$rec->{is_parseable} = 0;
$rec->{error_msg} = $err;
}
} elsif ($mod =~ /^DateTime::Format::Natural/) {
my $dt = $parser->parse_datetime($date);
if ($parser->success) {
$rec->{is_parseable} = 1;
$rec->{as_epoch} = $dt->epoch;
$rec->{as_datetime_obj} = "$dt";
$rec->{as_datetime_obj_tz_local} = DateTime::Format::ISO8601::Format->new->format_datetime($dt->set_time_zone("local"));
$rec->{as_datetime_obj_tz_utc} = DateTime::Format::ISO8601::Format->new->format_datetime($dt->set_time_zone("UTC"));
} else {
$rec->{is_parseable} = 0;
$rec->{error_msg} = $parser->error;
}
} elsif ($mod eq 'Date::Parse') {
my $time = Date::Parse::str2time($date);
if (defined $time) {
$rec->{is_parseable} = 1;
$rec->{as_epoch} = $time;
my $dt = DateTime->from_epoch(epoch => $time);
$rec->{as_datetime_obj} = "$dt";
$rec->{as_datetime_obj_tz_local} = DateTime::Format::ISO8601::Format->new->format_datetime($dt->set_time_zone("local"));
$rec->{as_datetime_obj_tz_utc} = DateTime::Format::ISO8601::Format->new->format_datetime($dt->set_time_zone("UTC"));
} else {
$rec->{is_parseable} = 0;
}
}
PUSH_RESULT:
lib/App/DateUtils.pm view on Meta::CPAN
[200, "OK", \@res, {'table.fields'=>[qw/module original is_parseable as_epoch as_datetime_obj as_datetime_obj_tz_local as_datetime_obj_tz_utc error_msg/]}];
}
$SPEC{parse_date_using_df_flexible} = {
v => 1.1,
summary => 'Parse date string(s) using DateTime::Format::Flexible',
args => {
%time_zone_arg,
%dates_arg,
lang => {
schema => ['str*', in=>[qw/de en es/]],
lib/App/DateUtils.pm view on Meta::CPAN
],
};
sub parse_date_using_df_flexible {
my %args = @_;
my $lang = $args{lang};
my $module = 'DateTime::Format::Flexible';
$module .= "(de)" if $lang eq 'de';
$module .= "(es)" if $lang eq 'es';
parse_date(module=>$module, %args);
}
$SPEC{parse_date_using_df_natural} = {
v => 1.1,
summary => 'Parse date string(s) using DateTime::Format::Natural',
args => {
%time_zone_arg,
%dates_arg,
},
examples => [
{args => {dates => ['23rd Jun']}},
{args => {dates => ['foo']}},
],
links => [
{summary => 'The official CLI for DateTime::Format::Natural', url=>'dateparse'},
],
};
sub parse_date_using_df_natural {
my %args = @_;
parse_date(module=>'DateTime::Format::Natural', %args);
}
$SPEC{parse_date_using_df_alami_en} = {
v => 1.1,
summary => 'Parse date string(s) using DateTime::Format::Alami::EN',
args => {
%time_zone_arg,
%dates_arg,
},
examples => [
lib/App/DateUtils.pm view on Meta::CPAN
{args => {dates => ['foo']}},
],
};
sub parse_date_using_df_alami_en {
my %args = @_;
parse_date(module=>'DateTime::Format::Alami::EN', %args);
}
$SPEC{parse_date_using_df_alami_id} = {
v => 1.1,
summary => 'Parse date string(s) using DateTime::Format::Alami::ID',
args => {
%time_zone_arg,
%dates_arg,
},
examples => [
lib/App/DateUtils.pm view on Meta::CPAN
{args => {dates => ['foo']}},
],
};
sub parse_date_using_df_alami_id {
my %args = @_;
parse_date(module=>'DateTime::Format::Alami::ID', %args);
}
$SPEC{parse_duration} = {
v => 1.1,
summary => 'Parse duration string(s) using one of several modules',
lib/App/DateUtils.pm view on Meta::CPAN
for my $mod (sort keys %mods) {
my $mod_is_installed = $mods{$mod};
my $parser;
if ($mod_is_installed) {
if ($mod eq 'DateTime::Format::Alami::EN') {
require DateTime::Format::Alami::EN;
$parser = DateTime::Format::Alami::EN->new();
} elsif ($mod eq 'DateTime::Format::Alami::ID') {
require DateTime::Format::Alami::ID;
$parser = DateTime::Format::Alami::ID->new();
} elsif ($mod eq 'DateTime::Format::Natural') {
require DateTime::Format::Natural;
$parser = DateTime::Format::Natural->new();
} elsif ($mod eq 'Time::Duration::Parse') {
require Time::Duration::Parse;
}
}
lib/App/DateUtils.pm view on Meta::CPAN
my $rec = { original => $dur, module => $mod };
unless ($mod_is_installed) {
$rec->{error_msg} = "module not installed";
goto PUSH_RESULT;
}
if ($mod =~ /^DateTime::Format::Alami/) {
my $res;
eval { $res = $parser->parse_datetime_duration($dur, {format=>'combined'}) };
if ($@) {
$rec->{is_parseable} = 0;
} else {
require DateTime::Format::Duration::ISO8601;
my $dtdurf = DateTime::Format::Duration::ISO8601->new;
$rec->{is_parseable} = 1;
$rec->{as_dtdur_obj} = $dtdurf->format_duration($res->{Duration});
$rec->{as_secs} = $res->{seconds};
}
} elsif ($mod =~ /^DateTime::Format::Natural/) {
my @dt = $parser->parse_datetime_duration($dur);
if (@dt > 1) {
require DateTime::Format::Duration::ISO8601;
my $dtdurf = DateTime::Format::Duration::ISO8601->new;
my $dtdur = $dt[1]->subtract_datetime($dt[0]);
$rec->{is_parseable} = 1;
$rec->{date1} = "$dt[0]";
$rec->{date2} = "$dt[1]";
$rec->{as_dtdur_obj} = $dtdurf->format_duration($dtdur);
lib/App/DateUtils.pm view on Meta::CPAN
[200, "OK", \@res, {'table.fields'=>[qw/module original is_parseable as_secs as_dtdur_obj error_msg/]}];
}
$SPEC{parse_duration_using_df_alami_en} = {
v => 1.1,
summary => 'Parse duration string(s) using DateTime::Format::Alami::EN',
args => {
%durations_arg,
},
examples => [
{args => {durations => ['2h, 3mins']}},
{args => {durations => ['foo']}},
],
};
sub parse_duration_using_df_alami_en {
my %args = @_;
parse_duration(module=>'DateTime::Format::Alami::EN', %args);
}
$SPEC{parse_duration_using_df_alami_id} = {
v => 1.1,
summary => 'Parse duration string(s) using DateTime::Format::Alami::ID',
args => {
%durations_arg,
},
examples => [
{args => {durations => ['2j, 3mnt']}},
{args => {durations => ['foo']}},
],
};
sub parse_duration_using_df_alami_id {
my %args = @_;
parse_duration(module=>'DateTime::Format::Alami::ID', %args);
}
$SPEC{parse_duration_using_df_natural} = {
v => 1.1,
summary => 'Parse duration string(s) using DateTime::Format::Natural',
args => {
%durations_arg,
},
examples => [
{args => {durations => ['for 2 weeks']}},
lib/App/DateUtils.pm view on Meta::CPAN
{args => {durations => ['foo']}},
],
};
sub parse_duration_using_df_natural {
my %args = @_;
parse_duration(module=>'DateTime::Format::Natural', %args);
}
$SPEC{parse_duration_using_td_parse} = {
v => 1.1,
summary => 'Parse duration string(s) using Time::Duration::Parse',
lib/App/DateUtils.pm view on Meta::CPAN
v => 1.1,
summary => 'Convert date from one format to another',
args => {
date => {
schema => ['date*', {
'x.perl.coerce_to' => 'DateTime',
'x.perl.coerce_rules' => ['From_str::iso8601', 'From_str::natural'],
}],
req => 1,
pos => 0,
},
lib/App/DateUtils.pm view on Meta::CPAN
if ($to eq 'epoch') {
return $date->epoch;
} elsif ($to eq 'ymd') {
return $date->ymd;
} elsif ($to eq 'iso8601') {
require DateTime::Format::ISO8601::Format;
return DateTime::Format::ISO8601::Format->new->format_datetime($date);
} elsif ($to eq 'ALL') {
return {
epoch => $date->epoch,
ymd => $date->ymd,
iso8601 => do {
require DateTime::Format::ISO8601::Format;
DateTime::Format::ISO8601::Format->new->format_datetime($date);
},
};
} else {
die "Unknown format '$to'";
}
lib/App/DateUtils.pm view on Meta::CPAN
req => 1,
pos => 0,
},
date => {
schema => ['date*', {
'x.perl.coerce_to' => 'DateTime',
'x.perl.coerce_rules' => ['From_str::iso8601', 'From_str::natural'],
}],
pos => 1,
},
},
lib/App/DateUtils.pm view on Meta::CPAN
test => 0,
},
],
};
sub strftime {
require DateTime;
require POSIX;
my %args = @_;
my $format = $args{format};
my $date = $args{date} // DateTime->now;
POSIX::strftime($format, localtime($date->epoch));
}
$SPEC{strftimeq} = {
lib/App/DateUtils.pm view on Meta::CPAN
req => 1,
pos => 0,
},
date => {
schema => ['date*', {
'x.perl.coerce_to' => 'DateTime',
'x.perl.coerce_rules' => ['From_str::iso8601', 'From_str::natural'],
}],
pos => 1,
},
},
lib/App/DateUtils.pm view on Meta::CPAN
test => 0,
},
],
};
sub strftimeq {
require DateTime;
require Date::strftimeq;
require POSIX;
my %args = @_;
my $format = $args{format};
my $date = $args{date} // DateTime->now;
Date::strftimeq::strftimeq($format, localtime($date->epoch));
}
$SPEC{durconv} = {
v => 1.1,
summary => 'Convert duration from one format to another',
args => {
duration => {
schema => ['duration*', {
'x.perl.coerce_to' => 'DateTime::Duration',
}],
req => 1,
pos => 0,
},
to => {
lib/App/DateUtils.pm view on Meta::CPAN
}
return $h;
};
my $code_iso8601 = sub {
require DateTime::Format::Duration::ISO8601;
DateTime::Format::Duration::ISO8601->new->format_duration($dur);
};
if ($to eq 'secs') {
return $code_secs->();
} elsif ($to eq 'hash') {
lib/App/DateUtils.pm view on Meta::CPAN
summary => 'Diff (subtract) two dates, show as ISO8601 duration',
args => {
date1 => {
schema => ['date*', {
'x.perl.coerce_rules' => ['From_str::natural','From_str::iso8601','From_float::epoch'],
'x.perl.coerce_to' => 'DateTime',
}],
req => 1,
pos => 0,
},
date2 => {
schema => ['date*', {
'x.perl.coerce_rules' => ['From_str::natural','From_str::iso8601','From_float::epoch'],
'x.perl.coerce_to' => 'DateTime',
}],
req => 1,
pos => 1,
},
as => {
lib/App/DateUtils.pm view on Meta::CPAN
$dur->days * 86400 +
$dur->hours * 3600 +
$dur->minutes * 60 +
$dur->seconds;
} elsif ($as eq 'concise_hms' || $as eq 'hms') {
require DateTime::Format::Duration::ConciseHMS;
DateTime::Format::Duration::ConciseHMS->format_duration($dur);
} else {
require DateTime::Format::Duration::ISO8601;
DateTime::Format::Duration::ISO8601->format_duration($dur);
}
}
1;
# ABSTRACT: An assortment of date-/time-related CLI utilities
lib/App/DateUtils.pm view on Meta::CPAN
[
200,
"OK",
[
{
module => "DateTime::Format::Flexible",
original => "23 sep 2015",
is_parseable => 1,
as_epoch => 1442966400,
as_datetime_obj => "2015-09-23T00:00:00",
as_datetime_obj_tz_local => "2015-09-23T00:00:00+07:00",
as_datetime_obj_tz_utc => "2015-09-22T17:00:00Z",
},
{
module => "DateTime::Format::Flexible",
original => "tomorrow",
is_parseable => 1,
as_epoch => 1709856000,
as_datetime_obj => "2024-03-08T00:00:00",
as_datetime_obj_tz_local => "2024-03-08T00:00:00+07:00",
as_datetime_obj_tz_utc => "2024-03-07T17:00:00Z",
},
{
module => "DateTime::Format::Flexible",
original => "foo",
is_parseable => 0,
error_msg => "Invalid date format: foo at /home/u1/perl5/perlbrew/perls/perl-5.38.2/lib/site_perl/5.38.2/Perinci/Access.pm line 81. ",
},
],
lib/App/DateUtils.pm view on Meta::CPAN
=item * B<dates>* => I<array[str]>
(No description)
=item * B<module> => I<str> (default: "DateTime::Format::Flexible")
(No description)
=item * B<time_zone> => I<str>
lib/App/DateUtils.pm view on Meta::CPAN
Usage:
parse_date_using_df_alami_en(%args) -> [$status_code, $reason, $payload, \%result_meta]
Parse date string(s) using DateTime::Format::Alami::EN.
Examples:
=over
lib/App/DateUtils.pm view on Meta::CPAN
[
200,
"OK",
[
{
module => "DateTime::Format::Alami::EN",
original => "23 May",
is_parseable => 1,
as_epoch => 1716422400,
as_datetime_obj => "2024-05-23T00:00:00",
as_datetime_obj_tz_local => "2024-05-23T07:00:00+07:00",
lib/App/DateUtils.pm view on Meta::CPAN
[
200,
"OK",
[
{
module => "DateTime::Format::Alami::EN",
original => "foo",
is_parseable => 0,
},
],
{
lib/App/DateUtils.pm view on Meta::CPAN
Usage:
parse_date_using_df_alami_id(%args) -> [$status_code, $reason, $payload, \%result_meta]
Parse date string(s) using DateTime::Format::Alami::ID.
Examples:
=over
lib/App/DateUtils.pm view on Meta::CPAN
[
200,
"OK",
[
{
module => "DateTime::Format::Alami::ID",
original => "23 Mei",
is_parseable => 1,
as_epoch => 1716422400,
as_datetime_obj => "2024-05-23T00:00:00",
as_datetime_obj_tz_local => "2024-05-23T07:00:00+07:00",
lib/App/DateUtils.pm view on Meta::CPAN
[
200,
"OK",
[
{
module => "DateTime::Format::Alami::ID",
original => "foo",
is_parseable => 0,
},
],
{
lib/App/DateUtils.pm view on Meta::CPAN
Usage:
parse_date_using_df_flexible(%args) -> [$status_code, $reason, $payload, \%result_meta]
Parse date string(s) using DateTime::Format::Flexible.
Examples:
=over
lib/App/DateUtils.pm view on Meta::CPAN
[
200,
"OK",
[
{
module => "DateTime::Format::Flexible",
original => "23rd Jun",
is_parseable => 1,
as_epoch => 1719100800,
as_datetime_obj => "2024-06-23T00:00:00",
as_datetime_obj_tz_local => "2024-06-23T00:00:00+07:00",
lib/App/DateUtils.pm view on Meta::CPAN
[
200,
"OK",
[
{
module => "DateTime::Format::Flexible(de)",
original => "23 Dez",
is_parseable => 1,
as_epoch => 1734912000,
as_datetime_obj => "2024-12-23T00:00:00",
as_datetime_obj_tz_local => "2024-12-23T00:00:00+07:00",
lib/App/DateUtils.pm view on Meta::CPAN
[
200,
"OK",
[
{
module => "DateTime::Format::Flexible",
original => "foo",
is_parseable => 0,
error_msg => "Invalid date format: foo at /home/u1/perl5/perlbrew/perls/perl-5.38.2/lib/site_perl/5.38.2/Perinci/Access.pm line 81. ",
},
],
lib/App/DateUtils.pm view on Meta::CPAN
Usage:
parse_date_using_df_natural(%args) -> [$status_code, $reason, $payload, \%result_meta]
Parse date string(s) using DateTime::Format::Natural.
Examples:
=over
lib/App/DateUtils.pm view on Meta::CPAN
[
200,
"OK",
[
{
module => "DateTime::Format::Natural",
original => "23rd Jun",
is_parseable => 1,
as_epoch => 1719100800,
as_datetime_obj => "2024-06-23T00:00:00",
as_datetime_obj_tz_local => "2024-06-23T00:00:00+07:00",
lib/App/DateUtils.pm view on Meta::CPAN
[
200,
"OK",
[
{
module => "DateTime::Format::Natural",
original => "foo",
is_parseable => 0,
error_msg => "'foo' does not parse (perhaps you have some garbage?)",
},
],
lib/App/DateUtils.pm view on Meta::CPAN
Usage:
parse_duration_using_df_alami_en(%args) -> [$status_code, $reason, $payload, \%result_meta]
Parse duration string(s) using DateTime::Format::Alami::EN.
Examples:
=over
lib/App/DateUtils.pm view on Meta::CPAN
[
200,
"OK",
[
{
module => "DateTime::Format::Alami::EN",
original => "2h, 3mins",
is_parseable => 1,
as_secs => 7380,
as_dtdur_obj => "PT2H3M",
},
lib/App/DateUtils.pm view on Meta::CPAN
[
200,
"OK",
[
{
module => "DateTime::Format::Alami::EN",
original => "foo",
is_parseable => 0,
},
],
{
lib/App/DateUtils.pm view on Meta::CPAN
Usage:
parse_duration_using_df_alami_id(%args) -> [$status_code, $reason, $payload, \%result_meta]
Parse duration string(s) using DateTime::Format::Alami::ID.
Examples:
=over
lib/App/DateUtils.pm view on Meta::CPAN
[
200,
"OK",
[
{
module => "DateTime::Format::Alami::ID",
original => "2j, 3mnt",
is_parseable => 1,
as_secs => 7380,
as_dtdur_obj => "PT2H3M",
},
lib/App/DateUtils.pm view on Meta::CPAN
[
200,
"OK",
[
{
module => "DateTime::Format::Alami::ID",
original => "foo",
is_parseable => 0,
},
],
{
lib/App/DateUtils.pm view on Meta::CPAN
Usage:
parse_duration_using_df_natural(%args) -> [$status_code, $reason, $payload, \%result_meta]
Parse duration string(s) using DateTime::Format::Natural.
Examples:
=over
lib/App/DateUtils.pm view on Meta::CPAN
[
200,
"OK",
[
{
module => "DateTime::Format::Natural",
original => "for 2 weeks",
is_parseable => 1,
as_secs => 1209600.000768,
as_dtdur_obj => "P14DT0.000768S",
date2 => "2024-03-21T09:10:21",
lib/App/DateUtils.pm view on Meta::CPAN
[
200,
"OK",
[
{
module => "DateTime::Format::Natural",
original => "from 23 Jun to 29 Jun",
is_parseable => 1,
as_secs => 9757178.285926,
as_dtdur_obj => "P3M21DT14H49M38.285926S",
date1 => "2024-03-07T09:10:21",
lib/App/DateUtils.pm view on Meta::CPAN
[
200,
"OK",
[
{
module => "DateTime::Format::Natural",
original => "foo",
is_parseable => 0,
error_msg => "'foo' does not parse (perhaps you have some garbage?)",
},
],
view all matches for this distribution
view release on metacpan or search on metacpan
t/data/generate/wallet/docknot.yaml view on Meta::CPAN
* DBIx::Class
* Module::Build
* SQL::Translator
You will also need a DBD Perl module for the database backend that you
intend to use, and the DateTime::Format::* module corresponding to that
DBD module (such as DateTime::Format::SQLite or DateTime::Format::PG).
Currently, the server has only been tested against SQLite 3, MySQL 5, and
PostgreSQL, and prebuilt SQL files (for database upgrades) are only
provided for those servers. It will probably not work fully with other
database backends. Porting is welcome.
t/data/generate/wallet/docknot.yaml view on Meta::CPAN
path. The test suite will also need to be able to bind to 127.0.0.1 on
ports 11119 and 14373 to test client/server network interactions.
The test suite uses a SQLite database for server-side and end-to-end
testing and therefore requires the DBD::SQLite and
DateTime::Format::SQLite Perl modules.
All of the requirements listed above will be required to run the full test
suite of server functionality, but tests will be selectively skipped if
their requirements aren't found.
view all matches for this distribution
view release on metacpan or search on metacpan
scripts/es-alias-manager.pl view on Meta::CPAN
use strict;
use warnings;
use App::ElasticSearch::Utilities qw(:default);
use CLI::Helpers qw(:all);
use DateTime;
use Getopt::Long qw(:config no_ignore_case no_ignore_case_always);
use Pod::Usage;
use Ref::Util qw( is_ref );
use YAML::XS ();
scripts/es-alias-manager.pl view on Meta::CPAN
# Grab a connection to ElasticSearch
my $es = es_connect();
# Delete Indexes older than a certain point
my $TODAY = DateTime->now()->truncate( to => 'day' );
my $indices = es_request('_aliases');
if ( !defined $indices ) {
output({color=>"red"}, "Unable to locate indices by get_aliases()!");
exit 1;
scripts/es-alias-manager.pl view on Meta::CPAN
if (exists $ALIAS->{$base}{relative}) {
$ALIAS->{$base}{relative}{alias} =~ s/\{\{([^\}]+)\}\}/$PARTS{$1}->{FMT}/g;
while( my ($period,$def) = each %{ $ALIAS->{$base}{relative}{periods} }) {
my %dt = (
to => $TODAY->clone(),
from => exists $def->{from} ? $TODAY->clone() : DateTime->from_epoch(epoch => 0)->truncate( to => 'day'),
);
debug("Period[$period] subtracting: ");
debug_var($def);
foreach my $d (keys %dt) {
if ( exists $def->{$d} ) {
scripts/es-alias-manager.pl view on Meta::CPAN
my %desired = ();
while( my($name,$map) = each %{ $ALIAS }) {
if ($index =~ /$map->{re}/) {
$managed++;
my $idx_dt = DateTime->new( map { $_ => $+{$_} } qw(year month day) );
verbose("$index is a $name index.");
if ( exists $map->{daily} ) {
my $daily = $idx_dt->strftime($map->{daily});
$desired{$daily} = 1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/FQStat/Scanner.pm view on Meta::CPAN
use strict;
use warnings;
use Time::HiRes qw/sleep/;
use String::Trigram ();
use DateTime ();
use Time::Zone ();
use App::FQStat::Debug;
# run qstat
sub run_qstat {
lib/App/FQStat/Scanner.pm view on Meta::CPAN
}
if ($job->[::F_status] =~ /^h?[rt]$/) {
my ($day, $month, $year) = split /\./, $job->[::F_date];
my ($hour, $minute, $second) = split /:/, $job->[::F_time];
my $dt = DateTime->new(year => $year, month => $month, day => $day,
hour => $hour, minute => $minute, second => $second);
my $runtime = $curtime - $dt->epoch();
$runtime_sum += $runtime;
$max_runtime = $runtime if $runtime > $max_runtime;
$njobs_started++;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/FormatCPANChanges/PERLANCAR.pm view on Meta::CPAN
},
},
};
sub format_cpan_changes_perlancar {
require App::ParseCPANChanges;
#require DateTime::Format::Alami::EN;
require Text::Wrap;
my %args = @_;
my $res = App::ParseCPANChanges::parse_cpan_changes(file => $args{file});
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Fotagger/Image.pm view on Meta::CPAN
use strict;
use warnings;
use 5.010;
use Moose;
use DateTime;
use DateTime::Format::Strptime;
use Image::ExifTool;
has 'file' => ( isa => 'Str', is => 'ro', required=>1 );
has 'exif' => (isa=>'Image::ExifTool',is=>'rw');
has 'tags' => (isa=>'Str',is=>'rw');
has 'stars' => (isa=>'Int',is=>'rw');
has 'create_date' => (isa=>'Str',is=>'rw');
has 'width' => (isa=>'Int',is=>'rw');
has 'dateparser' => (isa=>'DateTime::Format::Strptime',is=>'ro',required=>1,default=>sub {DateTime::Format::Strptime->new(pattern=>'%Y:%m:%d %H:%M:%S');
});
no Moose;
__PACKAGE__->meta->make_immutable;
view all matches for this distribution
view release on metacpan or search on metacpan
script/_genpass-id view on Meta::CPAN
# clone_and_clean_json
# );
#
#sub new {
# my ($class, %opts) = @_;
# $opts{DateTime} //= [call_method => 'epoch'];
# $opts{'Time::Moment'} //= [call_method => 'epoch'];
# $opts{'Math::BigInt'} //= [call_method => 'bstr'];
# $opts{Regexp} //= ['stringify'];
# $opts{version} //= ['stringify'];
#
view all matches for this distribution
view release on metacpan or search on metacpan
script/_genpass-wordlist view on Meta::CPAN
# clone_and_clean_json
# );
#
#sub new {
# my ($class, %opts) = @_;
# $opts{DateTime} //= [call_method => 'epoch'];
# $opts{'Time::Moment'} //= [call_method => 'epoch'];
# $opts{'Math::BigInt'} //= [call_method => 'bstr'];
# $opts{Regexp} //= ['stringify'];
# $opts{version} //= ['stringify'];
#
view all matches for this distribution
view release on metacpan or search on metacpan
"Test::Pod::Coverage" : "1.08"
}
},
"runtime" : {
"requires" : {
"DateTime" : "0",
"Encode" : "0",
"Getopt::Long::Descriptive" : "0",
"List::AllUtils" : "0",
"Math::Round" : "0",
"Term::Spark" : "0",
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Git/Workflow/Command/BranchAge.pm view on Meta::CPAN
use English qw/ -no_match_vars /;
use List::MoreUtils qw/zip/;
use Term::ANSIColor qw/colored/;
use App::Git::Workflow;
use App::Git::Workflow::Command qw/get_options/;
use DateTime::Format::HTTP;
use Data::Dumper qw/Dumper/;
our $VERSION = version->new(1.1.20);
our $workflow = App::Git::Workflow->new;
our ($name) = $PROGRAM_NAME =~ m{^.*/(.*?)$}mxs;
lib/App/Git/Workflow/Command/BranchAge.pm view on Meta::CPAN
}
}
my ($date, $tz) = $branch->{authordate} =~ /^(.*)\s+([+-]\d{4})$/;
if ($date && $tz) {
$branch->{age} = DateTime::Format::HTTP->parse_datetime($date, $tz)->iso8601;
}
else {
$Data::Dumper::Sortkeys = 1;
$Data::Dumper::Indent = 1;
die Dumper $branch;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Glacier/Command.pm view on Meta::CPAN
sub set_time_style_option {
my ($self, $style) = @_;
eval {
use App::Glacier::DateTime;
my $x = new App::Glacier::DateTime(year=>1970);
$x->canned_format($style);
};
if ($@) {
$self->abend(EX_USAGE, "unrecognized time style: $style");
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/GnuCash/Schema.pm view on Meta::CPAN
=head1 DESCRIPTION
This module and all the GnuCash::Schema::Result modules were auto generated
by running the following:
dbicdump -o dump_directory=./lib -o components='["InflateColumn::DateTime"]' GnuCash::Schema dbi::SQLite:/path/to/sample.gnucash
=cut
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/GoogleSearchUtils.pm view on Meta::CPAN
summary => 'Number of results per page',
schema => 'posint*',
default => 100,
},
time_start => {
schema => ['date*', 'x.perl.coerce_rules' => ['From_str::natural'], 'x.perl.coerce_to'=>'DateTime'],
tags => ['category:time-period-criteria'],
},
time_end => {
schema => ['date*', 'x.perl.coerce_rules' => ['From_str::natural'], 'x.perl.coerce_to'=>'DateTime'],
tags => ['category:time-period-criteria'],
},
time_past => {
summary => 'Limit time period to the past hour/24hour/week/month/year',
schema => ['str*', in=>[qw/hour 24hour day week month year/]],
view all matches for this distribution
view release on metacpan or search on metacpan
},
module_name => 'App::Hashl',
license => 'unrestricted',
requires => {
'perl' => '5.10.0',
'DateTime' => 0,
'Digest::SHA' => 0,
'File::Copy' => 0,
'File::Find' => 0,
'Getopt::Long' => 0,
'IO::Handle' => 0,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/HistHub/Schema/HistQueue.pm view on Meta::CPAN
package App::HistHub::Schema::HistQueue;
use strict;
use warnings;
use DateTime;
__PACKAGE__->belongs_to( peer => 'App::HistHub::Schema::Peer' );
__PACKAGE__->inflate_column(
timestamp => {
inflate => sub { DateTime->from_epoch( epoch => shift ) },
deflate => sub { shift->epoch },
},
);
sub insert {
my $self = shift;
$self->timestamp( DateTime->now ) unless $self->timestamp;
$self->next::method(@_);
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/I18N/Command/Gen.pm view on Meta::CPAN
use App::I18N::Config;
use App::I18N::Logger;
use File::Basename;
use File::Path qw(mkpath);
use File::Find::Rule;
use DateTime;
use base qw(App::I18N::Command);
sub options { (
'podir=s' => 'podir',
'locale' => 'locale',
lib/App/I18N/Command/Gen.pm view on Meta::CPAN
=cut
sub _warnings {
my $now = DateTime->now;
return <<END;
THIS FILE IS AUTO-GENERATED BY APP::I18N, PLEASE DONT MODIFY THIS DIRECTLY.
YOU SHOULD MODIFY PO FILES.
LAST UPDATE: $now
END
view all matches for this distribution