view release on metacpan or search on metacpan
lib/App/TimeTracker/Command/Billing.pm view on Meta::CPAN
use strict;
use warnings;
use 5.010;
use Moose::Role;
use DateTime;
sub munge_billing_start_attribs {
my ( $class, $meta, $config ) = @_;
my $billing = $config->{billing};
my %attr = (
lib/App/TimeTracker/Command/Billing.pm view on Meta::CPAN
if ( my $default = $billing->{default} ) {
if ( $default eq 'strftime' ) {
my $format = $billing->{strftime};
$attr{default} = sub {
return DateTime->now->strftime($format);
}
}
}
$meta->add_attribute( 'billing' => \%attr );
lib/App/TimeTracker/Command/Billing.pm view on Meta::CPAN
Set to the method to calculate the default billing point. Currently there is only one method implemented, C<strftime>
=head3 strftime
When using C<default = strftime>, specify the L<DateTime::strftime> format. Some examples:
=over
=item * C<%Y/%m> -> 2019/12
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/TimeZoneUtils.pm view on Meta::CPAN
$SPEC{detect_local_time_zone} = {
v => 1.1,
summary => 'Detect local time zone',
description => <<'_',
Currently uses <pm:DateTime::TimeZone>, which has several heuristics itself
(please see the module for more details). When local time zone cannot be
determined, it dies.
_
args => {
},
examples => [
],
};
sub detect_local_time_zone {
require DateTime;
require DateTime::TimeZone;
my %args = @_;
my $tz = DateTime::TimeZone->new(name => "local");
my $dt = DateTime->now(time_zone => "UTC");
my $offset_in_seconds = $tz->offset_for_datetime($dt);
my $offset_abs = abs($offset_in_seconds);
my $offset_sign = $offset_in_seconds > 0 ? "+" : "-";
my $offset_h = int($offset_abs / 3600);
my $offset_m = int(($offset_abs - $offset_h*3600)/60);
lib/App/TimeZoneUtils.pm view on Meta::CPAN
detect_local_time_zone() -> [$status_code, $reason, $payload, \%result_meta]
Detect local time zone.
Currently uses L<DateTime::TimeZone>, which has several heuristics itself
(please see the module for more details). When local time zone cannot be
determined, it dies.
This function is not exported.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Twimap/Tweet.pm view on Meta::CPAN
package App::Twimap::Tweet;
use Moose;
use DateTime;
use DateTime::Format::Strptime;
use Email::Date::Format qw(email_date);
use HTML::Entities;
use Text::Wrap qw(wrap);
has 'data' => ( is => 'ro', isa => 'HashRef', required => 1 );
has 'expand_urls' => ( is => 'ro', isa => 'Bool', default => 1 );
has 'oembed_urls' => ( is => 'ro', isa => 'Bool', default => 1 );
my $_parser = DateTime::Format::Strptime->new(
pattern => '%a %b %d %T %z %Y',
locale => 'en_GB',
on_error => 'croak',
);
view all matches for this distribution
view release on metacpan or search on metacpan
"ExtUtils::MakeMaker" : "6.31"
}
},
"runtime" : {
"requires" : {
"DateTime" : "0.66",
"Encode" : "2.42",
"Encode::Detect" : "1.01",
"HTML::ExtractContent" : "0.10",
"IO::All" : "0.41",
"JSON" : "2.5",
view all matches for this distribution
view release on metacpan or search on metacpan
0.31 20110318
- POD fixes.
- Migration to Module::Install for easier building.
0.32 20110320
- Removal of namespace::autoclean dependency for easier building.
- Removal of DateTime dependency for easier building.
- Migration to Mouse for easier building and size.
0.33 20110321
- Fix cornercase base == 0.
- Fix cornercase servername eq ''.
0.34 20110322
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/WHMCSUtils.pm view on Meta::CPAN
_
args => {
%args_db,
date_start => {
summary => 'Start from this date (based on invoice payment date)',
schema => ['date*', 'x.perl.coerce_to' => 'DateTime'],
tags => ['category:filtering'],
},
date_end => {
summary => 'End at this date (based on invoice payment date)',
schema => ['date*', 'x.perl.coerce_to' => 'DateTime'],
tags => ['category:filtering'],
},
date_old_limit => {
summary => 'Set what date will be considered too old to recognize item as revenue',
schema => ['date*', 'x.perl.coerce_to' => 'DateTime'],
description => <<'_',
Default is 2008-01-01.
_
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/WebSearchUtils.pm view on Meta::CPAN
num => {
summary => 'Number of results per page',
schema => 'posint*',
},
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
lib/App/Zapzi/Database/Schema/Article.pm view on Meta::CPAN
use warnings;
our $VERSION = '0.017'; # VERSION
use base 'DBIx::Class::Core';
use DateTime::Format::SQLite;
__PACKAGE__->load_components(qw/InflateColumn::DateTime/);
__PACKAGE__->table("articles");
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/ZodiacUtils.pm view on Meta::CPAN
our %SPEC;
my $sch_array_of_dates = ['array*', {
of=>['date*', {
'x.perl.coerce_to' => 'DateTime',
'x.perl.coerce_rules'=>['From_str::natural'],
}],
min_len=>1,
}];
lib/App/ZodiacUtils.pm view on Meta::CPAN
# when coerced to float(epoch)
#my @lt = localtime($date);
#my $ymd = sprintf("%04d-%02d-%02d", $lt[5]+1900, $lt[4]+1, $lt[3]);
# when coerced to DateTime
my $ymd = $date->ymd;
my $z = Zodiac::Tiny::zodiac_of($ymd);
push @$res, @$dates > 1 ? [$ymd, $z] : $z;
}
lib/App/ZodiacUtils.pm view on Meta::CPAN
# when coerced to float(epoch)
#my @lt = localtime($date);
#my $ymd = sprintf("%04d-%02d-%02d", $lt[5]+1900, $lt[4]+1, $lt[3]);
# when coerced to DateTime
my $ymd = $date->ymd;
my $czres = Zodiac::Chinese::Table::chinese_zodiac($ymd);
my $z = $czres ? "$czres->[7] ($czres->[3])" : undef;
push @$res, @$dates > 1 ? [$ymd, $z] : $z;
view all matches for this distribution
view release on metacpan or search on metacpan
# $_sahv_dpath = [];
# ((defined($args->{"delay"})) ? 1 : (($_sahv_err //= (@$_sahv_dpath ? '@'.join("",map {"[$_]"} @$_sahv_dpath).": " : "") . "Required but not specified"),0))
#
# &&
#
# ((eval { ($args->{"delay"} = (Scalar::Util::blessed($args->{"delay"}) && $args->{"delay"}->isa('DateTime::Duration')) ? (($args->{"delay"}->years * 365.25*86400 + $args->{"delay"}->months * 30.4375*86400 + $args->{"delay"}->weeks * 7*86400 +...
#
# &&
#
# ((!ref($args->{"delay"}) && $args->{"delay"} =~ /\A[0-9]+(?:.[0-9]+)?\z/) ? 1 : (($_sahv_err //= (@$_sahv_dpath ? '@'.join("",map {"[$_]"} @$_sahv_dpath).": " : "") . "Not of type duration"),0))
# ; if ($_sahv_err) { return [400, "Argument validation failed: $_sahv_err"] }
# $_sahv_dpath = [];
# ((defined($args->{"time"})) ? 1 : (($_sahv_err //= (@$_sahv_dpath ? '@'.join("",map {"[$_]"} @$_sahv_dpath).": " : "") . "Required but not specified"),0))
#
# &&
#
# ((eval { ($args->{"time"} = (Scalar::Util::blessed($args->{"time"}) && $args->{"time"}->isa('DateTime')) ? ($args->{"time"}->epoch) : ((!ref($args->{"time"}) && $args->{"time"} =~ /\A[0-9]{8,10}(?:.[0-9]+)?\z/ && $args->{"time"} >= 10**8 && ...
#
# &&
#
# ((!ref($args->{"time"}) && $args->{"time"} =~ /\A[0-9]+\z/) ? 1 : (($_sahv_err //= (@$_sahv_dpath ? '@'.join("",map {"[$_]"} @$_sahv_dpath).": " : "") . "Not of type date"),0))
# ; if ($_sahv_err) { return [400, "Argument validation failed: $_sahv_err"] }
# $_sahv_dpath = [];
# ((defined($args->{"uptime"})) ? 1 : (($_sahv_err //= (@$_sahv_dpath ? '@'.join("",map {"[$_]"} @$_sahv_dpath).": " : "") . "Required but not specified"),0))
#
# &&
#
# ((eval { ($args->{"uptime"} = (!ref($args->{"uptime"}) && $args->{"uptime"} =~ /\AP(?:([0-9]+(?:\.[0-9]+)?)Y)? (?:([0-9]+(?:\.[0-9]+)?)M)? (?:([0-9]+(?:\.[0-9]+)?)W)? (?:([0-9]+(?:\.[0-9]+)?)D)? (?: T (?:([0-9]+(?:\.[0-9]+)?)H)? (?:([0-9]+(?...
#
# &&
#
# ((!ref($args->{"uptime"}) && $args->{"uptime"} =~ /\A[0-9]+(?:.[0-9]+)?\z/) ? 1 : (($_sahv_err //= (@$_sahv_dpath ? '@'.join("",map {"[$_]"} @$_sahv_dpath).": " : "") . "Not of type duration"),0))
# ; if ($_sahv_err) { return [400, "Argument validation failed: $_sahv_err"] }
#state %refs;
#state $ctr_circ;
#state $process_array;
#state $process_hash;
#if (!$process_array) { $process_array = sub { my $a = shift; for my $e (@$a) { my $ref=ref($e);
# if ($ref eq 'DateTime') { $e = $e->epoch; $ref = ref($e) }
# elsif ($ref eq 'Regexp') { $e = "$e" }
# elsif ($ref eq 'SCALAR') { $e = ${ $e }; $ref = ref($e) }
# elsif ($ref eq 'Time::Moment') { $e = $e->epoch; $ref = ref($e) }
# elsif ($ref eq 'version') { $e = "$e" }
# elsif (Scalar::Util::blessed($e)) { if (!$Data::Clean::_clone && 0) { $e = Acme::Damn::damn($e) } else { $e = Function::Fallback::CoreOrPP::_unbless_fallback($e) } $ref = ref($e) }
# elsif ($ref eq 'ARRAY') { $process_array->($e) }
# elsif ($ref eq 'HASH') { $process_hash->($e) }
# elsif ($ref) { $e = $ref; $ref = "" }
#} } }
#if (!$process_hash) { $process_hash = sub { my $h = shift; for my $k (keys %$h) { my $ref=ref($h->{$k});
# if ($ref eq 'DateTime') { $h->{$k} = $h->{$k}->epoch; $ref = ref($h->{$k}) }
# elsif ($ref eq 'Regexp') { $h->{$k} = "$h->{$k}" }
# elsif ($ref eq 'SCALAR') { $h->{$k} = ${ $h->{$k} }; $ref = ref($h->{$k}) }
# elsif ($ref eq 'Time::Moment') { $h->{$k} = $h->{$k}->epoch; $ref = ref($h->{$k}) }
# elsif ($ref eq 'version') { $h->{$k} = "$h->{$k}" }
# elsif (Scalar::Util::blessed($h->{$k})) { if (!$Data::Clean::_clone && 0) { $h->{$k} = Acme::Damn::damn($h->{$k}) } else { $h->{$k} = Function::Fallback::CoreOrPP::_unbless_fallback($h->{$k}) } $ref = ref($h->{$k}) }
# elsif ($ref eq 'HASH') { $process_hash->($h->{$k}) }
# elsif ($ref) { $h->{$k} = $ref; $ref = "" }
#} } }
#%refs = (); $ctr_circ=0;
#for ($data) { my $ref=ref($_);
# if ($ref eq 'DateTime') { $_ = $_->epoch; $ref = ref($_) }
# elsif ($ref eq 'Regexp') { $_ = "$_" }
# elsif ($ref eq 'SCALAR') { $_ = ${ $_ }; $ref = ref($_) }
# elsif ($ref eq 'Time::Moment') { $_ = $_->epoch; $ref = ref($_) }
# elsif ($ref eq 'version') { $_ = "$_" }
# elsif (Scalar::Util::blessed($_)) { if (!$Data::Clean::_clone && 0) { $_ = Acme::Damn::damn($_) } else { $_ = Function::Fallback::CoreOrPP::_unbless_fallback($_) } $ref = ref($_) }
view all matches for this distribution
view release on metacpan or search on metacpan
}
},
"runtime" : {
"requires" : {
"Data::Sah::Coerce::perl::date::float_epoch" : "0",
"Data::Sah::Coerce::perl::date::obj_DateTime" : "0",
"Data::Sah::Coerce::perl::date::obj_TimeMoment" : "0",
"Data::Sah::Coerce::perl::date::str_iso8601" : "0",
"Data::Sah::Compiler::perl::TH::bool" : "0",
"Data::Sah::Compiler::perl::TH::date" : "0",
"Data::Sah::Compiler::perl::TH::float" : "0",
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/bwk/mn.pm view on Meta::CPAN
{prog => 'zfs'},
],
},
};
sub new_zfs_snapshot {
require DateTime;
my %args = @_;
my $res = _newest_bulwark_zfs_snapshots();
return $res unless $res->[0] == 200;
my $snapshots = $res->[3]{'func.all_snapshots'};
my $s = $res->[3]{'func.raw'};
my $today = DateTime->now->ymd;
my $new_snapshot;
my $i = 0;
while (1) {
$new_snapshot = sprintf(
"%s/%s\@%s%s",
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/cal/idn.pm view on Meta::CPAN
use 5.010001;
use strict;
use warnings;
use Calendar::Indonesia::Holiday qw(list_idn_holidays);
use DateTime;
use List::Util qw(max);
use Term::ANSIColor;
use Text::ANSI::Util qw(ta_length);
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
lib/App/cal/idn.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_idn_holidays(
detail => 1, year => $y, month => $m,
(is_joint_leave => 0) x !$args{show_joint_leave},
)->[2];
lib/App/cal/idn.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/cal/idn.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/calx.pm view on Meta::CPAN
use strict;
use warnings;
use Color::ANSI::Util qw(ansifg);
use Color::RGB::Util qw(assign_rgb_light_color);
use DateTime;
use List::Util qw(max);
use Text::ANSI::Util qw(ta_length);
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2023-06-22'; # DATE
lib/App/calx.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 = [];
if ($args{dates} && @{ $args{dates} }) {
$hol = $args{dates};
} else {
lib/App/calx.pm view on Meta::CPAN
if ($dt->day_of_week == 1) {
push @lines, "";
}
my $col = "808080";
my $reverse;
if (($args{highlight_today}//1) && DateTime->compare($dt, $dt_today) == 0) {
$reverse++;
} else {
for (@$hol) {
if ($dt->day == $_->{day}) {
#my $is_holiday = $_->{is_holiday} ||
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/cdnget.pm view on Meta::CPAN
use strict;
use warnings;
use v5.14;
use utf8;
use Time::HiRes qw(sleep usleep);
use DateTime;
use Lazy::Utils;
use App::cdnget::Exception;
use App::cdnget::Worker;
use App::cdnget::Downloader;
lib/App/cdnget.pm view on Meta::CPAN
sub log_info
{
my ($msg) = @_;
$msg = "Unknown" unless $msg;
my $dts = DateTime->now(time_zone => POSIX::strftime("%z", localtime), locale => "en")->strftime('%x %T %z');
$msg = "[$dts] $msg";
say $msg;
}
sub main
lib/App/cdnget.pm view on Meta::CPAN
Time::HiRes
=item *
DateTime
=item *
FCGI
view all matches for this distribution
view release on metacpan or search on metacpan
directory:
- inc
- t
- xt
requires:
DateTime: 0
ExtUtils::Installed: 0
File::Find::Rule: 0
File::Spec: 0
Getopt::Long: 0
List::MoreUtils: 0
view all matches for this distribution
view release on metacpan or search on metacpan
t/data/build.moose.log view on Meta::CPAN
#
# Module Have
# ---------------------------- ----------
# Algorithm::C3 0.10
# DBM::Deep missing
# DateTime 1.19
# DateTime::Calendar::Mayan missing
# DateTime::Format::MySQL 0.05
# Declare::Constraints::Simple missing
# Dist::CheckConflicts 0.11
# HTTP::Headers 6.05
# IO::File 1.16
# IO::String 1.08
t/data/build.moose.log view on Meta::CPAN
Installing /Volumes/amaretto/Users/ether/.perlbrew/libs/22.0@std/lib/perl5/darwin-2level/Moose/Cookbook/Style.pod
Installing /Volumes/amaretto/Users/ether/.perlbrew/libs/22.0@std/lib/perl5/darwin-2level/Moose/Cookbook/Basics/BankAccount_MethodModifiersAndSubclassing.pod
Installing /Volumes/amaretto/Users/ether/.perlbrew/libs/22.0@std/lib/perl5/darwin-2level/Moose/Cookbook/Basics/BinaryTree_AttributeFeatures.pod
Installing /Volumes/amaretto/Users/ether/.perlbrew/libs/22.0@std/lib/perl5/darwin-2level/Moose/Cookbook/Basics/BinaryTree_BuilderAndLazyBuild.pod
Installing /Volumes/amaretto/Users/ether/.perlbrew/libs/22.0@std/lib/perl5/darwin-2level/Moose/Cookbook/Basics/Company_Subtypes.pod
Installing /Volumes/amaretto/Users/ether/.perlbrew/libs/22.0@std/lib/perl5/darwin-2level/Moose/Cookbook/Basics/DateTime_ExtendingNonMooseParent.pod
Installing /Volumes/amaretto/Users/ether/.perlbrew/libs/22.0@std/lib/perl5/darwin-2level/Moose/Cookbook/Basics/Document_AugmentAndInner.pod
Installing /Volumes/amaretto/Users/ether/.perlbrew/libs/22.0@std/lib/perl5/darwin-2level/Moose/Cookbook/Basics/Genome_OverloadingSubtypesAndCoercion.pod
Installing /Volumes/amaretto/Users/ether/.perlbrew/libs/22.0@std/lib/perl5/darwin-2level/Moose/Cookbook/Basics/HTTP_SubtypesAndCoercion.pod
Installing /Volumes/amaretto/Users/ether/.perlbrew/libs/22.0@std/lib/perl5/darwin-2level/Moose/Cookbook/Basics/Immutable.pod
Installing /Volumes/amaretto/Users/ether/.perlbrew/libs/22.0@std/lib/perl5/darwin-2level/Moose/Cookbook/Basics/Person_BUILDARGSAndBUILD.pod
t/data/build.moose.log view on Meta::CPAN
Installing /Volumes/amaretto/Users/ether/.perlbrew/libs/22.0@std/man/man3/Moose::Cookbook.0
Installing /Volumes/amaretto/Users/ether/.perlbrew/libs/22.0@std/man/man3/Moose::Cookbook::Basics::BankAccount_MethodModifiersAndSubclassing.0
Installing /Volumes/amaretto/Users/ether/.perlbrew/libs/22.0@std/man/man3/Moose::Cookbook::Basics::BinaryTree_AttributeFeatures.0
Installing /Volumes/amaretto/Users/ether/.perlbrew/libs/22.0@std/man/man3/Moose::Cookbook::Basics::BinaryTree_BuilderAndLazyBuild.0
Installing /Volumes/amaretto/Users/ether/.perlbrew/libs/22.0@std/man/man3/Moose::Cookbook::Basics::Company_Subtypes.0
Installing /Volumes/amaretto/Users/ether/.perlbrew/libs/22.0@std/man/man3/Moose::Cookbook::Basics::DateTime_ExtendingNonMooseParent.0
Installing /Volumes/amaretto/Users/ether/.perlbrew/libs/22.0@std/man/man3/Moose::Cookbook::Basics::Document_AugmentAndInner.0
Installing /Volumes/amaretto/Users/ether/.perlbrew/libs/22.0@std/man/man3/Moose::Cookbook::Basics::Genome_OverloadingSubtypesAndCoercion.0
Installing /Volumes/amaretto/Users/ether/.perlbrew/libs/22.0@std/man/man3/Moose::Cookbook::Basics::HTTP_SubtypesAndCoercion.0
Installing /Volumes/amaretto/Users/ether/.perlbrew/libs/22.0@std/man/man3/Moose::Cookbook::Basics::Immutable.0
Installing /Volumes/amaretto/Users/ether/.perlbrew/libs/22.0@std/man/man3/Moose::Cookbook::Basics::Person_BUILDARGSAndBUILD.0
t/data/build.moose.log view on Meta::CPAN
Checking if you have Test::More 0.96 ... Yes (1.001014)
Checking if you have Sub::Exporter::ForMethods 0 ... Yes (0.100052)
Checking if you have File::ShareDir 0 ... Yes (1.102)
Checking if you have Data::Section 0.200002 ... Yes (0.200006)
Checking if you have MooseX::Types::Perl 0 ... Yes (0.101343)
Checking if you have DateTime 0.44 ... Yes (1.19)
Checking if you have CPAN::Meta::Requirements 2.121 ... Yes (2.133)
Checking if you have Term::UI 0 ... Yes (0.46)
Checking if you have MooseX::Types 0 ... Yes (0.46)
Checking if you have YAML::Tiny 0 ... Yes (1.67)
Checking if you have Term::ReadKey 0 ... Yes (2.32)
t/data/build.moose.log view on Meta::CPAN
# Config::MVP::Reader::Finder any 2.200010
# Config::MVP::Reader::INI 2.101461 2.101463
# Config::MVP::Section 2.200009 2.200010
# Data::Dumper any 2.158
# Data::Section 0.200002 0.200006
# DateTime 0.44 1.19
# Digest::MD5 any 2.54
# Encode any 2.73
# ExtUtils::Manifest 1.66 1.70
# File::Copy::Recursive any 0.38
# File::Find::Rule any 0.33
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/cryp/Exchange/coinbase_pro.pm view on Meta::CPAN
use Role::Tiny::With;
with 'App::cryp::Role::Exchange';
sub __parse_time {
state $parser = do {
require DateTime::Format::ISO8601;
DateTime::Format::ISO8601->new;
};
my $dt = $parser->parse_datetime($_[0]);
return undef unless $dt;
$dt->epoch;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/datecalc.pm view on Meta::CPAN
use 5.010001;
use strict;
use warnings;
use DateTime;
use DateTime::Format::ISO8601;
use MarpaX::Simple qw(gen_parser);
use Scalar::Util qw(blessed);
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2023-02-18'; # DATE
lib/App/datecalc.pm view on Meta::CPAN
_
actions => {
datelit_iso => sub {
my $h = shift;
my @date = split /-/, $_[0];
DateTime->new(year=>$date[0], month=>$date[1], day=>$date[2]);
},
date_sub_date => sub {
my $h = shift;
$_[0]->delta_days($_[2]);
},
datelit_special => sub {
my $h = shift;
if ($_[0] eq 'now') {
DateTime->now;
} elsif ($_[0] eq 'today') {
DateTime->today;
} elsif ($_[0] eq 'yesterday') {
DateTime->today->subtract(days => 1);
} elsif ($_[0] eq 'tomorrow') {
DateTime->today->add(days => 1);
} else {
die "BUG: Unknown date literal '$_[0]'";
}
},
date_add_dur => sub {
lib/App/datecalc.pm view on Meta::CPAN
my $h = shift;
if (ref $_[0]) {
my $d0 = $_[0];
if ($_[1] eq '*') {
# dur*num
DateTime::Duration->new(
years => $d0->years * $_[2],
months => $d0->months * $_[2],
weeks => $d0->weeks * $_[2],
days => $d0->days * $_[2],
hours => $d0->hours * $_[2],
minutes => $d0->minutes * $_[2],
seconds => $d0->seconds * $_[2],
);
} else {
# dur/num
DateTime::Duration->new(
years => $d0->years / $_[2],
months => $d0->months / $_[2],
weeks => $d0->weeks / $_[2],
days => $d0->days / $_[2],
hours => $d0->hours / $_[2],
lib/App/datecalc.pm view on Meta::CPAN
);
}
} else {
my $d0 = $_[2];
# num * dur
DateTime::Duration->new(
years => $d0->years * $_[0],
months => $d0->months * $_[0],
weeks => $d0->weeks * $_[0],
days => $d0->days * $_[0],
hours => $d0->hours * $_[0],
lib/App/datecalc.pm view on Meta::CPAN
$params{weeks} = $1 if /(-?\d+(?:\.\d+)?)\s*(weeks?|w)/;
$params{days} = $1 if /(-?\d+(?:\.\d+)?)\s*(days?|d)/;
$params{hours} = $1 if /(-?\d+(?:\.\d+)?)\s*(hours?|h)/;
$params{minutes} = $1 if /(-?\d+(?:\.\d+)?)\s*(mins?|minutes?)/;
$params{seconds} = $1 if /(-?\d+(?:\.\d+)?)\s*(s|secs?|seconds?)/;
DateTime::Duration->new(%params);
},
durlit_iso => sub {
my $h = shift;
# split between date and time
my $d = $_[0] =~ /P(.+?)(?:T|\z)/ ? $1 : '';
lib/App/datecalc.pm view on Meta::CPAN
$params{weeks} = $1 if $d =~ /(-?\d+(?:\.\d+)?)W/;
$params{days} = $1 if $d =~ /(-?\d+(?:\.\d+)?)D/;
$params{hours} = $1 if $t =~ /(-?\d+(?:\.\d+)?)H/i;
$params{minutes} = $1 if $t =~ /(-?\d+(?:\.\d+)?)M/i;
$params{seconds} = $1 if $t =~ /(-?\d+(?:\.\d+)?)S/i;
DateTime::Duration->new(%params);
},
func_inum_onum => sub {
my $h = shift;
my $fn = $_[0];
my $num = $_[1];
lib/App/datecalc.pm view on Meta::CPAN
sub eval {
my ($self, $str) = @_;
my $res = $self->{parser}->($str);
if (blessed($res) && $res->isa('DateTime::Duration')) {
__fmtduriso($res);
} elsif (blessed($res) && $res->isa('DateTime')) {
$res->ymd . "#".$res->day_abbr;
} else {
"$res";
}
}
lib/App/datecalc.pm view on Meta::CPAN
Source repository is at L<https://github.com/perlancar/perl-App-datecalc>.
=head1 SEE ALSO
L<DateTime> and L<DateTime::Format::ISO8601>, the backend modules used to do the
actual date calculation.
L<Marpa::R2> is used to generate the parser.
L<Date::Calc> another date module on CPAN. No relation except the similarity of
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/dateseq/id.pm view on Meta::CPAN
Do not show dates with these month numbers.
=item * B<format_class> => I<perl::modname>
Use a DateTime::Format::* class for formatting.
By default, L<DateTime::Format::Strptime> is used with pattern set from the
<strftime> option.
=item * B<format_class_attrs> => I<hash>
Arguments to pass to constructor of DateTime::Format::* class.
=item * B<from> => I<date>
Starting date.
lib/App/dateseq/id.pm view on Meta::CPAN
strftime() format for each date.
Default is C<%Y-%m-%d>, unless when hour/minute/second is specified, then it is
C<%Y-%m-%dT%H:%M:%S>.
C<dateseq> actually uses L<DateTimeX::strftimeq>, so you can embed Perl code
for flexibility. For example:
% dateseq 2019-11-19 2019-11-25 -f '%Y-%m-%d%( $_->day_of_week == 7 ? "su" : "" )q'
will print something like:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/dateseq/idn.pm view on Meta::CPAN
Do not show dates with these month numbers.
=item * B<format_class> => I<perl::modname>
Use a DateTime::Format::* class for formatting.
By default, L<DateTime::Format::Strptime> is used with pattern set from the
<strftime> option.
=item * B<format_class_attrs> => I<hash>
Arguments to pass to constructor of DateTime::Format::* class.
=item * B<from> => I<date>
Starting date.
lib/App/dateseq/idn.pm view on Meta::CPAN
strftime() format for each date.
Default is C<%Y-%m-%d>, unless when hour/minute/second is specified, then it is
C<%Y-%m-%dT%H:%M:%S>.
C<dateseq> actually uses L<DateTimeX::strftimeq>, so you can embed Perl code
for flexibility. For example:
% dateseq 2019-11-19 2019-11-25 -f '%Y-%m-%d%( $_->day_of_week == 7 ? "su" : "" )q'
will print something like:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/dateseq.pm view on Meta::CPAN
},
args => {
from => {
summary => 'Starting date',
schema => ['date*', {
'x.perl.coerce_to' => 'DateTime',
'x.perl.coerce_rules' => ['From_str::natural'],
}],
pos => 0,
},
to => {
summary => 'End date, if not specified will generate an infinite* stream of dates',
schema => ['date*', {
'x.perl.coerce_to' => 'DateTime',
'x.perl.coerce_rules' => ['From_str::natural'],
}],
pos => 1,
},
increment => {
schema => ['duration*', {
'x.perl.coerce_to' => 'DateTime::Duration',
}],
cmdline_aliases => {i=>{}},
pos => 2,
},
reverse => {
lib/App/dateseq.pm view on Meta::CPAN
description => <<'_',
Default is `%Y-%m-%d`, unless when hour/minute/second is specified, then it is
`%Y-%m-%dT%H:%M:%S`.
`dateseq` actually uses <pm:DateTimeX::strftimeq>, so you can embed Perl code
for flexibility. For example:
% dateseq 2019-11-19 2019-11-25 -f '%Y-%m-%d%( $_->day_of_week == 7 ? "su" : "" )q'
will print something like:
lib/App/dateseq.pm view on Meta::CPAN
schema => ['str*'],
cmdline_aliases => {f=>{}},
tags => ['category:formatting'],
},
format_class => {
summary => 'Use a DateTime::Format::* class for formatting',
schema => ['perl::modname'],
tags => ['category:formatting'],
completion => sub {
require Complete::Module;
my %args = @_;
Complete::Module::complete_module(
word => $args{word}, ns_prefix => 'DateTime::Format');
},
description => <<'_',
By default, <pm:DateTime::Format::Strptime> is used with pattern set from the
<strftime> option.
_
},
format_class_attrs => {
summary => 'Arguments to pass to constructor of DateTime::Format::* class',
schema => ['hash'],
tags => ['category:formatting'],
},
eval => {
summary => 'Run perl code for each date',
schema => 'str*',
tags => ['category:output'],
cmdline_aliases => {e=>{}},
description => <<'_',
Specified perl code will receive the date as DateTime object in `$_`and expected
to return result to print.
_
},
},
lib/App/dateseq.pm view on Meta::CPAN
src => q{[[prog]] 2010-01-01 2015-12-01 -f "%Y,%m" -i P1M --header "year,month" | fsql --add-csv - --add-csv data.csv -F YEAR -F MONTH 'SELECT year, month, data1 FROM stdin WHERE YEAR(data.date)=year AND MONTH(data.date)=month'},
src_plang => 'bash',
'x.doc.show_result' => 0,
},
{
summary => 'Use %q (see DateTimeX::strftimeq)',
src => q{[[prog]] 2020-12-24 2021-01-15 -f '%Y-%m-%d%( $_->day_of_week == 7 ? "su" : "" )q'},
src_plang => 'bash',
'x.doc.max_result_lines' => 10,
},
{
lib/App/dateseq.pm view on Meta::CPAN
{url=>'prog:seq'},
{url=>'prog:seq-pl', summary=>'Perl variant of seq'},
],
};
sub dateseq {
require DateTime::Duration;
require DateTime::Format::Strftimeq;
my %args = @_;
$args{from} //= DateTime->today;
$args{increment} //= DateTime::Duration->new(days=>1);
my $reverse = $args{reverse};
my $random = $args{random};
return [412, "If you specify --random, you must also specify --from *and* --to"]
if $random && !$args{to};
my $formatter;
if (my $cl = $args{format_class}) {
$cl = "DateTime::Format::$cl";
(my $cl_pm = "$cl.pm") =~ s!::!/!g;
require $cl_pm;
my $attrs = $args{format_class_attrs} // {};
$formatter = $cl->new(%$attrs);
} else {
lib/App/dateseq.pm view on Meta::CPAN
$has_hms++; last;
}
}
$has_hms ? '%Y-%m-%dT%H:%M:%S' : '%Y-%m-%d';
};
$formatter = DateTime::Format::Strftimeq->new(
format => $strftime,
);
}
my %seen_years; # key=year (e.g. 2021), val=int
lib/App/dateseq.pm view on Meta::CPAN
my @res;
push @res, $args{header} if defined $args{header};
my $dt = $args{from}->clone;
while (1) {
last if defined($args{limit}) && $num_dates >= $args{limit};
#say "D:$dt vs $args{to}? ", DateTime->compare($dt, $args{to});
if (defined $args{to}) {
last if !$reverse && DateTime->compare($dt, $args{to}) > 0;
last if $reverse && DateTime->compare($dt, $args{to}) < 0;
}
if ($code_filter->($dt)) {
push @res, $_format->($dt);
$num_dates++;
}
lib/App/dateseq.pm view on Meta::CPAN
=item * B<eval> => I<str>
Run perl code for each date.
Specified perl code will receive the date as DateTime object in C<$_>and expected
to return result to print.
=item * B<exclude_dow> => I<date::dow_nums>
Do not show dates with these day-of-weeks.
lib/App/dateseq.pm view on Meta::CPAN
Do not show dates with these month numbers.
=item * B<format_class> => I<perl::modname>
Use a DateTime::Format::* class for formatting.
By default, L<DateTime::Format::Strptime> is used with pattern set from the
<strftime> option.
=item * B<format_class_attrs> => I<hash>
Arguments to pass to constructor of DateTime::Format::* class.
=item * B<from> => I<date>
Starting date.
lib/App/dateseq.pm view on Meta::CPAN
strftime() format for each date.
Default is C<%Y-%m-%d>, unless when hour/minute/second is specified, then it is
C<%Y-%m-%dT%H:%M:%S>.
C<dateseq> actually uses L<DateTimeX::strftimeq>, so you can embed Perl code
for flexibility. For example:
% dateseq 2019-11-19 2019-11-25 -f '%Y-%m-%d%( $_->day_of_week == 7 ? "su" : "" )q'
will print something like:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/dropboxapi.pm view on Meta::CPAN
%b ... bytes
%s ... size (e.g., 1K 234M 2G)
%t ... server_modified
%c ... client_modified
%r ... rev
%Tk ... DateTime 'strftime' function (server_modified)
%Ck ... DateTime 'strftime' function (client_modified)
L<http://search.cpan.org/dist/DateTime/lib/DateTime.pm#strftime_Patterns>
=head2 ls
file list view.
lib/App/dropboxapi.pm view on Meta::CPAN
%b ... bytes
%s ... size (e.g., 1K 234M 2G)
%t ... server_modified
%c ... client_modified
%r ... rev
%Tk ... DateTime 'strftime' function (server_modified)
%Ck ... DateTime 'strftime' function (client_modified)
L<http://search.cpan.org/dist/DateTime/lib/DateTime.pm#strftime_Patterns>
=head2 find
recursive file list view.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/durseq.pm view on Meta::CPAN
},
args => {
from => {
summary => 'Starting duration',
schema => ['duration*', {
'x.perl.coerce_to' => 'DateTime::Duration',
'x.perl.coerce_rules' => ['From_str::iso8601'],
}],
pos => 0,
},
to => {
summary => 'Ending duration, if not specified will generate an infinite* stream of durations',
schema => ['duration*', {
'x.perl.coerce_to' => 'DateTime::Duration',
'x.perl.coerce_rules' => ['From_str::iso8601'],
}],
pos => 1,
},
increment => {
summary => 'Increment, default is one day (P1D)',
schema => ['duration*', {
'x.perl.coerce_to' => 'DateTime::Duration',
'x.perl.coerce_rules' => ['From_str::iso8601'],
}],
cmdline_aliases => {i=>{}},
pos => 2,
},
lib/App/durseq.pm view on Meta::CPAN
schema => ['int*', min=>1],
cmdline_aliases => {n=>{}},
},
format_class => {
summary => 'Use a DateTime::Format::Duration::* class for formatting',
schema => ['perl::modname'],
default => 'ISO8601',
tags => ['category:formatting'],
completion => sub {
require Complete::Module;
my %args = @_;
Complete::Module::complete_module(
word => $args{word}, ns_prefix => 'DateTime::Format::Duration');
},
description => <<'_',
By default, "ISO8601" (<pm:DateTime::Format::Duration::ISO8601>) is used.
_
},
format_class_attrs => {
summary => 'Arguments to pass to constructor of DateTime::Format::* class',
schema => ['hash'],
tags => ['category:formatting'],
},
},
examples => [
lib/App/durseq.pm view on Meta::CPAN
# 'x.doc.show_result' => 0,
#},
],
};
sub durseq {
require DateTime;
require DateTime::Duration;
require DateTime::Format::Duration::ISO8601;
my %args = @_;
my $base_dt = DateTime->now;
$args{from} //= DateTime::Duration->new(days=>0);
$args{increment} //= DateTime::Duration->new(days=>1);
my $reverse = $args{reverse};
my $cl = $args{format_class} // "ISO8601";
$cl = "DateTime::Format::Duration::$cl";
(my $cl_pm = "$cl.pm") =~ s!::!/!g;
require $cl_pm;
my $attrs = $args{format_class_attrs} // {};
my $formatter = $cl->new(%$attrs);
lib/App/durseq.pm view on Meta::CPAN
my @res;
#push @res, $args{header} if $args{header};
my $dtdur = $args{from}->clone;
while (1) {
if (defined $args{to}) {
last if !$reverse && DateTime::Duration->compare($dtdur, $args{to}, $base_dt) > 0;
last if $reverse && DateTime::Duration->compare($dtdur, $args{to}, $base_dt) < 0;
}
push @res, $formatter->format_duration($dtdur);
last if defined($args{limit}) && @res >= $args{limit};
$dtdur = $reverse ? $dtdur - $args{increment} : $dtdur + $args{increment};
}
lib/App/durseq.pm view on Meta::CPAN
=over 4
=item * B<format_class> => I<perl::modname> (default: "ISO8601")
Use a DateTime::Format::Duration::* class for formatting.
By default, "ISO8601" (L<DateTime::Format::Duration::ISO8601>) is used.
=item * B<format_class_attrs> => I<hash>
Arguments to pass to constructor of DateTime::Format::* class.
=item * B<from> => I<duration>
Starting duration.
view all matches for this distribution
view release on metacpan or search on metacpan
"ExtUtils::MakeMaker" : "0"
}
},
"runtime" : {
"requires" : {
"DateTime" : "0.37",
"perl" : "5.008004",
"strict" : "0",
"warnings" : "0"
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/financeta/data/gemini.pm view on Meta::CPAN
use warnings;
use 5.10.0;
use Try::Tiny;
use LWP::UserAgent;
use JSON::XS qw(decode_json);
use DateTime;
use App::financeta::utils qw(dumper log_filter);
use Log::Any '$log', filter => \&App::financeta::utils::log_filter;
use PDL::Lite;#for pdl
our $VERSION = '0.16';
lib/App/financeta/data/gemini.pm view on Meta::CPAN
sub ohlcv {
my ($symbol, $start_date, $end_date) = @_;
my $data;
try {
$log->info("Starting to download quotes for $symbol for date range: $start_date -> $end_date");
my $start_time = (ref $start_date eq 'DateTime') ? $start_date->epoch() : DateTime->new($start_date)->set_time_zone('UTC')->epoch;
my $end_time = (ref $end_date eq 'DateTime') ? $end_date->epoch() : DateTime->new($end_date)->set_time_zone('UTC')->epoch;
my $difftime = abs($end_time - $start_time);
$log->debug("Start Date $start_date is $start_time in UNIX time");
$log->debug("End Date $end_date is $end_time in UNIX time");
my $granularity;
if ($difftime <= 86400) {
view all matches for this distribution
view release on metacpan or search on metacpan
script/_finddo 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
lib/App/finquotehist.pm view on Meta::CPAN
our %SPEC;
my $sch_date = [
'date*', {
'x.perl.coerce_to' => 'DateTime',
'x.perl.coerce_rules' => ['From_str::natural'],
},
];
$SPEC{finquotehist} = {
lib/App/finquotehist.pm view on Meta::CPAN
return [200, "OK", [
grep {!/\A(Generic)\z/}
map {my $x = $_; $x =~ s/\AFinance::QuoteHist:://; $x}
sort keys %$mods]];
} elsif ($action eq 'fetch_quotes' || $action eq 'fetch_splits' || $action eq 'fetch_dividends') {
require DateTime;
require Finance::QuoteHist;
return [400, "Please specify one or more symbols"]
unless $args{symbols} && @{ $args{symbols} };
my $from = $args{from} // DateTime->today->subtract(years=>1);
my $to = $args{to} // DateTime->today;
my $q = Finance::QuoteHist->new(
lineup => [map {"Finance::QuoteHist::$_"} @{ $args{engines} }],
symbols => $args{symbols},
start_date => $from->strftime("%m/%d/%Y"),
end_date => $to ->strftime("%m/%d/%Y"),
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/gcal.pm view on Meta::CPAN
$App::gcal::VERSION = '1.121460';
}
use Class::ReturnValue;
use Data::ICal;
use DateTime::TimeZone;
# ABSTRACT: Command Line Interface interface to Google Calendar.
# cache the timezone lookup
my $localTZ = DateTime::TimeZone->new( name => 'local' );
my $gcal;
# entry point
lib/App/gcal.pm view on Meta::CPAN
# converts Data::ICal to Net::Google::Calendar::Entry
sub _create_new_gcal_event {
my ($entry) = @_;
require Net::Google::Calendar::Entry;
require DateTime::Format::ICal;
my $event = Net::Google::Calendar::Entry->new();
$event->title( $entry->property('summary')->[0]->value );
# ensure the times are in the local timezone
my $dtstart = DateTime::Format::ICal->parse_datetime(
$entry->property('dtstart')->[0]->value );
$dtstart->set_time_zone($localTZ);
my $dtend = DateTime::Format::ICal->parse_datetime(
$entry->property('dtend')->[0]->value );
$dtend->set_time_zone($localTZ);
$event->when( $dtstart, $dtend );
$event->status('confirmed');
view all matches for this distribution
view release on metacpan or search on metacpan
script/_genpw-base56 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