App-ZodiacUtils

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

0.114   2020-08-28  Released-By: PERLANCAR; Urgency: low

	- [ux] Simplify CLIs: don't read from config/env.

	- [doc][ux] Cross-mention between zodiac-of and chinese-zodiac-of.


0.113   2020-01-31  Released-By: PERLANCAR; Urgency: medium

	- Avoid the use of From_str::alami date coercion for now as
	  DateTime::Format::Alami is flaky.


0.112   2020-01-01  Released-By: PERLANCAR; Urgency: medium

        - Revert 0.111 change. The broken piece was iso8601 coercion rule which
          could not handle dates before epoch (Jan 1, 1970).


0.111   2020-01-01  Released-By: PERLANCAR; Urgency: medium

	- Replace coerce rule From_str::alami.* with From_str::natural because
          DateTime::Format::Alami is currently very broken. UPDATE: Reverted in
          0.112.


0.110   2019-11-29  Released-By: PERLANCAR; Urgency: medium

	- Update coerce rule names (Data::Sah::Coerce 0.034+).


0.10    2016-06-02  Released-By: PERLANCAR

Changes  view on Meta::CPAN

0.04    2015-11-28  Released-By: PERLANCAR

	- Switch to Perinci::CmdLine::Inline for faster startup, allow
	  multiple arguments.


0.03    2015-11-28  Released-By: PERLANCAR

	- No functional changes.

	- Replace DateTime::Event::Zodiac with Zodiac::Tiny.


0.02    2015-11-21  Released-By: PERLANCAR

	- Add utility: chinese-zodiac-of.


0.01    2015-11-09  Released-By: PERLANCAR

        - First release.

META.json  view on Meta::CPAN

         "requires" : {
            "Data::Sah::Coerce::perl::To_date::From_float::epoch" : "0",
            "Data::Sah::Coerce::perl::To_date::From_obj::datetime" : "0",
            "Data::Sah::Coerce::perl::To_date::From_obj::time_moment" : "0",
            "Data::Sah::Coerce::perl::To_date::From_str::iso8601" : "0",
            "Data::Sah::Compiler::perl::TH::array" : "0",
            "Data::Sah::Compiler::perl::TH::bool" : "0",
            "Data::Sah::Compiler::perl::TH::date" : "0",
            "Data::Sah::Compiler::perl::TH::int" : "0",
            "Data::Sah::Compiler::perl::TH::str" : "0",
            "DateTime" : "0",
            "DateTime::Format::Alami::EN" : "0.13",
            "DateTime::Format::Natural" : "0",
            "List::Util" : "1.45",
            "Perinci::CmdLine::Any" : "0",
            "Perinci::CmdLine::Lite" : "1.827",
            "Perinci::Sub::Gen::AccessTable" : "0.583",
            "Perinci::Sub::Property::result::table" : "0",
            "Scalar::Util" : "0",
            "Zodiac::Chinese::Table" : "0",
            "Zodiac::Tiny" : "0",
            "perl" : "5.010001",
            "strict" : "0",

META.yml  view on Meta::CPAN

requires:
  Data::Sah::Coerce::perl::To_date::From_float::epoch: '0'
  Data::Sah::Coerce::perl::To_date::From_obj::datetime: '0'
  Data::Sah::Coerce::perl::To_date::From_obj::time_moment: '0'
  Data::Sah::Coerce::perl::To_date::From_str::iso8601: '0'
  Data::Sah::Compiler::perl::TH::array: '0'
  Data::Sah::Compiler::perl::TH::bool: '0'
  Data::Sah::Compiler::perl::TH::date: '0'
  Data::Sah::Compiler::perl::TH::int: '0'
  Data::Sah::Compiler::perl::TH::str: '0'
  DateTime: '0'
  DateTime::Format::Alami::EN: '0.13'
  DateTime::Format::Natural: '0'
  List::Util: '1.45'
  Perinci::CmdLine::Any: '0'
  Perinci::CmdLine::Lite: '1.827'
  Perinci::Sub::Gen::AccessTable: '0.583'
  Perinci::Sub::Property::result::table: '0'
  Scalar::Util: '0'
  Zodiac::Chinese::Table: '0'
  Zodiac::Tiny: '0'
  perl: '5.010001'
  strict: '0'

Makefile.PL  view on Meta::CPAN

  "PREREQ_PM" => {
    "Data::Sah::Coerce::perl::To_date::From_float::epoch" => 0,
    "Data::Sah::Coerce::perl::To_date::From_obj::datetime" => 0,
    "Data::Sah::Coerce::perl::To_date::From_obj::time_moment" => 0,
    "Data::Sah::Coerce::perl::To_date::From_str::iso8601" => 0,
    "Data::Sah::Compiler::perl::TH::array" => 0,
    "Data::Sah::Compiler::perl::TH::bool" => 0,
    "Data::Sah::Compiler::perl::TH::date" => 0,
    "Data::Sah::Compiler::perl::TH::int" => 0,
    "Data::Sah::Compiler::perl::TH::str" => 0,
    "DateTime" => 0,
    "DateTime::Format::Alami::EN" => "0.13",
    "DateTime::Format::Natural" => 0,
    "List::Util" => "1.45",
    "Perinci::CmdLine::Any" => 0,
    "Perinci::CmdLine::Lite" => "1.827",
    "Perinci::Sub::Gen::AccessTable" => "0.583",
    "Perinci::Sub::Property::result::table" => 0,
    "Scalar::Util" => 0,
    "Zodiac::Chinese::Table" => 0,
    "Zodiac::Tiny" => 0,
    "strict" => 0,
    "warnings" => 0

Makefile.PL  view on Meta::CPAN

my %FallbackPrereqs = (
  "Data::Sah::Coerce::perl::To_date::From_float::epoch" => 0,
  "Data::Sah::Coerce::perl::To_date::From_obj::datetime" => 0,
  "Data::Sah::Coerce::perl::To_date::From_obj::time_moment" => 0,
  "Data::Sah::Coerce::perl::To_date::From_str::iso8601" => 0,
  "Data::Sah::Compiler::perl::TH::array" => 0,
  "Data::Sah::Compiler::perl::TH::bool" => 0,
  "Data::Sah::Compiler::perl::TH::date" => 0,
  "Data::Sah::Compiler::perl::TH::int" => 0,
  "Data::Sah::Compiler::perl::TH::str" => 0,
  "DateTime" => 0,
  "DateTime::Format::Alami::EN" => "0.13",
  "DateTime::Format::Natural" => 0,
  "File::Spec" => 0,
  "IO::Handle" => 0,
  "IPC::Open3" => 0,
  "List::Util" => "1.45",
  "Perinci::CmdLine::Any" => 0,
  "Perinci::CmdLine::Lite" => "1.827",
  "Perinci::Sub::Gen::AccessTable" => "0.583",
  "Perinci::Sub::Property::result::table" => 0,
  "Scalar::Util" => 0,
  "Test::More" => 0,

dist.ini  view on Meta::CPAN

version = 0.115

name    = App-ZodiacUtils

[GenPericmdScript / GenPericmdScript zodiac-of]
url=/App/ZodiacUtils/zodiac_of
cmdline=inline
allow_prereq=DateTime
read_config=0
read_env=0

[GenPericmdScript / GenPericmdScript chinese-zodiac-of]
url=/App/ZodiacUtils/chinese_zodiac_of
cmdline=inline
allow_prereq=DateTime
read_config=0
read_env=0

[GenPericmdScript / GenPericmdScript list-chinese-zodiac-table]
url=/App/ZodiacUtils/Table/list_chinese_zodiac_table
read_config=0
read_env=0

[InsertExecsList]

[@Author::PERLANCAR]
:version=0.600

[Prereqs]
perl=5.010001
strict=0
warnings=0
;!lint_prereqs assume-used "undetected, generated by dsah"
DateTime=0
;!lint_prereqs assume-used "undetected, generated by dsah"
DateTime::Format::Alami::EN=0.13
Perinci::Sub::Gen::AccessTable=0.583
Zodiac::Chinese::Table=0
Zodiac::Tiny=0

[Prereqs / DevelopX_spec]
-phase=develop
-relationship=x_spec
Rinci=1.1.90

lib/App/ZodiacUtils.pm  view on Meta::CPAN

our $VERSION = '0.115'; # VERSION

use 5.010001;
use strict;
use warnings;

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,
}];

$SPEC{zodiac_of} = {
    v => 1.1,
    summary => 'Show zodiac for a date',
    args => {
        dates => {

lib/App/ZodiacUtils.pm  view on Meta::CPAN


    my $dates = $args{dates};

    my $res = [];
    for my $date (@$dates) {

        # 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;
    }
    $res = $res->[0] if @$res == 1;
    $res;
}

$SPEC{chinese_zodiac_of} = {

lib/App/ZodiacUtils.pm  view on Meta::CPAN


    my $dates = $args{dates};

    my $res = [];
    for my $date (@$dates) {

        # 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;
    }
    $res = $res->[0] if @$res == 1;
    $res;
}

script/_chinese-zodiac-of  view on Meta::CPAN

# ABSTRACT: Completer script for chinese-zodiac-of

use 5.010;
use strict;
use warnings;

die "Please run this script under shell completion\n" unless $ENV{COMP_LINE} || $ENV{COMMAND_LINE};

my $args = {program_name=>"chinese-zodiac-of",read_config=>0,read_env=>0,skip_format=>undef,subcommands=>undef,url=>"/App/ZodiacUtils/chinese_zodiac_of"};

my $meta = {_orig_args_as=>undef,_orig_result_naked=>1,args=>{dates=>{greedy=>1,pos=>0,req=>1,schema=>["array",{min_len=>1,of=>["date*",{"x.perl.coerce_rules"=>["From_str::natural"],"x.perl.coerce_to"=>"DateTime"}],req=>1},{}],summary=>"Dates","x.nam...

my $sc_metas = {};

my $copts = {format=>{default=>undef,getopt=>"format=s",handler=>sub{package Perinci::CmdLine::Base;use warnings;use strict;no feature;use feature ':5.10';my($go, $val, $r) = @_;$$r{'format'} = $val},is_settable_via_config=>1,schema=>["str*","in",["t...

my $r = {};

# get words
my $shell;
my ($words, $cword);

script/_chinese-zodiac-of  view on Meta::CPAN

#    my $circ = $opts->{-circular};
#    if ($circ) {
#        my $meth = "command_$circ->[0]";
#        die "Can't handle command $circ->[0] for option '-circular'" unless $self->can($meth);
#        my @args = @$circ; shift @args;
#        my $act = $self->$meth($cd, \@args);
#        if ($opts->{'!debug'}) { $add_stmt->('stmt', 'print "DEBUG: main cleaner: ref=$ref, " . {{var}} . "\n"'); }
#        $add_new_if->('$ref && $refs{ {{var}} }++', $act);
#    }
#
#    # catch object of specified classes (e.g. DateTime, etc)
#    for my $on (grep {/\A\w*(::\w+)*\z/} sort keys %$opts) {
#        my $o = $opts->{$on};
#        next unless $o;
#        my $meth = "command_$o->[0]";
#        die "Can't handle command $o->[0] for option '$on'" unless $self->can($meth);
#        my @args = @$o; shift @args;
#        my $act = $self->$meth($cd, \@args);
#        $add_if_ref->($on, $act);
#    }
#

script/_chinese-zodiac-of  view on Meta::CPAN

#=head1 VERSION
#
#This document describes version 0.507 of Data::Clean (from Perl distribution Data-Clean), released on 2020-04-07.
#
#=head1 SYNOPSIS
#
# use Data::Clean;
#
# my $cleanser = Data::Clean->new(
#     # specify how to deal with specific classes
#     'DateTime'     => [call_method => 'epoch'], # replace object with its epoch
#     'Time::Moment' => [call_method => 'epoch'], # replace object with its epoch
#     'Regexp'       => ['stringify'], # replace $obj with "$obj"
#
#     # specify how to deal with all scalar refs
#     SCALAR         => ['deref_scalar'], # replace \1 with 1
#
#     # specify how to deal with circular reference
#     -circular      => ['clone'],
#
#     # specify how to deal with all other kinds of objects

script/_chinese-zodiac-of  view on Meta::CPAN

#
#This will replace a reference like C<{}> with C<HASH>.
#
#=item * ['replace_with_str', STR]
#
#This will replace a reference like C<{}> with I<STR>.
#
#=item * ['call_method' => STR]
#
#This will call a method named I<STR> and use its return as the replacement. For
#example: C<< DateTime->from_epoch(epoch=>1000) >> when processed with C<<
#[call_method => 'epoch'] >> will become 1000.
#
#=item * ['call_func', STR]
#
#This will call a function named I<STR> with value as argument and use its return
#as the replacement.
#
#=item * ['one_or_zero']
#
#This will perform C<< $val ? 1:0 >>.

script/_chinese-zodiac-of  view on Meta::CPAN

#               );
#
#sub new {
#    my ($class, %opts) = @_;
#
#    if (!%opts && !$creating_singleton) {
#        warn "You are creating a new ".__PACKAGE__." object without customizing options. ".
#            "You probably want to call get_cleanser() yet to get a singleton instead?";
#    }
#
#    $opts{DateTime}  //= [call_method => 'epoch'];
#    $opts{'Time::Moment'} //= [call_method => 'epoch'];
#    $opts{'Math::BigInt'} //= [call_method => 'bstr'];
#    $opts{Regexp}    //= ['stringify'];
#    $opts{version}   //= ['stringify'];
#
#    $opts{SCALAR}    //= ['deref_scalar'];
#    $opts{-ref}      //= ['replace_with_ref'];
#    $opts{-circular} //= ['clone'];
#    $opts{-obj}      //= ['unbless'];
#

script/_chinese-zodiac-of  view on Meta::CPAN

# $cleaned = clone_and_clean_json($data);
#
#=head1 DESCRIPTION
#
#This class cleans data from anything that might be problematic when encoding to
#JSON. This includes coderefs, globs, and so on. Here's what it will do by
#default:
#
#=over
#
#=item * Change DateTime and Time::Moment object to its epoch value
#
#=item * Change Regexp and version object to its string value
#
#=item * Change scalar references (e.g. \1) to its scalar value (e.g. 1)
#
#=item * Change other references (non-hash, non-array) to its ref() value (e.g. "GLOB", "CODE")
#
#=item * Clone circular references
#
#With a default limit of 1, meaning that if a reference is first seen again for

script/_zodiac-of  view on Meta::CPAN

# ABSTRACT: Completer script for zodiac-of

use 5.010;
use strict;
use warnings;

die "Please run this script under shell completion\n" unless $ENV{COMP_LINE} || $ENV{COMMAND_LINE};

my $args = {program_name=>"zodiac-of",read_config=>0,read_env=>0,skip_format=>undef,subcommands=>undef,url=>"/App/ZodiacUtils/zodiac_of"};

my $meta = {_orig_args_as=>undef,_orig_result_naked=>1,args=>{dates=>{greedy=>1,pos=>0,req=>1,schema=>["array",{min_len=>1,of=>["date*",{"x.perl.coerce_rules"=>["From_str::natural"],"x.perl.coerce_to"=>"DateTime"}],req=>1},{}],summary=>"Dates","x.nam...

my $sc_metas = {};

my $copts = {format=>{default=>undef,getopt=>"format=s",handler=>sub{package Perinci::CmdLine::Base;use warnings;use strict;no feature;use feature ':5.10';my($go, $val, $r) = @_;$$r{'format'} = $val},is_settable_via_config=>1,schema=>["str*","in",["t...

my $r = {};

# get words
my $shell;
my ($words, $cword);

script/_zodiac-of  view on Meta::CPAN

#    my $circ = $opts->{-circular};
#    if ($circ) {
#        my $meth = "command_$circ->[0]";
#        die "Can't handle command $circ->[0] for option '-circular'" unless $self->can($meth);
#        my @args = @$circ; shift @args;
#        my $act = $self->$meth($cd, \@args);
#        if ($opts->{'!debug'}) { $add_stmt->('stmt', 'print "DEBUG: main cleaner: ref=$ref, " . {{var}} . "\n"'); }
#        $add_new_if->('$ref && $refs{ {{var}} }++', $act);
#    }
#
#    # catch object of specified classes (e.g. DateTime, etc)
#    for my $on (grep {/\A\w*(::\w+)*\z/} sort keys %$opts) {
#        my $o = $opts->{$on};
#        next unless $o;
#        my $meth = "command_$o->[0]";
#        die "Can't handle command $o->[0] for option '$on'" unless $self->can($meth);
#        my @args = @$o; shift @args;
#        my $act = $self->$meth($cd, \@args);
#        $add_if_ref->($on, $act);
#    }
#

script/_zodiac-of  view on Meta::CPAN

#=head1 VERSION
#
#This document describes version 0.507 of Data::Clean (from Perl distribution Data-Clean), released on 2020-04-07.
#
#=head1 SYNOPSIS
#
# use Data::Clean;
#
# my $cleanser = Data::Clean->new(
#     # specify how to deal with specific classes
#     'DateTime'     => [call_method => 'epoch'], # replace object with its epoch
#     'Time::Moment' => [call_method => 'epoch'], # replace object with its epoch
#     'Regexp'       => ['stringify'], # replace $obj with "$obj"
#
#     # specify how to deal with all scalar refs
#     SCALAR         => ['deref_scalar'], # replace \1 with 1
#
#     # specify how to deal with circular reference
#     -circular      => ['clone'],
#
#     # specify how to deal with all other kinds of objects

script/_zodiac-of  view on Meta::CPAN

#
#This will replace a reference like C<{}> with C<HASH>.
#
#=item * ['replace_with_str', STR]
#
#This will replace a reference like C<{}> with I<STR>.
#
#=item * ['call_method' => STR]
#
#This will call a method named I<STR> and use its return as the replacement. For
#example: C<< DateTime->from_epoch(epoch=>1000) >> when processed with C<<
#[call_method => 'epoch'] >> will become 1000.
#
#=item * ['call_func', STR]
#
#This will call a function named I<STR> with value as argument and use its return
#as the replacement.
#
#=item * ['one_or_zero']
#
#This will perform C<< $val ? 1:0 >>.

script/_zodiac-of  view on Meta::CPAN

#               );
#
#sub new {
#    my ($class, %opts) = @_;
#
#    if (!%opts && !$creating_singleton) {
#        warn "You are creating a new ".__PACKAGE__." object without customizing options. ".
#            "You probably want to call get_cleanser() yet to get a singleton instead?";
#    }
#
#    $opts{DateTime}  //= [call_method => 'epoch'];
#    $opts{'Time::Moment'} //= [call_method => 'epoch'];
#    $opts{'Math::BigInt'} //= [call_method => 'bstr'];
#    $opts{Regexp}    //= ['stringify'];
#    $opts{version}   //= ['stringify'];
#
#    $opts{SCALAR}    //= ['deref_scalar'];
#    $opts{-ref}      //= ['replace_with_ref'];
#    $opts{-circular} //= ['clone'];
#    $opts{-obj}      //= ['unbless'];
#

script/_zodiac-of  view on Meta::CPAN

# $cleaned = clone_and_clean_json($data);
#
#=head1 DESCRIPTION
#
#This class cleans data from anything that might be problematic when encoding to
#JSON. This includes coderefs, globs, and so on. Here's what it will do by
#default:
#
#=over
#
#=item * Change DateTime and Time::Moment object to its epoch value
#
#=item * Change Regexp and version object to its string value
#
#=item * Change scalar references (e.g. \1) to its scalar value (e.g. 1)
#
#=item * Change other references (non-hash, non-array) to its ref() value (e.g. "GLOB", "CODE")
#
#=item * Clone circular references
#
#With a default limit of 1, meaning that if a reference is first seen again for

script/chinese-zodiac-of  view on Meta::CPAN

#!perl

### begin code_after_shebang
# Note: This script is a CLI for Riap function /App/ZodiacUtils/chinese_zodiac_of
# and generated automatically using Perinci::CmdLine::Gen version 0.497

### end code_after_shebang
# PERICMD_INLINE_SCRIPT: {"allow_prereq":["DateTime"],"code_after_shebang":"...","config_dirs":null,"config_filename":"chinese-zodiac-of.conf","env_name":"CHINESE_ZODIAC_OF_OPT","include":null,"log":null,"pack_deps":1,"pod":0,"read_config":"0","read_...

my $_pci_metas = {""=>{args=>{dates=>{greedy=>1,pos=>0,req=>1,schema=>["array",{min_len=>1,of=>["date",{req=>1,"x.perl.coerce_rules"=>["From_str::natural"],"x.perl.coerce_to"=>"DateTime"},{}],req=>1},{}],summary=>"Dates","x.name.is_plural"=>1}},examp...

# This script is generated by Perinci::CmdLine::Inline version 0.550 on Mon Sep 14 07:41:37 2020.

# Rinci metadata taken from these modules: App::ZodiacUtils (no version)

# You probably should not manually edit this file.

our $DATE = '2020-09-14'; # DATE
our $VERSION = '0.115'; # VERSION
# PODNAME: chinese-zodiac-of

script/chinese-zodiac-of  view on Meta::CPAN

#            1;
#            if (@ARGV > 0) { if (exists $args->{"dates"}) { return [400, "You specified --date but also argument #0"]; } else { $args->{"dates"} = [splice(@ARGV, 0)]; } }
#        }
#        my @check_argv = @ARGV;
#        # fill from cmdline_src
#
#        # fill defaults from "default" property and check against schema
#        no warnings ('void');
#        require List::Util;
#        require Scalar::Util;
#        require DateTime::Format::Natural;
#        require DateTime;
#        my $_sahv_dpath;
#        my $_sahv_err;
#        if (exists $args->{"dates"}) {
#            $_sahv_dpath = [];
#            # req #0
#            ((defined($args->{"dates"})) ? 1 : (($_sahv_err //= (@$_sahv_dpath ? '@'.join("",map {"[$_]"} @$_sahv_dpath).": " : "") . "Required but not specified"),0))
#            
#            &&
#            
#            # check type 'array'

script/chinese-zodiac-of  view on Meta::CPAN

#            &&
#            
#            ([push(@{$_sahv_dpath}, undef), scalar(# clause: of
#            ((!defined(List::Util::first(sub {!(
#                        ($_sahv_dpath->[-1] = $_),
#                        # req #0
#                        ((defined($args->{"dates"}->[$_])) ? 1 : (($_sahv_err //= (@$_sahv_dpath ? '@'.join("",map {"[$_]"} @$_sahv_dpath).": " : "") . "Required but not specified"),0))
#                        
#                        &&
#                        
#                        # coerce rule(s): From_float::epoch, From_obj::datetime, From_obj::time_moment, From_str::iso8601, From_str::natural # coerce to: DateTime
#                        (($args->{"dates"}->[$_] = (!ref($args->{"dates"}->[$_]) && $args->{"dates"}->[$_] =~ /\A[0-9]{8,10}(?:.[0-9]+)?\z/ && $args->{"dates"}->[$_] >= 10**8 && $args->{"dates"}->[$_] <= 2**31) ? [undef,DateTime->from_epoch(epoch =>...
#                        
#                        &&
#                        
#                        # check type 'date'
#                        ((Scalar::Util::blessed($args->{"dates"}->[$_]) && $args->{"dates"}->[$_]->isa('DateTime')) ? 1 : (($_sahv_err //= (@$_sahv_dpath ? '@'.join("",map {"[$_]"} @$_sahv_dpath).": " : "") . "Not of type date"),0))
#                        )}, 0..@{$args->{"dates"}}-1))) ? 1 : (($_sahv_err //= (@$_sahv_dpath ? '@'.join("",map {"[$_]"} @$_sahv_dpath).": " : "") . "Not of type date"),0))), pop(@{$_sahv_dpath})]->[1])
#             ; if ($_sahv_err) { return [400, "Argument validation failed: $_sahv_err"] }
#        } # if date arg exists
#
#        # check required args
#        return [400, "Missing required argument: dates"] unless exists $args->{"dates"};
#        return [400, "Missing required value for argument: dates"] if exists($args->{"dates"}) && !defined($args->{"dates"});
#        _pci_err([500, "Extraneous command-line argument(s): ".join(", ", @check_argv)]) if @check_argv;
#        [200];
#    } else { _pci_err([500, "Unknown subcommand1: $sc_name"]); }

script/chinese-zodiac-of  view on Meta::CPAN

### Local/_pci_clean_json.pm ###
#sub _pci_clean_json { require Clone::PP; require Scalar::Util;  use feature 'state'; state $cleanser = sub {
#my $data = shift;
#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 && $refs{ $e }++) { if (++$ctr_circ <= 1) { $e = Clone::PP::clone($e); redo } else { $e = 'CIRCULAR'; $ref = '' } }
#    elsif ($ref eq 'Cpanel::JSON::XS::Boolean') { $e = $e ? 1:0; $ref = '' }
#    elsif ($ref eq 'DateTime') { $e = $e->epoch; $ref = ref($e) }
#    elsif ($ref eq 'JSON::PP::Boolean') { $e = $e ? 1:0; $ref = '' }
#    elsif ($ref eq 'JSON::XS::Boolean') { $e = $e ? 1:0; $ref = '' }
#    elsif ($ref eq 'Math::BigInt') { $e = $e->bstr; $ref = ref($e) }
#    elsif ($ref eq 'Regexp') { $e = "$e"; $ref = "" }
#    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"; $ref = "" }
#    elsif (Scalar::Util::blessed($e)) { my $reftype = Scalar::Util::reftype($e); $e = $reftype eq "HASH" ? {%{ $e }} : $reftype eq "ARRAY" ? [@{ $e }] : $reftype eq "SCALAR" ? \(my $copy = ${ $e }) : $reftype eq "CODE" ? sub { goto &{ $e } } :(die "...
#    my $reftype=Scalar::Util::reftype($e)//"";
#    if ($reftype eq "ARRAY") { $process_array->($e) }
#    elsif ($reftype 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 && $refs{ $h->{$k} }++) { if (++$ctr_circ <= 1) { $h->{$k} = Clone::PP::clone($h->{$k}); redo } else { $h->{$k} = 'CIRCULAR'; $ref = '' } }
#    elsif ($ref eq 'Cpanel::JSON::XS::Boolean') { $h->{$k} = $h->{$k} ? 1:0; $ref = '' }
#    elsif ($ref eq 'DateTime') { $h->{$k} = $h->{$k}->epoch; $ref = ref($h->{$k}) }
#    elsif ($ref eq 'JSON::PP::Boolean') { $h->{$k} = $h->{$k} ? 1:0; $ref = '' }
#    elsif ($ref eq 'JSON::XS::Boolean') { $h->{$k} = $h->{$k} ? 1:0; $ref = '' }
#    elsif ($ref eq 'Math::BigInt') { $h->{$k} = $h->{$k}->bstr; $ref = ref($h->{$k}) }
#    elsif ($ref eq 'Regexp') { $h->{$k} = "$h->{$k}"; $ref = "" }
#    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}"; $ref = "" }
#    elsif (Scalar::Util::blessed($h->{$k})) { my $reftype = Scalar::Util::reftype($h->{$k}); $h->{$k} = $reftype eq "HASH" ? {%{ $h->{$k} }} : $reftype eq "ARRAY" ? [@{ $h->{$k} }] : $reftype eq "SCALAR" ? \(my $copy = ${ $h->{$k} }) : $reftype eq "...
#    my $reftype=Scalar::Util::reftype($h->{$k})//"";
#    if ($reftype eq "ARRAY") { $process_array->($h->{$k}) }
#    elsif ($reftype eq "HASH") { $process_hash->($h->{$k}) }
#    elsif ($ref) { $h->{$k} = $ref; $ref = "" }
#} } }
#%refs = (); $ctr_circ=0;
#for ($data) { my $ref=ref($_);
#    if ($ref && $refs{ $_ }++) { if (++$ctr_circ <= 1) { $_ = Clone::PP::clone($_); redo } else { $_ = 'CIRCULAR'; $ref = '' } }
#    elsif ($ref eq 'Cpanel::JSON::XS::Boolean') { $_ = $_ ? 1:0; $ref = '' }
#    elsif ($ref eq 'DateTime') { $_ = $_->epoch; $ref = ref($_) }
#    elsif ($ref eq 'JSON::PP::Boolean') { $_ = $_ ? 1:0; $ref = '' }
#    elsif ($ref eq 'JSON::XS::Boolean') { $_ = $_ ? 1:0; $ref = '' }
#    elsif ($ref eq 'Math::BigInt') { $_ = $_->bstr; $ref = ref($_) }
#    elsif ($ref eq 'Regexp') { $_ = "$_"; $ref = "" }
#    elsif ($ref eq 'SCALAR') { $_ = ${ $_ }; $ref = ref($_) }
#    elsif ($ref eq 'Time::Moment') { $_ = $_->epoch; $ref = ref($_) }
#    elsif ($ref eq 'version') { $_ = "$_"; $ref = "" }
#    elsif (Scalar::Util::blessed($_)) { my $reftype = Scalar::Util::reftype($_); $_ = $reftype eq "HASH" ? {%{ $_ }} : $reftype eq "ARRAY" ? [@{ $_ }] : $reftype eq "SCALAR" ? \(my $copy = ${ $_ }) : $reftype eq "CODE" ? sub { goto &{ $_ } } :(die "...
#    my $reftype=Scalar::Util::reftype($_)//"";
#    if ($reftype eq "ARRAY") { $process_array->($_) }

script/zodiac-of  view on Meta::CPAN

#!perl

### begin code_after_shebang
# Note: This script is a CLI for Riap function /App/ZodiacUtils/zodiac_of
# and generated automatically using Perinci::CmdLine::Gen version 0.497

### end code_after_shebang
# PERICMD_INLINE_SCRIPT: {"allow_prereq":["DateTime"],"code_after_shebang":"...","config_dirs":null,"config_filename":"zodiac-of.conf","env_name":"ZODIAC_OF_OPT","include":null,"log":null,"pack_deps":1,"pod":0,"read_config":"0","read_env":"0","script...

my $_pci_metas = {""=>{args=>{dates=>{greedy=>1,pos=>0,req=>1,schema=>["array",{min_len=>1,of=>["date",{req=>1,"x.perl.coerce_rules"=>["From_str::natural"],"x.perl.coerce_to"=>"DateTime"},{}],req=>1},{}],summary=>"Dates","x.name.is_plural"=>1}},examp...

# This script is generated by Perinci::CmdLine::Inline version 0.550 on Mon Sep 14 07:41:34 2020.

# Rinci metadata taken from these modules: App::ZodiacUtils (no version)

# You probably should not manually edit this file.

our $DATE = '2020-09-14'; # DATE
our $VERSION = '0.115'; # VERSION
# PODNAME: zodiac-of

script/zodiac-of  view on Meta::CPAN

#            1;
#            if (@ARGV > 0) { if (exists $args->{"dates"}) { return [400, "You specified --date but also argument #0"]; } else { $args->{"dates"} = [splice(@ARGV, 0)]; } }
#        }
#        my @check_argv = @ARGV;
#        # fill from cmdline_src
#
#        # fill defaults from "default" property and check against schema
#        no warnings ('void');
#        require List::Util;
#        require Scalar::Util;
#        require DateTime::Format::Natural;
#        require DateTime;
#        my $_sahv_dpath;
#        my $_sahv_err;
#        if (exists $args->{"dates"}) {
#            $_sahv_dpath = [];
#            # req #0
#            ((defined($args->{"dates"})) ? 1 : (($_sahv_err //= (@$_sahv_dpath ? '@'.join("",map {"[$_]"} @$_sahv_dpath).": " : "") . "Required but not specified"),0))
#            
#            &&
#            
#            # check type 'array'

script/zodiac-of  view on Meta::CPAN

#            &&
#            
#            ([push(@{$_sahv_dpath}, undef), scalar(# clause: of
#            ((!defined(List::Util::first(sub {!(
#                        ($_sahv_dpath->[-1] = $_),
#                        # req #0
#                        ((defined($args->{"dates"}->[$_])) ? 1 : (($_sahv_err //= (@$_sahv_dpath ? '@'.join("",map {"[$_]"} @$_sahv_dpath).": " : "") . "Required but not specified"),0))
#                        
#                        &&
#                        
#                        # coerce rule(s): From_float::epoch, From_obj::datetime, From_obj::time_moment, From_str::iso8601, From_str::natural # coerce to: DateTime
#                        (($args->{"dates"}->[$_] = (!ref($args->{"dates"}->[$_]) && $args->{"dates"}->[$_] =~ /\A[0-9]{8,10}(?:.[0-9]+)?\z/ && $args->{"dates"}->[$_] >= 10**8 && $args->{"dates"}->[$_] <= 2**31) ? [undef,DateTime->from_epoch(epoch =>...
#                        
#                        &&
#                        
#                        # check type 'date'
#                        ((Scalar::Util::blessed($args->{"dates"}->[$_]) && $args->{"dates"}->[$_]->isa('DateTime')) ? 1 : (($_sahv_err //= (@$_sahv_dpath ? '@'.join("",map {"[$_]"} @$_sahv_dpath).": " : "") . "Not of type date"),0))
#                        )}, 0..@{$args->{"dates"}}-1))) ? 1 : (($_sahv_err //= (@$_sahv_dpath ? '@'.join("",map {"[$_]"} @$_sahv_dpath).": " : "") . "Not of type date"),0))), pop(@{$_sahv_dpath})]->[1])
#             ; if ($_sahv_err) { return [400, "Argument validation failed: $_sahv_err"] }
#        } # if date arg exists
#
#        # check required args
#        return [400, "Missing required argument: dates"] unless exists $args->{"dates"};
#        return [400, "Missing required value for argument: dates"] if exists($args->{"dates"}) && !defined($args->{"dates"});
#        _pci_err([500, "Extraneous command-line argument(s): ".join(", ", @check_argv)]) if @check_argv;
#        [200];
#    } else { _pci_err([500, "Unknown subcommand1: $sc_name"]); }

script/zodiac-of  view on Meta::CPAN

### Local/_pci_clean_json.pm ###
#sub _pci_clean_json { require Scalar::Util; require Clone::PP;  use feature 'state'; state $cleanser = sub {
#my $data = shift;
#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 && $refs{ $e }++) { if (++$ctr_circ <= 1) { $e = Clone::PP::clone($e); redo } else { $e = 'CIRCULAR'; $ref = '' } }
#    elsif ($ref eq 'Cpanel::JSON::XS::Boolean') { $e = $e ? 1:0; $ref = '' }
#    elsif ($ref eq 'DateTime') { $e = $e->epoch; $ref = ref($e) }
#    elsif ($ref eq 'JSON::PP::Boolean') { $e = $e ? 1:0; $ref = '' }
#    elsif ($ref eq 'JSON::XS::Boolean') { $e = $e ? 1:0; $ref = '' }
#    elsif ($ref eq 'Math::BigInt') { $e = $e->bstr; $ref = ref($e) }
#    elsif ($ref eq 'Regexp') { $e = "$e"; $ref = "" }
#    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"; $ref = "" }
#    elsif (Scalar::Util::blessed($e)) { my $reftype = Scalar::Util::reftype($e); $e = $reftype eq "HASH" ? {%{ $e }} : $reftype eq "ARRAY" ? [@{ $e }] : $reftype eq "SCALAR" ? \(my $copy = ${ $e }) : $reftype eq "CODE" ? sub { goto &{ $e } } :(die "...
#    my $reftype=Scalar::Util::reftype($e)//"";
#    if ($reftype eq "ARRAY") { $process_array->($e) }
#    elsif ($reftype 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 && $refs{ $h->{$k} }++) { if (++$ctr_circ <= 1) { $h->{$k} = Clone::PP::clone($h->{$k}); redo } else { $h->{$k} = 'CIRCULAR'; $ref = '' } }
#    elsif ($ref eq 'Cpanel::JSON::XS::Boolean') { $h->{$k} = $h->{$k} ? 1:0; $ref = '' }
#    elsif ($ref eq 'DateTime') { $h->{$k} = $h->{$k}->epoch; $ref = ref($h->{$k}) }
#    elsif ($ref eq 'JSON::PP::Boolean') { $h->{$k} = $h->{$k} ? 1:0; $ref = '' }
#    elsif ($ref eq 'JSON::XS::Boolean') { $h->{$k} = $h->{$k} ? 1:0; $ref = '' }
#    elsif ($ref eq 'Math::BigInt') { $h->{$k} = $h->{$k}->bstr; $ref = ref($h->{$k}) }
#    elsif ($ref eq 'Regexp') { $h->{$k} = "$h->{$k}"; $ref = "" }
#    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}"; $ref = "" }
#    elsif (Scalar::Util::blessed($h->{$k})) { my $reftype = Scalar::Util::reftype($h->{$k}); $h->{$k} = $reftype eq "HASH" ? {%{ $h->{$k} }} : $reftype eq "ARRAY" ? [@{ $h->{$k} }] : $reftype eq "SCALAR" ? \(my $copy = ${ $h->{$k} }) : $reftype eq "...
#    my $reftype=Scalar::Util::reftype($h->{$k})//"";
#    if ($reftype eq "ARRAY") { $process_array->($h->{$k}) }
#    elsif ($reftype eq "HASH") { $process_hash->($h->{$k}) }
#    elsif ($ref) { $h->{$k} = $ref; $ref = "" }
#} } }
#%refs = (); $ctr_circ=0;
#for ($data) { my $ref=ref($_);
#    if ($ref && $refs{ $_ }++) { if (++$ctr_circ <= 1) { $_ = Clone::PP::clone($_); redo } else { $_ = 'CIRCULAR'; $ref = '' } }
#    elsif ($ref eq 'Cpanel::JSON::XS::Boolean') { $_ = $_ ? 1:0; $ref = '' }
#    elsif ($ref eq 'DateTime') { $_ = $_->epoch; $ref = ref($_) }
#    elsif ($ref eq 'JSON::PP::Boolean') { $_ = $_ ? 1:0; $ref = '' }
#    elsif ($ref eq 'JSON::XS::Boolean') { $_ = $_ ? 1:0; $ref = '' }
#    elsif ($ref eq 'Math::BigInt') { $_ = $_->bstr; $ref = ref($_) }
#    elsif ($ref eq 'Regexp') { $_ = "$_"; $ref = "" }
#    elsif ($ref eq 'SCALAR') { $_ = ${ $_ }; $ref = ref($_) }
#    elsif ($ref eq 'Time::Moment') { $_ = $_->epoch; $ref = ref($_) }
#    elsif ($ref eq 'version') { $_ = "$_"; $ref = "" }
#    elsif (Scalar::Util::blessed($_)) { my $reftype = Scalar::Util::reftype($_); $_ = $reftype eq "HASH" ? {%{ $_ }} : $reftype eq "ARRAY" ? [@{ $_ }] : $reftype eq "SCALAR" ? \(my $copy = ${ $_ }) : $reftype eq "CODE" ? sub { goto &{ $_ } } :(die "...
#    my $reftype=Scalar::Util::reftype($_)//"";
#    if ($reftype eq "ARRAY") { $process_array->($_) }



( run in 0.367 second using v1.01-cache-2.11-cpan-05444aca049 )