SHARYANTO-Utils-0.77/0000755000175000017500000000000012572170671011555 5ustar s1s1SHARYANTO-Utils-0.77/README0000644000175000017500000000033512572170671012436 0ustar s1s1FAQ What is this? This distribution is a heterogenous collection of modules that will eventually have their own proper distributions. See SHARYANTO about this temporary namespace. SEE ALSO SHARYANTO SHARYANTO-Utils-0.77/lib/0000755000175000017500000000000012572170671012323 5ustar s1s1SHARYANTO-Utils-0.77/lib/SHARYANTO/0000755000175000017500000000000012572170671013673 5ustar s1s1SHARYANTO-Utils-0.77/lib/SHARYANTO/HTTP/0000755000175000017500000000000012572170671014452 5ustar s1s1SHARYANTO-Utils-0.77/lib/SHARYANTO/HTTP/DetectUA/0000755000175000017500000000000012572170671016110 5ustar s1s1SHARYANTO-Utils-0.77/lib/SHARYANTO/HTTP/DetectUA/Simple.pm0000644000175000017500000001353712572170671017710 0ustar s1s1package SHARYANTO::HTTP::DetectUA::Simple; use 5.010; require Exporter; our @ISA = qw(Exporter); our @EXPORT_OK = qw(detect_http_ua_simple); our $VERSION = '0.77'; # VERSION our %SPEC; $SPEC{":package"} = { v => 1.1, summary => 'A very simple and generic browser detection library', description => <<'_', I needed a simple and fast routine which can detect whether HTTP client is a GUI browser (like Chrome or Firefox), a text browser (like Lynx or Links), or neither (like curl, or L). Hence, this module. _ }; $SPEC{detect_http_ua_simple} = { v => 1.1, summary => 'Detect whether HTTP client is a GUI/TUI browser', description => <<'_', This function is a simple and fast routine to detect whether HTTP client is a GUI browser (like Chrome or Firefox), a text-based browser (like Lynx or Links), or neither (like curl or LWP). Extra information can be provided in the future. Currently these heuristic rules are used: * check popular browser markers in User-Agent header (e.g. 'Chrome', 'Opera'); * check Accept header for 'image/'; It is several times faster than the other equivalent Perl modules, this is because it does significantly less. _ args => { env => { pos => 0, summary => 'CGI-compatible environment, e.g. \%ENV or PSGI\'s $env', }, }, result => { description => <<'_', * 'is_gui_browser' key will be set to true if HTTP client is a GUI browser. * 'is_text_browser' key will be set to true if HTTP client is a text/TUI browser. * 'is_browser' key will be set to true if either 'is_gui_browser' or 'is_text_browser' is set to true. _ schema => 'hash*', }, links => [ {url => "pm:HTML::ParseBrowser"}, {url => "pm:HTTP::BrowserDetect"}, {url => "pm:HTTP::DetectUserAgent"}, {url => "pm:Parse::HTTP::UserAgent"}, {url => "pm:HTTP::headers::UserAgent"}, ], args_as => "array", result_naked => 0, }; sub detect_http_ua_simple { my ($env) = @_; my $res = {}; my $det; my $ua = $env->{HTTP_USER_AGENT}; if ($ua) { # check for popular browser GUI UA if ($ua =~ m!\b(?:Mozilla/|MSIE |Chrome/|Opera/| Profile/MIDP- )!x) { $res->{is_gui_browser} = 1; $det++; } # check for popular webbot UA if ($ua =~ m!\b(?:Links |ELinks/|Lynx/|w3m/)!) { $res->{is_text_browser} = 1; $det++; } } if (!$det) { # check for accept mime type my $ac = $env->{HTTP_ACCEPT}; if ($ac) { if ($ac =~ m!\b(?:image/)!) { $res->{is_gui_browser} = 1; $det++; } } } $res->{is_browser} = 1 if $res->{is_gui_browser} || $res->{is_text_browser}; $res; } 1; # ABSTRACT: A very simple and generic browser detection library __END__ =pod =encoding UTF-8 =head1 NAME SHARYANTO::HTTP::DetectUA::Simple - A very simple and generic browser detection library =head1 VERSION This document describes version 0.77 of SHARYANTO::HTTP::DetectUA::Simple (from Perl distribution SHARYANTO-Utils), released on 2015-09-04. =head1 SEE ALSO L =head1 HOMEPAGE Please visit the project's homepage at L. =head1 SOURCE Source repository is at L. =head1 BUGS Please report any bugs or feature requests on the bugtracker website L When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. =head1 AUTHOR perlancar =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2015 by perlancar@cpan.org. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =head1 DESCRIPTION I needed a simple and fast routine which can detect whether HTTP client is a GUI browser (like Chrome or Firefox), a text browser (like Lynx or Links), or neither (like curl, or L). Hence, this module. =head1 FUNCTIONS =head2 detect_http_ua_simple($env) -> [status, msg, result, meta] Detect whether HTTP client is a GUI/TUI browser. This function is a simple and fast routine to detect whether HTTP client is a GUI browser (like Chrome or Firefox), a text-based browser (like Lynx or Links), or neither (like curl or LWP). Extra information can be provided in the future. Currently these heuristic rules are used: =over =item * check popular browser markers in User-Agent header (e.g. 'Chrome', 'Opera'); =item * check Accept header for 'image/'; =back It is several times faster than the other equivalent Perl modules, this is because it does significantly less. Arguments ('*' denotes required arguments): =over 4 =item * B => I CGI-compatible environment, e.g. \%ENV or PSGI's $env. =back Returns an enveloped result (an array). First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information. Return value: (hash) =over =item * 'is_gui_browser' key will be set to true if HTTP client is a GUI browser. =item * 'is_text_browser' key will be set to true if HTTP client is a text/TUI browser. =item * 'is_browser' key will be set to true if either 'is_gui_browser' or 'is_text_browser' is set to true. =back See also: =over * L * L * L * L * L =back =cut SHARYANTO-Utils-0.77/lib/SHARYANTO/Template/0000755000175000017500000000000012572170671015446 5ustar s1s1SHARYANTO-Utils-0.77/lib/SHARYANTO/Template/Util.pm0000644000175000017500000000406212572170671016723 0ustar s1s1package SHARYANTO::Template::Util; use 5.010; require Exporter; our @ISA = qw(Exporter); our @EXPORT_OK = qw(process_tt_recursive); use File::Find; use File::Slurp::Tiny 'read_file', 'write_file'; use Template::Tiny; our $VERSION = '0.77'; # VERSION # recursively find *.tt and process them. can optionally delete the *.tt files # after processing. sub process_tt_recursive { my ($dir, $vars, $opts) = @_; $opts //= {}; my $tt = Template::Tiny->new; find sub { return unless -f; return unless /\.tt$/; my $newname = $_; $newname =~ s/\.tt$//; my $input = read_file($_); my $output; #$log->debug("Processing template $File::Find::dir/$_ -> $newname ..."); $tt->process(\$input, $vars, \$output); write_file($newname, $output); #$log->debug("Removing $File::Find::dir/$_ ..."); if ($opts->{delete}) { unlink($_) } }, $dir; } 1; # ABSTRACT: Recursively process .tt files __END__ =pod =encoding UTF-8 =head1 NAME SHARYANTO::Template::Util - Recursively process .tt files =head1 VERSION This document describes version 0.77 of SHARYANTO::Template::Util (from Perl distribution SHARYANTO-Utils), released on 2015-09-04. =head1 FUNCTIONS =head2 process_tt_recursive($dir, $vars, $opts) =head1 SEE ALSO L =head1 HOMEPAGE Please visit the project's homepage at L. =head1 SOURCE Source repository is at L. =head1 BUGS Please report any bugs or feature requests on the bugtracker website L When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. =head1 AUTHOR perlancar =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2015 by perlancar@cpan.org. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut SHARYANTO-Utils-0.77/lib/SHARYANTO/List/0000755000175000017500000000000012572170671014606 5ustar s1s1SHARYANTO-Utils-0.77/lib/SHARYANTO/List/Util.pm0000644000175000017500000001470612572170671016071 0ustar s1s1package SHARYANTO::List::Util; our $DATE = '2015-09-04'; # DATE our $VERSION = '0.77'; # VERSION use 5.010; use strict; use warnings; require Exporter; our @ISA = qw(Exporter); our @EXPORT_OK = qw( uniq_adj uniq_adj_ci uniq_ci find_missing_nums_in_seq find_missing_strs_in_seq max_in_range maxstr_in_range min_in_range minstr_in_range pick pick_n ); # TODO: minmaxstr (not included in List::MoreUtils) # TODO: minmax_in_range. minmaxstr_in_range # TODO: *_in_xrange # TODO? pick_n_distinct sub uniq_adj { my @res; return () unless @_; my $last = shift; push @res, $last; for (@_) { next if !defined($_) && !defined($last); # XXX $_ becomes stringified next if defined($_) && defined($last) && $_ eq $last; push @res, $_; $last = $_; } @res; } sub uniq_adj_ci { my @res; return () unless @_; my $last = shift; push @res, $last; for (@_) { next if !defined($_) && !defined($last); # XXX $_ becomes stringified next if defined($_) && defined($last) && lc($_) eq lc($last); push @res, $_; $last = $_; } @res; } sub uniq_ci { my @res; my %mem; for (@_) { push @res, $_ unless $mem{lc $_}++; } @res; } sub find_missing_nums_in_seq { require List::Util; my @res; my $min = List::Util::min(@_); my $max = List::Util::max(@_); my %h = map { $_=>1 } @_; for ($min..$max) { push @res, $_ unless $h{$_}; } wantarray ? @res : \@res; } sub find_missing_strs_in_seq { require List::Util; my @res; my $min = List::Util::minstr(@_); my $max = List::Util::maxstr(@_); my %h = map { $_=>1 } @_; for ($min..$max) { push @res, $_ unless $h{$_}; } wantarray ? @res : \@res; } sub max_in_range { my $lower = shift; my $upper = shift; my $ans; for (@_) { $ans = $_ if defined($_) && (!defined($ans) || $ans < $_) && (!defined($lower) || $lower <= $_) && (!defined($upper) || $upper >= $_); } $ans; } sub maxstr_in_range { my $lower = shift; my $upper = shift; my $ans; for (@_) { $ans = $_ if defined($_) && (!defined($ans) || $ans lt $_) && (!defined($lower) || $lower le $_) && (!defined($upper) || $upper ge $_); } $ans; } sub min_in_range { my $lower = shift; my $upper = shift; my $ans; for (@_) { $ans = $_ if defined($_) && (!defined($ans) || $ans > $_) && (!defined($lower) || $lower <= $_) && (!defined($upper) || $upper >= $_); } $ans; } sub minstr_in_range { my $lower = shift; my $upper = shift; my $ans; for (@_) { $ans = $_ if defined($_) && (!defined($ans) || $ans gt $_) && (!defined($lower) || $lower le $_) && (!defined($upper) || $upper ge $_); } $ans; } sub pick { $_[@_ * rand]; } sub pick_n { my $n = shift; my @res; while (@_ && @res < $n) { push @res, splice(@_, @_*rand(), 1); } @res; } 1; # ABSTRACT: List utilities __END__ =pod =encoding UTF-8 =head1 NAME SHARYANTO::List::Util - List utilities =head1 VERSION This document describes version 0.77 of SHARYANTO::List::Util (from Perl distribution SHARYANTO-Utils), released on 2015-09-04. =head1 FUNCTIONS Not exported by default but exportable. =head2 uniq_adj(@list) => LIST Remove I duplicates from list, i.e. behave more like Unix utility's B instead of L's C function, e.g. my @res = uniq(1, 4, 4, 3, 1, 1, 2); # 1, 4, 3, 1, 2 =head2 uniq_adj_ci(@list) => LIST Like C except case-insensitive. =head2 uniq_ci(@list) => LIST Like C' C except case-insensitive. =head2 find_missing_nums_in_seq(LIST) => LIST Given a list of integers, return number(s) missing in the sequence, e.g.: find_missing_nums_in_seq(1, 2, 3, 4, 7, 8); # (5, 6) =head2 find_missing_strs_in_seq(LIST) => LIST Like C, but for strings/letters "a".."z". find_missing_strs_in_seq("a", "e", "b"); # ("c", "d") find_missing_strs_in_seq("aa".."zu", "zz"); # ("zv", "zw", "zx", "zy") =head2 min_in_range($lower, $upper, @list) => $num Find lowest number C<$num> in C<@list> which still satisfies C<< $lower <= $num <= $upper >>. C<$lower> and/or C<$upper> can be undef to express no limit. =head2 minstr_in_range($lower, $upper, @list) => $str Find lowest string C<$str> in C<@list> which still satisfies C<< $lower le $x le $upper >>. C<$lower> and/or C<$upper> can be undef to express no limit. =head2 max_in_range($lower, $upper, @list) => $num Find highest number C<$num> in C<@list> which still satisfies C<< $lower <= $num <= $upper >>. C<$lower> and/or C<$upper> can be undef to express no limit. =head2 maxstr_in_range($lower, $upper, @list) => $str Find highest string C<$str> in C<@list> which still satisfies C<< $lower le $x le $upper >>. C<$lower> and/or C<$upper> can be undef to express no limit. =head2 pick(@list) => $item Randomly pick an item from list. It is actually simply done as: $_[@_ * rand] Example: pick(1, 2, 3); # => 2 pick(1, 2, 3); # => 1 =head2 pick_n($n, @list) => @picked Randomly pick C different items from list. Note that there might still be duplicate values in the result if the original list contains duplicates. pick_n(3, 1,2,3,4,5); # => (3,2,5) pick_n(2, 1,2,3,4,5); # => (3,1) pick_n(2, 1,1,1,1); # => (1,1) pick_n(4, 1,2,3); # => (3,1,2) =head1 SEE ALSO L =head1 HOMEPAGE Please visit the project's homepage at L. =head1 SOURCE Source repository is at L. =head1 BUGS Please report any bugs or feature requests on the bugtracker website L When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. =head1 AUTHOR perlancar =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2015 by perlancar@cpan.org. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut SHARYANTO-Utils-0.77/lib/SHARYANTO/Log/0000755000175000017500000000000012572170671014414 5ustar s1s1SHARYANTO-Utils-0.77/lib/SHARYANTO/Log/Util.pm0000644000175000017500000000355512572170671015677 0ustar s1s1package SHARYANTO::Log::Util; use 5.010; use strict; use warnings; require Exporter; our @ISA = qw(Exporter); our @EXPORT_OK = qw(@log_levels $log_levels_re); our $VERSION = '0.77'; # VERSION our @log_levels = (qw/trace debug info warn error fatal/); our $log_levels_re = join("|", @log_levels); $log_levels_re = qr/\A(?:$log_levels_re)\z/; 1; # ABSTRACT: Log-related utilities __END__ =pod =encoding UTF-8 =head1 NAME SHARYANTO::Log::Util - Log-related utilities =head1 VERSION This document describes version 0.77 of SHARYANTO::Log::Util (from Perl distribution SHARYANTO-Utils), released on 2015-09-04. =head1 SYNOPSIS use SHARYANTO::Log::Util qw(@log_levels $log_levels_re); =head1 DESCRIPTION =head1 VARIABLES None are exported by default, but they are exportable. =head2 @log_levels Contains log levels, from lowest to highest. Currently these are: (qw/trace debug info warn error fatal/) They can be used as method names to L ($log->debug, $log->warn, etc). =head2 $log_levels_re Contains regular expression to check valid log levels. =head1 SEE ALSO L L =head1 HOMEPAGE Please visit the project's homepage at L. =head1 SOURCE Source repository is at L. =head1 BUGS Please report any bugs or feature requests on the bugtracker website L When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. =head1 AUTHOR perlancar =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2015 by perlancar@cpan.org. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut SHARYANTO-Utils-0.77/lib/SHARYANTO/Utils.pm0000644000175000017500000000257712572170671015344 0ustar s1s1package SHARYANTO::Utils; use 5.010001; our $VERSION = '0.77'; # VERSION 1; # ABSTRACT: SHARYANTO's temporary namespace for various routines __END__ =pod =encoding UTF-8 =head1 NAME SHARYANTO::Utils - SHARYANTO's temporary namespace for various routines =head1 VERSION This document describes version 0.77 of SHARYANTO::Utils (from Perl distribution SHARYANTO-Utils), released on 2015-09-04. =head1 FAQ =head2 What is this? This distribution is a heterogenous collection of modules that will eventually have their own proper distributions. See L about this temporary namespace. =head1 SEE ALSO L =head1 HOMEPAGE Please visit the project's homepage at L. =head1 SOURCE Source repository is at L. =head1 BUGS Please report any bugs or feature requests on the bugtracker website L When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. =head1 AUTHOR perlancar =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2015 by perlancar@cpan.org. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut SHARYANTO-Utils-0.77/lib/SHARYANTO/Hash/0000755000175000017500000000000012572170671014556 5ustar s1s1SHARYANTO-Utils-0.77/lib/SHARYANTO/Hash/Util.pm0000644000175000017500000000446112572170671016036 0ustar s1s1package SHARYANTO::Hash::Util; our $DATE = '2015-09-04'; # DATE our $VERSION = '0.77'; # VERSION use 5.010; use strict; use warnings; require Exporter; our @ISA = qw(Exporter); our @EXPORT_OK = qw(rename_key replace_hash_content); sub rename_key { my ($h, $okey, $nkey) = @_; die unless exists $h->{$okey}; die if exists $h->{$nkey}; $h->{$nkey} = delete $h->{$okey}; } sub replace_hash_content { my $hashref = shift; %$hashref = @_; $hashref; } 1; # ABSTRACT: Hash utilities __END__ =pod =encoding UTF-8 =head1 NAME SHARYANTO::Hash::Util - Hash utilities =head1 VERSION This document describes version 0.77 of SHARYANTO::Hash::Util (from Perl distribution SHARYANTO-Utils), released on 2015-09-04. =head1 SYNOPSIS use SHARYANTO::Hash::Util qw(rename_key); my %h = (a=>1, b=>2); rename_key(\%h, "a", "alpha"); # %h = (alpha=>1, b=>2) =head1 FUNCTIONS =head2 rename_key(\%hash, $old_key, $new_key) Rename key. This is basically C<< $hash{$new_key} = delete $hash{$old_key} >> with a couple of additional checks. It is a shortcut for: die unless exists $hash{$old_key}; die if exists $hash{$new_key}; $hash{$new_key} = delete $hash{$old_key}; =head2 replace_hash_content($hashref, @pairs) => $hashref Replace content in <$hashref> with @list. Return C<$hashref>. Do not create a new hashref object (i.e. it is different from: C<< $hashref = {new=>"content"} >>). Do not use this function. In Perl you can just use: C<< %$hashref = @pairs >>. I put the function here for reminder. =head1 SEE ALSO L =head1 HOMEPAGE Please visit the project's homepage at L. =head1 SOURCE Source repository is at L. =head1 BUGS Please report any bugs or feature requests on the bugtracker website L When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. =head1 AUTHOR perlancar =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2015 by perlancar@cpan.org. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut SHARYANTO-Utils-0.77/lib/SHARYANTO/HTML/0000755000175000017500000000000012572170671014437 5ustar s1s1SHARYANTO-Utils-0.77/lib/SHARYANTO/HTML/Extract/0000755000175000017500000000000012572170671016051 5ustar s1s1SHARYANTO-Utils-0.77/lib/SHARYANTO/HTML/Extract/ImageLinks.pm0000644000175000017500000000663112572170671020440 0ustar s1s1package SHARYANTO::HTML::Extract::ImageLinks; our $DATE = '2015-09-04'; # DATE our $VERSION = '0.77'; # VERSION use 5.010; use strict; use warnings; use HTML::Parser; use URI::URL; use Exporter; our @ISA = qw(Exporter); our @EXPORT_OK = qw(extract_image_links); our %SPEC; $SPEC{extract_image_links} = { v => 1.1, summary => 'Extract image links from HTML document', description => <<'_', Either specify either url, html. _ args => { html => { schema => 'str*', req => 1, summary => 'HTML document to extract from', cmdline_src => 'stdin_or_files', }, base => { schema => 'str', summary => 'base URL for images', }, }, }; sub extract_image_links { my %args = @_; my $html = $args{html}; my $base = $args{base}; # get base from if exists if (!$base) { if ($html =~ /]*\bhref\s*=\s*(["']?)(\S+?)\1[^>]*>/is) { $base = $2; } } my %memory; my @res; my $p = HTML::Parser->new( api_version => 3, start_h => [ sub { my ($tagname, $attr) = @_; return unless $tagname =~ /^img$/i; for ($attr->{src}) { s/#.*//; if (++$memory{$_} == 1) { push @res, URI::URL->new($_, $base)->abs()->as_string; } } }, "tagname, attr"], ); $p->parse($html); [200, "OK", \@res]; } 1; # ABSTRACT: Extract image links from HTML document __END__ =pod =encoding UTF-8 =head1 NAME SHARYANTO::HTML::Extract::ImageLinks - Extract image links from HTML document =head1 VERSION This document describes version 0.77 of SHARYANTO::HTML::Extract::ImageLinks (from Perl distribution SHARYANTO-Utils), released on 2015-09-04. =head1 SEE ALSO L =head1 FUNCTIONS =head2 extract_image_links(%args) -> [status, msg, result, meta] Extract image links from HTML document. Either specify either url, html. Arguments ('*' denotes required arguments): =over 4 =item * B => I base URL for images. =item * B* => I HTML document to extract from. =back Returns an enveloped result (an array). First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information. Return value: (any) =head1 HOMEPAGE Please visit the project's homepage at L. =head1 SOURCE Source repository is at L. =head1 BUGS Please report any bugs or feature requests on the bugtracker website L When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. =head1 AUTHOR perlancar =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2015 by perlancar@cpan.org. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut SHARYANTO-Utils-0.77/lib/SHARYANTO/Array/0000755000175000017500000000000012572170671014751 5ustar s1s1SHARYANTO-Utils-0.77/lib/SHARYANTO/Array/Util.pm0000644000175000017500000001700512572170671016227 0ustar s1s1package SHARYANTO::Array::Util; our $DATE = '2015-09-04'; # DATE our $VERSION = '0.77'; # VERSION use 5.010; use strict; use warnings; use experimental 'smartmatch'; use Perinci::Sub::Util qw(gen_modified_sub); require Exporter; our @ISA = qw(Exporter); our @EXPORT_OK = qw( match_array_or_regex match_regex_or_array split_array replace_array_content ); our %SPEC; $SPEC{':package'} = { v => 1.1, summary => 'Array-related utilities', }; my $_str_or_re = ['any*'=>{of=>['re*','str*']}]; $SPEC{match_array_or_regex} = { v => 1.1, summary => 'Check whether an item matches (list of) values/regexes', description => <<'_', This routine can be used to match an item against a regex or a list of strings/regexes, e.g. when matching against an ACL. Since the smartmatch (`~~`) operator can already match against a list of strings or regexes, this function is currently basically equivalent to: if (ref($haystack) eq 'ARRAY') { return $needle ~~ @$haystack; } else { return $needle =~ /$haystack/; } _ examples => [ {args=>{needle=>"abc", haystack=>["abc", "abd"]}, result=>1}, {args=>{needle=>"abc", haystack=>qr/ab./}, result=>1}, {args=>{needle=>"abc", haystack=>[qr/ab./, "abd"]}, result=>1}, ], args_as => 'array', args => { needle => { schema => ["str*"], pos => 0, req => 1, }, haystack => { # XXX checking this schema might actually take longer than matching # the needle! so when arg validation is implemented, provide a way # to skip validating this schema schema => ["any*" => { of => [$_str_or_re, ["array*"=>{of=>$_str_or_re}]], }], pos => 1, req => 1, }, }, result_naked => 1, }; sub match_array_or_regex { my ($needle, $haystack) = @_; my $ref = ref($haystack); if ($ref eq 'ARRAY') { return $needle ~~ @$haystack; } elsif (!$ref) { return $needle =~ /$haystack/; } elsif ($ref eq 'Regexp') { return $needle =~ $haystack; } else { die "Invalid haystack, must be regex or array of strings/regexes"; } } gen_modified_sub( output_name => 'match_regex_or_array', base_name => 'match_array_or_regex', summary => 'Alias for match_array_or_regex', ); sub split_array { no strict 'refs'; my ($pat, $ary, $limit) = @_; die "BUG: Second argument must be an array" unless ref($ary) eq 'ARRAY'; $pat = qr/\A\Q$pat\E\z/ unless ref($pat) eq 'Regexp'; my @res; my $num_elems = 0; my $i = 0; ELEM: while ($i < @$ary) { push @res, []; COLLECT: while (1) { if ($ary->[$i] =~ $pat) { push @res, [map { ${"$_"} } 1..@+-1] if @+ > 1; last COLLECT; } push @{ $res[-1] }, $ary->[$i]; last ELEM unless ++$i < @$ary; } $num_elems++; LIMIT: if (defined($limit) && $limit > 0 && $num_elems >= $limit) { push @{ $res[-1] }, $ary->[$_] for $i..(@$ary-1); last ELEM; } $i++; } return @res; } sub replace_array_content { my $aryref = shift; @$aryref = @_; $aryref; } 1; # ABSTRACT: Array-related utilities __END__ =pod =encoding UTF-8 =head1 NAME SHARYANTO::Array::Util - Array-related utilities =head1 VERSION This document describes version 0.77 of SHARYANTO::Array::Util (from Perl distribution SHARYANTO-Utils), released on 2015-09-04. =head1 SYNOPSIS use SHARYANTO::Array::Util qw(match_array_or_regex split_array); match_array_or_regex('bar', ['foo', 'bar', qr/[xyz]/]); # true, matches string match_array_or_regex('baz', ['foo', 'bar', qr/[xyz]/]); # true, matches regex match_array_or_regex('oops', ['foo', 'bar', qr/[xyz]/]); # false my @res = split_array('--', [qw/--opt1 --opt2 -- foo bar -- --val/]); # -> ([qw/--opt1 --opt2/], [qw/foo bar/], [qw/--val/]) my @res = split_array(qr/--/, [qw/--opt1 --opt2 -- foo bar -- --val/], 2); # -> ([qw/--opt1 --opt2/], [qw/foo bar -- --val/]) my @res = split_array(qr/(--)/, [qw/--opt1 --opt2 -- foo bar -- --val/], 2); # -> ([qw/--opt1 --opt2/], [qw/--/], [qw/foo bar -- --val/]) my @res = split_array(qr/(-)(-)/, [qw/--opt1 --opt2 -- foo bar -- --val/], 2); # -> ([qw/--opt1 --opt2/], [qw/- -/], [qw/foo bar -- --val/]) =head1 DESCRIPTION =head1 FUNCTIONS =head2 match_array_or_regex($needle, $haystack) -> any Check whether an item matches (list of) values/regexes. Examples: match_array_or_regex("abc", ["abc", "abd"]); # -> 1 match_array_or_regex("abc", qr/ab./); # -> 1 match_array_or_regex("abc", [qr/ab./, "abd"]); # -> 1 This routine can be used to match an item against a regex or a list of strings/regexes, e.g. when matching against an ACL. Since the smartmatch (C<~~>) operator can already match against a list of strings or regexes, this function is currently basically equivalent to: if (ref($haystack) eq 'ARRAY') { return $needle ~~ @$haystack; } else { return $needle =~ /$haystack/; } Arguments ('*' denotes required arguments): =over 4 =item * B* => I =item * B* => I =back Return value: (any) =head2 match_regex_or_array($needle, $haystack) -> any Alias for match_array_or_regex. Examples: match_regex_or_array("abc", ["abc", "abd"]); # -> 1 match_regex_or_array("abc", qr/ab./); # -> 1 match_regex_or_array("abc", [qr/ab./, "abd"]); # -> 1 This routine can be used to match an item against a regex or a list of strings/regexes, e.g. when matching against an ACL. Since the smartmatch (C<~~>) operator can already match against a list of strings or regexes, this function is currently basically equivalent to: if (ref($haystack) eq 'ARRAY') { return $needle ~~ @$haystack; } else { return $needle =~ /$haystack/; } Arguments ('*' denotes required arguments): =over 4 =item * B* => I =item * B* => I =back Return value: (any) =head2 split_array($str_or_re, \@array[, $limit]) => LIST Like the C builtin Perl function, but applies on an array instead of a scalar. It loosely follows the C semantic, with some exceptions. =head2 replace_array_content($aryref, @elems) => $aryref Replace elements in <$aryref> with @elems. Return C<$aryref>. Do not create a new arrayref object (i.e. it is different from: C<< $aryref = ["new", "content"] >>). Do not use this function. In Perl you can just use: C<< splice(@$aryref, 0, length(@$aryref), @elems) >> or even easier: C<< @$aryref = @elems >>. I put the function here for reminder. =head1 SEE ALSO L =head1 HOMEPAGE Please visit the project's homepage at L. =head1 SOURCE Source repository is at L. =head1 BUGS Please report any bugs or feature requests on the bugtracker website L When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. =head1 AUTHOR perlancar =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2015 by perlancar@cpan.org. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut SHARYANTO-Utils-0.77/Makefile.PL0000644000175000017500000000305612572170671013533 0ustar s1s1# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.037. use strict; use warnings; use 5.010001; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( "ABSTRACT" => "SHARYANTO's temporary namespace for various routines", "AUTHOR" => "perlancar ", "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => 0 }, "DISTNAME" => "SHARYANTO-Utils", "EXE_FILES" => [], "LICENSE" => "perl", "MIN_PERL_VERSION" => "5.010001", "NAME" => "SHARYANTO::Utils", "PREREQ_PM" => { "File::Slurp::Tiny" => 0, "HTML::Parser" => 0, "Perinci::Sub::Util" => "0.38", "Template::Tiny" => 0, "URI::URL" => 0, "experimental" => 0 }, "TEST_REQUIRES" => { "File::Spec" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "Test::Exception" => 0, "Test::More" => "0.98" }, "VERSION" => "0.77", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "ExtUtils::MakeMaker" => 0, "File::Slurp::Tiny" => 0, "File::Spec" => 0, "HTML::Parser" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "Perinci::Sub::Util" => "0.38", "Template::Tiny" => 0, "Test::Exception" => 0, "Test::More" => "0.98", "URI::URL" => 0, "experimental" => 0 ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); SHARYANTO-Utils-0.77/Changes0000644000175000017500000002756412572170671013066 0ustar s1s1Revision history for SHARYANTO-Utils 0.77 2015-09-04 (PERLANCAR) - [dist] Move spec prereqs from RuntimeRequires to DevelopRecommends to reduce deps but still allow indicating spec requirement. - Split SHARYANTO::Timer::Simple to its own dist and rename to Simple-Timer. - Rename SHARYANTO::ColorTheme::Util to Color::Theme::Util. - Add functions: pick(), pick_n(), min_in_range(), max_in_range(), replace_hash_content(), replace_array_content(). - Fix typo (pointed out by Graham Todd). 0.76 2014-10-11 (PERLANCAR) - Split SHARYANTO::Text::Prompt and SHARYANTO::Locale::Util to their own dists, to reduce dependencies. 0.75 2014-06-26 (SHARYANTO) [INCOMPATIBLE CHANGES] - Move functions find_missing_{nums,strs}_in_seq() from SHARYANTO::Number::Util to SHARYANTO::List::Util. - Rename function in SHARYANTO::List::Util: uniq -> uniq_adj. [NEW FEATURES] - Add functions in SHARYANTO::List::Util: uniq_ci, uniq_adj_ci. 0.74 2014-05-21 (SHARYANTO) - Add module: SHARYANTO::List::Util. 0.73 2014-05-10 (SHARYANTO) [REMOVED FEATURES] - Remove SHARYANTO::Marpa::Simple (extracted to its own dist and renamed to MarpaX::Simple). [INTERNAL] - Replace usage of File::Slurp with File::Slurp::Tiny [RT#95478], this will be one of many such commits. 0.72 2014-05-08 (SHARYANTO) - Add module: SHARYANTO::Marpa::Simple. - Add module: SHARYANTO::Timer::Simple. 0.71 2014-05-01 (SHARYANTO) [REMOVED FEATURES] - Remove module SHARYANTO::Scalar::Util (unused, and looks_like_number() probably won't expose the constants anymore). - Remove module SHARYANTO::Version::Util (extracted to its own dist and renamed to Version::Util). - Remove module SHARYANTO::Getopt::Long::Util (extracted to its own dist and renamed to Getopt::Long::Util). - Remove module SHARYANTO::ModuleOrPrefix::Path (extracted to its own dist and renamed to ModuleOrPrefix::Path). - Remove module SHARYANTO::Proc::ChildError (extracted to its own dist and renamed to Proc::ChildError). 0.70 2014-04-07 (SHARYANTO) [BUG FIXES] - [Array::Util] Fix handling of literal string needle. 0.69 2014-04-07 (SHARYANTO) - [Array::Util] Add function split_array(). 0.68 2014-03-11 (SHARYANTO) - No functional changes. - Split SHARYANTO::Proc::Daemon::Prefork to its own dist to avoid circular dependency problem. 0.67 2014-01-09 (SHARYANTO) - No functional changes. [BUG FIXES] - Didn't pass to POSIX::setlocale() correctly. Derp. 0.66 2014-01-09 (SHARYANTO) - No functional changes. [BUG FIXES] - Locale::Util: Handle for setlocale($cat) (without specifying $locale). 0.65 2014-01-09 (SHARYANTO) - Add module: Locale::Util. 0.64 2013-11-20 (SHARYANTO) - Version::Util: add functions: version_{ne,between,in}. 0.63 2013-11-20 (SHARYANTO) - Add module: Version::Util. 0.62 2013-10-05 (SHARYANTO) - Split SHARYANTO::Role::* to SHARYANTO-Roles to make deps lighter. 0.61 2013-10-04 (SHARYANTO) - Role::ColorTheme: add color_theme_class_prefix attribute to allow overriding. 0.60 2013-10-01 (SHARYANTO) [BUG FIXES] - Role::TermAttrs: observe LINES for term_height, not ROWS. [ENHANCEMENTS] - Role::TermAttrs: add attribute 'interactive' (observes INTERACTIVE). 0.59 2013-09-28 (SHARYANTO) - Role::TermAttrs: Switch from Term::Detect to Term::Detect::Software. 0.58 2013-09-25 (SHARYANTO) - Role::BorderStyle: add get_border_char() (moved from Text::ANSITable). - Role::ColorTheme: add some functions (some moved from Text::ANSITable). Increase specification version to 1.1 because multiple color codes should now returned as hash (more flexible) instead of just 2-array element of [fg, bg]. 0.57 2013-09-25 (SHARYANTO) - Add Role::{BorderStyle,ColorTheme,TermAttrs}, extracted from Text::ANSITable. I wanted to make Perinci::CmdLine support color themes too. 0.56 2013-09-11 (SHARYANTO) - No functional changes. Slim dist down and split some modules to its own dist. Make sure this module installs on Windows (I'm trying to make Perinci::CmdLine work on Windows). 0.55 2013-09-07 (SHARYANTO) - Package::Util: Avoid deep recursion in list_subpackages(). 0.54 2013-09-04 (SHARYANTO) - Add module: ModuleOrPrefix::Path. 0.53 2013-07-26 (SHARYANTO) [INCOMPATIBLE CHANGES] - Role::Doc::Section and Role::Doc::Section::AddTextLines: Rename methods to become more consistent and less intrusive. {,before_,after_}generate_doc() becomes {,before_,after_}gen_doc(). Rename doc_gen_*() to gen_doc_section_*(). Remove doc_parse_*() methods as they are implementation details. Rename attributes indent_level to doc_indent_level, indent to doc_indent_str, wrap to doc_wrap. 0.52 2013-07-26 (SHARYANTO) - Move Perinci::To::Text::AddDocLinesRole to SHARYANTO::Role::Doc::Section::AddTextLines. 0.51 2013-07-12 (SHARYANTO) - Add module: Data::Util. - Skip File::Flock test on Windows [CT#86829]. 0.50 2013-07-03 (SHARYANTO) [INCOMPATIBLE CHANGES] - File::Flock: be more like the original File::Flock by removing lock file only if lock file was created during lock, and is empty. This module is created as a more lightweight alternative to the original File::Flock after all. 0.49 2013-07-03 (SHARYANTO) [INCOMPATIBLE CHANGES] - File::Flock: unlink option is by default 1 because this is the convenient behavior. Lock file is removed upon unlock(), not after DESTROY-ed. 0.48 2013-07-02 (SHARYANTO) [BUG FIXES] - File::Flock: handle race condition between flock() and stat() after locking. Thanks Anders Kaseorg. [GH#1] [INCOMPATIBLE CHANGES] - File::Flock: Only unlink lock file if current process is holding the lock. [GH#1] 0.47 2013-05-16 (SHARYANTO) - Color::Util: add rgb_luminance() and tint_rgb_color(). 0.46 2013-05-15 (SHARYANTO) - Role::I18N: add method locopt(). - Proc::ChildError: Skip failing tests on Windows [CT]. 0.45 2013-05-10 (SHARYANTO) - Add module: SHARYANTO::Getopt::Long::Util (gospec2human). 0.44 2013-05-09 (SHARYANTO) [BUG FIXES] - Proc::Util: get_parent_processes should not return information on current process. 0.43 2013-05-09 (SHARYANTO) - Add module: SHARYANTO::Proc::Util (get_parent_processes). 0.42 2013-05-02 (SHARYANTO) - Color::Util: add function reverse_rgb_color(). 0.41 2013-05-02 (SHARYANTO) - Color::Util: add functions rgb2grayscale() and rgb2sepia(). 0.40 2013-04-28 (SHARYANTO) - Color::Util: add function rand_rgb_color(). 0.39 2013-04-27 (SHARYANTO) - Add module: SHARYANTO::Color::Util (mix_2_rgb_colors()). 0.38 2013-04-10 (SHARYANTO) - No functional changes. Bug fixes for format_metric(). 0.37 2013-04-10 (SHARYANTO) - No functional changes. Tweak internal/private option for format_metric() for dux. 0.36 2013-04-10 (SHARYANTO) - Add module: SHARYANTO::Number::Util (format_metric()). 0.35 2013-02-15 (SHARYANTO) - No functional changes. Rewrite tests for l_abs_path() to more clearly show the differences between it and abs_path(), pass on systems where /tmp is symlinked. 0.34 2012-12-28 (SHARYANTO) - File::Flock: Shut up perl warning when unlocking a closed filehandle (usually should be harmless, can happen during DESTROY on error/die). 0.33 2012-12-26 (SHARYANTO) - File::Flock: Forgot to add $VERSION. 0.32 2012-12-25 (SHARYANTO) - File::Flock: stat after open() [suggested by Pavel Shaydo] 0.31 2012-12-25 (SHARYANTO) - Merry Christmas! - Add module: SHARYANTO::File::Flock. 0.30 2012-10-02 (SHARYANTO) - No functional changes. Fix file_util.t due to failure report by Aaron Holmgren. 0.29 2012-09-13 (SHARYANTO) - Add module: SHARYANTO::Scalar::Util. 0.28 2012-09-07 (SHARYANTO) - Proc::ChildError: explain_child_error(): Include error message $!, add tests. 0.27 2012-08-27 (SHARYANTO) - File::Util: add function: dir_empty(). 0.26 2012-08-24 (SHARYANTO) - File::Util: add function: l_abs_path(). 0.25 2012-07-27 (SHARYANTO) - Add module: SHARYANTO::Log::Util. 0.24 2012-07-27 (SHARYANTO) - Add module: SHARYANTO::File::Util. 0.23 2012-07-17 (SHARYANTO) - Package::Util: Handle constants. 0.22 2012-06-14 (SHARYANTO) - No functional changes. Proc::Daemon::Prefork: 'pid_path' argument is not required unless we daemonize. 0.21 2012-03-29 (SHARYANTO) - No functional changes. Add missing dependency to Moo [CT]. 0.20 2012-03-29 (SHARYANTO) [ENHANCEMENTS] - Package::Util: Add list_package_contents() & list_subpackages(). 0.19 2012-03-28 (SHARYANTO) [FIXES] - Small sprintf() fix for Proc::ChildError. 0.18 2012-03-23 (SHARYANTO) - No functional changes. Split SHARYANTO::String::Util to its own dist to avoid circular dependency problem with Perinci-Object. 0.17 2012-03-21 (SHARYANTO) [FIXES] - Some fixes to Role::I18Many 0.16 2012-03-20 (SHARYANTO) [ENHANCEMENTS] - Add role: SHARYANTO::Role::I18NMany - Add module: SHARYANTO::String::Util [FIXES] - dzil: Add missing dependency to Log::Any 0.15 2012-03-16 (SHARYANTO) - No functional changes. Add dependencies to Locale::Maketext{,::Lexicon} for Role::I18N users. 0.14 2012-03-15 (SHARYANTO) [INCOMPATIBLE CHANGES] - Change (split) SHARYANTO::Doc::Base base class into SHARYANTO::Role::{Doc::Section,I18N,I18NRinci}. 0.13 2012-03-14 (SHARYANTO) - Add SHARYANTO::Doc::Base. 0.12 2012-03-06 (SHARYANTO) - Add SHARYANTO::Package::Util. 0.11 2012-03-01 (SHARYANTO) - Array::Util: allow haystack to be a single string (assumed to be a regex), document that haystack can also be a list of regexes. Updated metadata to 1.1. 0.10 2011-09-29 (SHARYANTO) - Add SHARYANTO::HTTP::DetectUA::Simple. 0.09 2011-09-29 (SHARYANTO) - Proc::Daemon::Prefork: Add 'on_client_disconnect' option. 0.08 2011-09-22 (SHARYANTO) - No functional changes. Rebuild dist with newer Sub::Spec::To::Pod. 0.07 2011-09-22 (SHARYANTO) - Array::Util: Add alias function match_regex_or_array, add sub specs. 0.06 2011-09-22 (SHARYANTO) - Add SHARYANTO::Array::Util. 0.05 2011-08-05 (SHARYANTO) - Proc::Daemon::Prefork: 'access_log_path' and 'error_log_path' are now optional. 0.04 2011-07-19 (SHARYANTO) [INCOMPATIBLE CHANGES] - Proc::Daemon::Prefork: Rename 'run_as_root' to 'require_root' (less ambiguity), now defaults to 0. 0.03 2011-07-08 (SHARYANTO) [INCOMPATIBLE CHANGES] - Rename SHARYANTO::Proc::Daemon{,::Prefork} 0.02 2011-07-05 (SHARYANTO) [ENHANCEMENTS] - Proc::Daemon: add max_children(), can autoadjust number of processes from prefork() to max_children() according to load. 0.01 2011-06-17 (SHARYANTO) - First release. SHARYANTO-Utils-0.77/dist.ini0000644000175000017500000000071512572170671013224 0ustar s1s1version = 0.77 name = SHARYANTO-Utils [@Author::PERLANCAR] :version=0.23 [Prereqs / TestRequires] Test::Exception=0 Test::More=0.98 [Prereqs] perl=5.010001 experimental=0 ;Log::Any=0 ; for SHARYANTO::Array::Util Perinci::Sub::Util=0.38 ; for SHARYANTO::HTML::Extract::ImageLinks HTML::Parser=0 URI::URL=0 ; for SHARYANTO::Template::Util File::Slurp::Tiny=0 Template::Tiny=0 [Prereqs / DevelopRecommends] ;!lint_prereqs assume-used # spec Rinci=1.1.0 SHARYANTO-Utils-0.77/LICENSE0000644000175000017500000004367712572170671012603 0ustar s1s1This software is copyright (c) 2015 by perlancar@cpan.org. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2015 by perlancar@cpan.org. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2015 by perlancar@cpan.org. This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End SHARYANTO-Utils-0.77/t/0000755000175000017500000000000012572170671012020 5ustar s1s1SHARYANTO-Utils-0.77/t/00-compile.t0000644000175000017500000000267512572170671014064 0ustar s1s1use 5.006; use strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::Compile 2.053 use Test::More; plan tests => 8 + ($ENV{AUTHOR_TESTING} ? 1 : 0); my @module_files = ( 'SHARYANTO/Array/Util.pm', 'SHARYANTO/HTML/Extract/ImageLinks.pm', 'SHARYANTO/HTTP/DetectUA/Simple.pm', 'SHARYANTO/Hash/Util.pm', 'SHARYANTO/List/Util.pm', 'SHARYANTO/Log/Util.pm', 'SHARYANTO/Template/Util.pm', 'SHARYANTO/Utils.pm' ); # no fake home requested my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib'; use File::Spec; use IPC::Open3; use IO::Handle; open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!"; my @warnings; for my $lib (@module_files) { # see L my $stderr = IO::Handle->new; my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]"); binmode $stderr, ':crlf' if $^O eq 'MSWin32'; my @_warnings = <$stderr>; waitpid($pid, 0); is($?, 0, "$lib loaded ok"); shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/ and not eval { blib->VERSION('1.01') }; if (@_warnings) { warn @_warnings; push @warnings, @_warnings; } } is(scalar(@warnings), 0, 'no warnings found') or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ) if $ENV{AUTHOR_TESTING}; SHARYANTO-Utils-0.77/t/log_util.t0000644000175000017500000000046512572170671014030 0ustar s1s1#!perl use 5.010; use strict; use warnings; use experimental 'smartmatch'; use Test::More 0.96; use SHARYANTO::Log::Util qw(@log_levels $log_levels_re); ok('warn' ~~ @log_levels); ok('debug' =~ $log_levels_re); ok('foo' !~~ @log_levels); ok('foo' !~ $log_levels_re); DONE_TESTING: done_testing(); SHARYANTO-Utils-0.77/t/array_util.t0000644000175000017500000000411612572170671014362 0ustar s1s1#!perl use 5.010; use strict; use warnings; use Test::More 0.98; use SHARYANTO::Array::Util qw( match_array_or_regex match_regex_or_array split_array replace_array_content ); ok( match_array_or_regex("foo", [qw/foo bar baz/]), "match array 1"); ok(!match_array_or_regex("qux", [qw/foo bar baz/]), "match array 2"); ok( match_array_or_regex("foo", ["foo", qr/bar/]), "match array with regex 1"); ok( match_array_or_regex("bar", ["foo", qr/ba./]), "match array with regex 2"); ok(!match_array_or_regex("qux", ["foo", qr/bar/]), "match array with regex 3"); ok( match_array_or_regex("foo", "foo"), "match regex 0"); ok( match_array_or_regex("foo", qr/foo?/), "match regex 1"); ok(!match_array_or_regex("qux", qr/foo?/), "match regex 2"); eval { match_array_or_regex("foo", {}) }; my $eval_err = $@; ok($eval_err, "match invalid -> dies"); ok( match_regex_or_array("foo", qr/foo?/), "alias 1"); ok(!match_array_or_regex("qux", qr/foo?/), "alias 2"); subtest "split_array" => sub { is_deeply([split_array("x", [qw/a b x c d x e/])], [[qw/a b/], [qw/c d/], [qw/e/]], "str 1"); is_deeply([split_array("x", [qw/a b 1x c d x1 e/])], [[qw/a b 1x c d x1 e/]], "str 2"); is_deeply([split_array(qr/x/, [qw/a b 1x c d x1 e/])], [[qw/a b/], [qw/c d/], [qw/e/]], "re 1"); is_deeply([split_array(qr/x/, [qw/a b x c d x e/], 2)], [[qw/a b/], [qw/c d x e/]], "limit"); is_deeply([split_array(qr/(x)/, [qw/a b x c d x e/])], [[qw/a b/], [qw/x/], [qw/c d/], [qw/x/], [qw/e/]], "capture 1"); is_deeply([split_array(qr/(x)(x)/, [qw/a b xx c xx e/])], [[qw/a b/], [qw/x x/], [qw/c/], [qw/x x/], [qw/e/]], "capture 2"); }; subtest "replace_array_content" => sub { my $a = [1,2,3]; my $refa = "$a"; replace_array_content($a, 4, 5, 6); is_deeply($a, [4,5,6], "content changed"); is("$a", $refa, "refaddr doesn't change"); }; DONE_TESTING: done_testing(); SHARYANTO-Utils-0.77/t/release-pod-coverage.t0000644000175000017500000000057212572170671016202 0ustar s1s1#!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } # This file was automatically generated by Dist::Zilla::Plugin::PodCoverageTests. use Test::Pod::Coverage 1.08; use Pod::Coverage::TrustPod; all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' }); SHARYANTO-Utils-0.77/t/release-pod-syntax.t0000644000175000017500000000045612572170671015736 0ustar s1s1#!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. use Test::More; use Test::Pod 1.41; all_pod_files_ok(); SHARYANTO-Utils-0.77/t/release-rinci.t0000644000175000017500000000062212572170671014727 0ustar s1s1#!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } # This file was automatically generated by Dist::Zilla::Plugin::Test::Rinci. use Test::More; eval "use Test::Rinci 0.01"; plan skip_all => "Test::Rinci 0.01 required for testing Rinci metadata" if $@; metadata_in_all_modules_ok(); SHARYANTO-Utils-0.77/t/detect_http_ua_simple.t0000644000175000017500000000672012572170671016557 0ustar s1s1#!perl use 5.010; use strict; use warnings; use Test::More 0.96; use SHARYANTO::HTTP::DetectUA::Simple qw(detect_http_ua_simple); my @tests = ( # ff {env=>{HTTP_USER_AGENT=>'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20100101 Firefox/7.0.12011-10-16 20:23:00'}, gui=>1}, {env=>{HTTP_USER_AGENT=>'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6'}, gui=>1}, # ie {env=>{HTTP_USER_AGENT=>'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)'}, gui=>1}, # opera {env=>{HTTP_USER_AGENT=>'Opera/9.20 (Windows NT 6.0; U; en)'}, gui=>1}, # chrome {env=>{HTTP_USER_AGENT=>'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/18.6.872.0 Safari/535.2 UNTRUSTED/1.0 3gpp-gba UNTRUSTED/1.0'}, gui=>1}, # mobile/tablet {env=>{HTTP_USER_AGENT=>'Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.102011-10-16 20:23:50'}, gui=>1}, {env=>{HTTP_USER_AGENT=>'Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; DROID BIONIC Build/5.5.1_84_DBN-55) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1'}, gui=>1}, {env=>{HTTP_USER_AGENT=>'BlackBerry9530/4.7.0.76 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/126'}, gui=>1}, {env=>{HTTP_USER_AGENT=>'User-Agent: Opera/9.80 (J2ME/MIDP; Opera Mini/6.1.25378/25.692; U; en) Presto/2.5.25 Version/10.54'}, gui=>1}, # opera mini {env=>{HTTP_USER_AGENT=>'Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0; NOKIA; Lumia 800)'}, gui=>1}, {env=>{HTTP_USER_AGENT=>'NokiaN90-1/3.0545.5.1 Series60/2.8 Profile/MIDP-2.0 Configuration/CLDC-1.1'}, gui=>1}, # GENERIC gui {env=>{HTTP_ACCEPT=>'text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1'}, gui=>1}, # text {env=>{HTTP_USER_AGENT=>'Links (2.5; Linux 3.2.0-1-amd64 x86_64; GNU C 4.6.2;OC text)'}, text=>1}, {env=>{HTTP_USER_AGENT=>'ELinks/0.9.3 (textmode; Linux 2.6.11 i686; 79x24)'}, text=>1}, {env=>{HTTP_USER_AGENT=>'Lynx/2.8.8dev.9 libwww-FM/2.14 SSL-MM/1.4.1 GNUTLS/2.12.14'}, text=>1}, {env=>{HTTP_USER_AGENT=>'w3m/0.5.1'}, text=>1}, # NEITHER {env=>{HTTP_USER_AGENT=>'Googlebot/2.1 ( http://www.googlebot.com/bot.html) '}}, {env=>{HTTP_USER_AGENT=>'curl/7.23.1 (x86_64-pc-linux-gnu) libcurl/7.23.1 OpenSSL/1.0.0f zlib/1.2.3.4 libidn/1.23 libssh2/1.2.8 librtmp/2.3'}}, {env=>{HTTP_ACCEPT=>'*/*'}}, ); test_detect(%$_) for @tests; DONE_TESTING: done_testing; sub test_detect { my %args = @_; my $env = $args{env}; my $tname = $args{name} // ($env->{HTTP_USER_AGENT} ? "User-Agent $env->{HTTP_USER_AGENT}" : undef) // "Accept $env->{HTTP_ACCEPT}"; subtest $tname => sub { my $res; eval { $res = detect_http_ua_simple($env) }; ok(!$@, "doesnt die"); if ($args{gui}) { ok($res->{is_gui_browser}, "gui"); } else { ok(!$res->{is_gui_browser}, "not gui"); } if ($args{text}) { ok($res->{is_text_browser}, "text browser"); } else { ok(!$res->{is_text_browser}, "not text browser"); } if ($args{gui} || $args{text}) { ok($res->{is_browser}, "browser"); } else { ok(!$res->{is_browser}, "not browser"); } done_testing; }; } SHARYANTO-Utils-0.77/t/list_util.t0000644000175000017500000000370012572170671014215 0ustar s1s1#!perl use 5.010; use strict; use warnings; use Test::More 0.98; use SHARYANTO::List::Util qw( uniq_adj uniq_adj_ci uniq_ci find_missing_nums_in_seq find_missing_strs_in_seq max_in_range maxstr_in_range min_in_range minstr_in_range ); subtest "uniq_adj" => sub { is_deeply([uniq_adj(1, 2, 4, 4, 4, 2, 4)], [1, 2, 4, 2, 4]); }; subtest "uniq_adj_ci" => sub { is_deeply([uniq_adj (qw/a b B a b C c/)], [qw/a b B a b C c/]); is_deeply([uniq_adj_ci(qw/a b B a b C c/)], [qw/a b a b C/]); }; subtest "uniq_ci" => sub { #is_deeply([uniq (qw/a b B a b C c/)], [qw/a b B C c/]); is_deeply([uniq_ci(qw/a b B a b C c/)], [qw/a b C/]); }; subtest find_missing_nums_in_seq => sub { is_deeply([find_missing_nums_in_seq(1, 1, 3, 4, 6, 8, 7)], [2, 5]); }; subtest find_missing_strs_in_seq => sub { is_deeply([find_missing_strs_in_seq("a", "c", "e")], ["b", "d"]); }; subtest max_in_range => sub { is(max_in_range(undef,undef, 1,6,4,2,8), 8); is(max_in_range(undef,6, 1,6,4,2,8), 6); is(max_in_range(3,undef, 1,6,4,2,8), 8); is(max_in_range(9,undef, 1,6,4,2,8)//"undef", "undef"); is(max_in_range(3,6, 1,6,4,2,8), 6); is(max_in_range(9,9, 1,6,4,2,8)//"undef", "undef"); }; # TODO: maxstr_in_range subtest min_in_range => sub { is(min_in_range(undef,undef, 1,6,4,2,8), 1); is(min_in_range(undef,6, 1,6,4,2,8), 1); is(min_in_range(undef,0, 1,6,4,2,8)//"undef", "undef"); is(min_in_range(3,undef, 1,6,4,2,8), 4); is(min_in_range(1,undef, 1,6,4,2,8), 1); is(min_in_range(3,6, 1,6,4,2,8), 4); is(min_in_range(9,9, 1,6,4,2,8)//"undef", "undef"); }; # TODO: minstr_in_range DONE_TESTING: done_testing; SHARYANTO-Utils-0.77/t/hash_util.t0000644000175000017500000000125312572170671014166 0ustar s1s1#!perl use 5.010; use strict; use warnings; use Test::Exception; use Test::More 0.96; use SHARYANTO::Hash::Util qw(rename_key replace_hash_content); subtest "rename_key" => sub { my %h = (a=>1, b=>2); dies_ok { rename_key(\%h, "c", "d") } "old key doesn't exist -> die"; dies_ok { rename_key(\%h, "a", "b") } "new key exists -> die"; rename_key(\%h, "a", "a2"); is_deeply(\%h, {a2=>1, b=>2}, "success 1"); }; subtest "replace_hash_content" => sub { my $a = {a=>1,b=>2}; my $refa = "$a"; replace_hash_content($a, c=>3); is_deeply($a, {c=>3}, "content changed"); is("$a", $refa, "refaddr doesn't change"); }; DONE_TESTING: done_testing(); SHARYANTO-Utils-0.77/weaver.ini0000644000175000017500000000002512572170671013544 0ustar s1s1[@Author::PERLANCAR] SHARYANTO-Utils-0.77/MANIFEST0000644000175000017500000000107012572170671012704 0ustar s1s1# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.037. Changes LICENSE MANIFEST META.json META.yml Makefile.PL README dist.ini lib/SHARYANTO/Array/Util.pm lib/SHARYANTO/HTML/Extract/ImageLinks.pm lib/SHARYANTO/HTTP/DetectUA/Simple.pm lib/SHARYANTO/Hash/Util.pm lib/SHARYANTO/List/Util.pm lib/SHARYANTO/Log/Util.pm lib/SHARYANTO/Template/Util.pm lib/SHARYANTO/Utils.pm t/00-compile.t t/array_util.t t/detect_http_ua_simple.t t/hash_util.t t/list_util.t t/log_util.t t/release-pod-coverage.t t/release-pod-syntax.t t/release-rinci.t weaver.ini SHARYANTO-Utils-0.77/META.json0000644000175000017500000004245312572170671013206 0ustar s1s1{ "abstract" : "SHARYANTO's temporary namespace for various routines", "author" : [ "perlancar " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 5.037, CPAN::Meta::Converter version 2.150005", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "SHARYANTO-Utils", "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "develop" : { "recommends" : { "Rinci" : "v1.1.0" }, "requires" : { "Pod::Coverage::TrustPod" : "0", "Test::Pod" : "1.41", "Test::Pod::Coverage" : "1.08", "Test::Rinci" : "0.01" } }, "runtime" : { "requires" : { "File::Slurp::Tiny" : "0", "HTML::Parser" : "0", "Perinci::Sub::Util" : "0.38", "Template::Tiny" : "0", "URI::URL" : "0", "experimental" : "0", "perl" : "5.010001" } }, "test" : { "requires" : { "File::Spec" : "0", "IO::Handle" : "0", "IPC::Open3" : "0", "Test::Exception" : "0", "Test::More" : "0.98" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://rt.cpan.org/Public/Dist/Display.html?Name=SHARYANTO-Utils" }, "homepage" : "https://metacpan.org/release/SHARYANTO-Utils", "repository" : { "type" : "git", "url" : "git://github.com/perlancar/perl-SHARYANTO-Utils.git", "web" : "https://github.com/perlancar/perl-SHARYANTO-Utils" } }, "version" : "0.77", "x_Dist_Zilla" : { "perl" : { "version" : "5.022000" }, "plugins" : [ { "class" : "Dist::Zilla::Plugin::GatherDir", "config" : { "Dist::Zilla::Plugin::GatherDir" : { "exclude_filename" : [], "exclude_match" : [], "follow_symlinks" : "0", "include_dotfiles" : "0", "prefix" : "", "prune_directory" : [], "root" : "." } }, "name" : "@Author::PERLANCAR/@Filter/GatherDir", "version" : "5.037" }, { "class" : "Dist::Zilla::Plugin::PruneCruft", "name" : "@Author::PERLANCAR/@Filter/PruneCruft", "version" : "5.037" }, { "class" : "Dist::Zilla::Plugin::ManifestSkip", "name" : "@Author::PERLANCAR/@Filter/ManifestSkip", "version" : "5.037" }, { "class" : "Dist::Zilla::Plugin::MetaYAML", "name" : "@Author::PERLANCAR/@Filter/MetaYAML", "version" : "5.037" }, { "class" : "Dist::Zilla::Plugin::License", "name" : "@Author::PERLANCAR/@Filter/License", "version" : "5.037" }, { "class" : "Dist::Zilla::Plugin::PodCoverageTests", "name" : "@Author::PERLANCAR/@Filter/PodCoverageTests", "version" : "5.037" }, { "class" : "Dist::Zilla::Plugin::PodSyntaxTests", "name" : "@Author::PERLANCAR/@Filter/PodSyntaxTests", "version" : "5.037" }, { "class" : "Dist::Zilla::Plugin::ExtraTests", "name" : "@Author::PERLANCAR/@Filter/ExtraTests", "version" : "5.037" }, { "class" : "Dist::Zilla::Plugin::ExecDir", "name" : "@Author::PERLANCAR/@Filter/ExecDir", "version" : "5.037" }, { "class" : "Dist::Zilla::Plugin::ShareDir", "name" : "@Author::PERLANCAR/@Filter/ShareDir", "version" : "5.037" }, { "class" : "Dist::Zilla::Plugin::MakeMaker", "config" : { "Dist::Zilla::Role::TestRunner" : { "default_jobs" : 1 } }, "name" : "@Author::PERLANCAR/@Filter/MakeMaker", "version" : "5.037" }, { "class" : "Dist::Zilla::Plugin::Manifest", "name" : "@Author::PERLANCAR/@Filter/Manifest", "version" : "5.037" }, { "class" : "Dist::Zilla::Plugin::ConfirmRelease", "name" : "@Author::PERLANCAR/@Filter/ConfirmRelease", "version" : "5.037" }, { "class" : "Dist::Zilla::Plugin::UploadToCPAN", "name" : "@Author::PERLANCAR/@Filter/UploadToCPAN", "version" : "5.037" }, { "class" : "Dist::Zilla::Plugin::Rinci::AbstractFromMeta", "name" : "@Author::PERLANCAR/Rinci::AbstractFromMeta", "version" : "0.08" }, { "class" : "Dist::Zilla::Plugin::PodnameFromFilename", "name" : "@Author::PERLANCAR/PodnameFromFilename", "version" : "0.01" }, { "class" : "Dist::Zilla::Plugin::PERLANCAR::CheckDepDists", "name" : "@Author::PERLANCAR/PERLANCAR::CheckDepDists", "version" : "0.04" }, { "class" : "Dist::Zilla::Plugin::PERLANCAR::MetaResources", "name" : "@Author::PERLANCAR/PERLANCAR::MetaResources", "version" : "0.03" }, { "class" : "Dist::Zilla::Plugin::CheckChangeLog", "name" : "@Author::PERLANCAR/CheckChangeLog", "version" : "0.02" }, { "class" : "Dist::Zilla::Plugin::CheckMetaResources", "name" : "@Author::PERLANCAR/CheckMetaResources", "version" : "0.001" }, { "class" : "Dist::Zilla::Plugin::MetaJSON", "name" : "@Author::PERLANCAR/MetaJSON", "version" : "5.037" }, { "class" : "Dist::Zilla::Plugin::MetaConfig", "name" : "@Author::PERLANCAR/MetaConfig", "version" : "5.037" }, { "class" : "Dist::Zilla::Plugin::GenShellCompletion", "name" : "@Author::PERLANCAR/GenShellCompletion", "version" : "0.09" }, { "class" : "Dist::Zilla::Plugin::Authority", "name" : "@Author::PERLANCAR/Authority", "version" : "1.009" }, { "class" : "Dist::Zilla::Plugin::OurDate", "name" : "@Author::PERLANCAR/OurDate", "version" : "0.03" }, { "class" : "Dist::Zilla::Plugin::OurDist", "name" : "@Author::PERLANCAR/OurDist", "version" : "0.02" }, { "class" : "Dist::Zilla::Plugin::PERLANCAR::OurPkgVersion", "name" : "@Author::PERLANCAR/PERLANCAR::OurPkgVersion", "version" : "0.04" }, { "class" : "Dist::Zilla::Plugin::PodWeaver", "config" : { "Dist::Zilla::Plugin::PodWeaver" : { "finder" : [ ":InstallModules", ":ExecFiles" ], "plugins" : [ { "class" : "Pod::Weaver::Plugin::EnsurePod5", "name" : "@CorePrep/EnsurePod5", "version" : "4.012" }, { "class" : "Pod::Weaver::Plugin::H1Nester", "name" : "@CorePrep/H1Nester", "version" : "4.012" }, { "class" : "Pod::Weaver::Section::Name", "name" : "@Author::PERLANCAR/Name", "version" : "4.012" }, { "class" : "Pod::Weaver::Section::Version", "name" : "@Author::PERLANCAR/Version", "version" : "4.012" }, { "class" : "Pod::Weaver::Section::Region", "name" : "@Author::PERLANCAR/prelude", "version" : "4.012" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "SYNOPSIS", "version" : "4.012" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "DESCRIPTION", "version" : "4.012" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "OVERVIEW", "version" : "4.012" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "ATTRIBUTES", "version" : "4.012" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "METHODS", "version" : "4.012" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "FUNCTIONS", "version" : "4.012" }, { "class" : "Pod::Weaver::Section::Leftovers", "name" : "@Author::PERLANCAR/Leftovers", "version" : "4.012" }, { "class" : "Pod::Weaver::Section::Region", "name" : "@Author::PERLANCAR/postlude", "version" : "4.012" }, { "class" : "Pod::Weaver::Section::Completion::GetoptLongComplete", "name" : "@Author::PERLANCAR/Completion::GetoptLongComplete", "version" : "0.07" }, { "class" : "Pod::Weaver::Section::Completion::GetoptLongSubcommand", "name" : "@Author::PERLANCAR/Completion::GetoptLongSubcommand", "version" : "0.03" }, { "class" : "Pod::Weaver::Section::Completion::PerinciCmdLine", "name" : "@Author::PERLANCAR/Completion::PerinciCmdLine", "version" : "0.13" }, { "class" : "Pod::Weaver::Section::Homepage::DefaultCPAN", "name" : "@Author::PERLANCAR/Homepage::DefaultCPAN", "version" : "0.05" }, { "class" : "Pod::Weaver::Section::Source::DefaultGitHub", "name" : "@Author::PERLANCAR/Source::DefaultGitHub", "version" : "0.07" }, { "class" : "Pod::Weaver::Section::Bugs::DefaultRT", "name" : "@Author::PERLANCAR/Bugs::DefaultRT", "version" : "0.05" }, { "class" : "Pod::Weaver::Section::Authors", "name" : "@Author::PERLANCAR/Authors", "version" : "4.012" }, { "class" : "Pod::Weaver::Section::Legal", "name" : "@Author::PERLANCAR/Legal", "version" : "4.012" }, { "class" : "Pod::Weaver::Plugin::Rinci", "name" : "@Author::PERLANCAR/Rinci", "version" : "0.43" }, { "class" : "Pod::Weaver::Plugin::AppendPrepend", "name" : "@Author::PERLANCAR/AppendPrepend", "version" : "0.01" }, { "class" : "Pod::Weaver::Plugin::EnsureUniqueSections", "name" : "@Author::PERLANCAR/EnsureUniqueSections", "version" : "0.121550" }, { "class" : "Pod::Weaver::Plugin::SingleEncoding", "name" : "@Author::PERLANCAR/SingleEncoding", "version" : "4.012" } ] } }, "name" : "@Author::PERLANCAR/PodWeaver", "version" : "4.006" }, { "class" : "Dist::Zilla::Plugin::PruneFiles", "name" : "@Author::PERLANCAR/PruneFiles", "version" : "5.037" }, { "class" : "Dist::Zilla::Plugin::ReadmeFromPod", "name" : "@Author::PERLANCAR/ReadmeFromPod", "version" : "0.32" }, { "class" : "Dist::Zilla::Plugin::Rinci::AddPrereqs", "name" : "@Author::PERLANCAR/Rinci::AddPrereqs", "version" : "0.06" }, { "class" : "Dist::Zilla::Plugin::Rinci::Validate", "name" : "@Author::PERLANCAR/Rinci::Validate", "version" : "0.20" }, { "class" : "Dist::Zilla::Plugin::SetScriptShebang", "name" : "@Author::PERLANCAR/SetScriptShebang", "version" : "0.01" }, { "class" : "Dist::Zilla::Plugin::Test::Compile", "config" : { "Dist::Zilla::Plugin::Test::Compile" : { "bail_out_on_fail" : "0", "fail_on_warning" : "author", "fake_home" : "0", "filename" : "t/00-compile.t", "module_finder" : [ ":InstallModules" ], "needs_display" : "0", "phase" : "test", "script_finder" : [ ":ExecFiles" ], "skips" : [] } }, "name" : "@Author::PERLANCAR/Test::Compile", "version" : "2.053" }, { "class" : "Dist::Zilla::Plugin::Test::Rinci", "name" : "@Author::PERLANCAR/Test::Rinci", "version" : "0.02" }, { "class" : "Dist::Zilla::Plugin::EnsureSQLSchemaVersionedTest", "name" : "@Author::PERLANCAR/EnsureSQLSchemaVersionedTest", "version" : "0.01" }, { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "test", "type" : "requires" } }, "name" : "TestRequires", "version" : "5.037" }, { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "runtime", "type" : "requires" } }, "name" : "Prereqs", "version" : "5.037" }, { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "develop", "type" : "recommends" } }, "name" : "DevelopRecommends", "version" : "5.037" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":InstallModules", "version" : "5.037" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":IncModules", "version" : "5.037" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":TestFiles", "version" : "5.037" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExecFiles", "version" : "5.037" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ShareFiles", "version" : "5.037" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":MainModule", "version" : "5.037" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":AllFiles", "version" : "5.037" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":NoFiles", "version" : "5.037" } ], "zilla" : { "class" : "Dist::Zilla::Dist::Builder", "config" : { "is_trial" : "0" }, "version" : "5.037" } }, "x_authority" : "cpan:PERLANCAR" } SHARYANTO-Utils-0.77/META.yml0000644000175000017500000002655512572170671013043 0ustar s1s1--- abstract: "SHARYANTO's temporary namespace for various routines" author: - 'perlancar ' build_requires: File::Spec: '0' IO::Handle: '0' IPC::Open3: '0' Test::Exception: '0' Test::More: '0.98' configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 0 generated_by: 'Dist::Zilla version 5.037, CPAN::Meta::Converter version 2.150005' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: SHARYANTO-Utils requires: File::Slurp::Tiny: '0' HTML::Parser: '0' Perinci::Sub::Util: '0.38' Template::Tiny: '0' URI::URL: '0' experimental: '0' perl: '5.010001' resources: bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=SHARYANTO-Utils homepage: https://metacpan.org/release/SHARYANTO-Utils repository: git://github.com/perlancar/perl-SHARYANTO-Utils.git version: '0.77' x_Dist_Zilla: perl: version: '5.022000' plugins: - class: Dist::Zilla::Plugin::GatherDir config: Dist::Zilla::Plugin::GatherDir: exclude_filename: [] exclude_match: [] follow_symlinks: '0' include_dotfiles: '0' prefix: '' prune_directory: [] root: . name: '@Author::PERLANCAR/@Filter/GatherDir' version: '5.037' - class: Dist::Zilla::Plugin::PruneCruft name: '@Author::PERLANCAR/@Filter/PruneCruft' version: '5.037' - class: Dist::Zilla::Plugin::ManifestSkip name: '@Author::PERLANCAR/@Filter/ManifestSkip' version: '5.037' - class: Dist::Zilla::Plugin::MetaYAML name: '@Author::PERLANCAR/@Filter/MetaYAML' version: '5.037' - class: Dist::Zilla::Plugin::License name: '@Author::PERLANCAR/@Filter/License' version: '5.037' - class: Dist::Zilla::Plugin::PodCoverageTests name: '@Author::PERLANCAR/@Filter/PodCoverageTests' version: '5.037' - class: Dist::Zilla::Plugin::PodSyntaxTests name: '@Author::PERLANCAR/@Filter/PodSyntaxTests' version: '5.037' - class: Dist::Zilla::Plugin::ExtraTests name: '@Author::PERLANCAR/@Filter/ExtraTests' version: '5.037' - class: Dist::Zilla::Plugin::ExecDir name: '@Author::PERLANCAR/@Filter/ExecDir' version: '5.037' - class: Dist::Zilla::Plugin::ShareDir name: '@Author::PERLANCAR/@Filter/ShareDir' version: '5.037' - class: Dist::Zilla::Plugin::MakeMaker config: Dist::Zilla::Role::TestRunner: default_jobs: 1 name: '@Author::PERLANCAR/@Filter/MakeMaker' version: '5.037' - class: Dist::Zilla::Plugin::Manifest name: '@Author::PERLANCAR/@Filter/Manifest' version: '5.037' - class: Dist::Zilla::Plugin::ConfirmRelease name: '@Author::PERLANCAR/@Filter/ConfirmRelease' version: '5.037' - class: Dist::Zilla::Plugin::UploadToCPAN name: '@Author::PERLANCAR/@Filter/UploadToCPAN' version: '5.037' - class: Dist::Zilla::Plugin::Rinci::AbstractFromMeta name: '@Author::PERLANCAR/Rinci::AbstractFromMeta' version: '0.08' - class: Dist::Zilla::Plugin::PodnameFromFilename name: '@Author::PERLANCAR/PodnameFromFilename' version: '0.01' - class: Dist::Zilla::Plugin::PERLANCAR::CheckDepDists name: '@Author::PERLANCAR/PERLANCAR::CheckDepDists' version: '0.04' - class: Dist::Zilla::Plugin::PERLANCAR::MetaResources name: '@Author::PERLANCAR/PERLANCAR::MetaResources' version: '0.03' - class: Dist::Zilla::Plugin::CheckChangeLog name: '@Author::PERLANCAR/CheckChangeLog' version: '0.02' - class: Dist::Zilla::Plugin::CheckMetaResources name: '@Author::PERLANCAR/CheckMetaResources' version: '0.001' - class: Dist::Zilla::Plugin::MetaJSON name: '@Author::PERLANCAR/MetaJSON' version: '5.037' - class: Dist::Zilla::Plugin::MetaConfig name: '@Author::PERLANCAR/MetaConfig' version: '5.037' - class: Dist::Zilla::Plugin::GenShellCompletion name: '@Author::PERLANCAR/GenShellCompletion' version: '0.09' - class: Dist::Zilla::Plugin::Authority name: '@Author::PERLANCAR/Authority' version: '1.009' - class: Dist::Zilla::Plugin::OurDate name: '@Author::PERLANCAR/OurDate' version: '0.03' - class: Dist::Zilla::Plugin::OurDist name: '@Author::PERLANCAR/OurDist' version: '0.02' - class: Dist::Zilla::Plugin::PERLANCAR::OurPkgVersion name: '@Author::PERLANCAR/PERLANCAR::OurPkgVersion' version: '0.04' - class: Dist::Zilla::Plugin::PodWeaver config: Dist::Zilla::Plugin::PodWeaver: finder: - ':InstallModules' - ':ExecFiles' plugins: - class: Pod::Weaver::Plugin::EnsurePod5 name: '@CorePrep/EnsurePod5' version: '4.012' - class: Pod::Weaver::Plugin::H1Nester name: '@CorePrep/H1Nester' version: '4.012' - class: Pod::Weaver::Section::Name name: '@Author::PERLANCAR/Name' version: '4.012' - class: Pod::Weaver::Section::Version name: '@Author::PERLANCAR/Version' version: '4.012' - class: Pod::Weaver::Section::Region name: '@Author::PERLANCAR/prelude' version: '4.012' - class: Pod::Weaver::Section::Generic name: SYNOPSIS version: '4.012' - class: Pod::Weaver::Section::Generic name: DESCRIPTION version: '4.012' - class: Pod::Weaver::Section::Generic name: OVERVIEW version: '4.012' - class: Pod::Weaver::Section::Collect name: ATTRIBUTES version: '4.012' - class: Pod::Weaver::Section::Collect name: METHODS version: '4.012' - class: Pod::Weaver::Section::Collect name: FUNCTIONS version: '4.012' - class: Pod::Weaver::Section::Leftovers name: '@Author::PERLANCAR/Leftovers' version: '4.012' - class: Pod::Weaver::Section::Region name: '@Author::PERLANCAR/postlude' version: '4.012' - class: Pod::Weaver::Section::Completion::GetoptLongComplete name: '@Author::PERLANCAR/Completion::GetoptLongComplete' version: '0.07' - class: Pod::Weaver::Section::Completion::GetoptLongSubcommand name: '@Author::PERLANCAR/Completion::GetoptLongSubcommand' version: '0.03' - class: Pod::Weaver::Section::Completion::PerinciCmdLine name: '@Author::PERLANCAR/Completion::PerinciCmdLine' version: '0.13' - class: Pod::Weaver::Section::Homepage::DefaultCPAN name: '@Author::PERLANCAR/Homepage::DefaultCPAN' version: '0.05' - class: Pod::Weaver::Section::Source::DefaultGitHub name: '@Author::PERLANCAR/Source::DefaultGitHub' version: '0.07' - class: Pod::Weaver::Section::Bugs::DefaultRT name: '@Author::PERLANCAR/Bugs::DefaultRT' version: '0.05' - class: Pod::Weaver::Section::Authors name: '@Author::PERLANCAR/Authors' version: '4.012' - class: Pod::Weaver::Section::Legal name: '@Author::PERLANCAR/Legal' version: '4.012' - class: Pod::Weaver::Plugin::Rinci name: '@Author::PERLANCAR/Rinci' version: '0.43' - class: Pod::Weaver::Plugin::AppendPrepend name: '@Author::PERLANCAR/AppendPrepend' version: '0.01' - class: Pod::Weaver::Plugin::EnsureUniqueSections name: '@Author::PERLANCAR/EnsureUniqueSections' version: '0.121550' - class: Pod::Weaver::Plugin::SingleEncoding name: '@Author::PERLANCAR/SingleEncoding' version: '4.012' name: '@Author::PERLANCAR/PodWeaver' version: '4.006' - class: Dist::Zilla::Plugin::PruneFiles name: '@Author::PERLANCAR/PruneFiles' version: '5.037' - class: Dist::Zilla::Plugin::ReadmeFromPod name: '@Author::PERLANCAR/ReadmeFromPod' version: '0.32' - class: Dist::Zilla::Plugin::Rinci::AddPrereqs name: '@Author::PERLANCAR/Rinci::AddPrereqs' version: '0.06' - class: Dist::Zilla::Plugin::Rinci::Validate name: '@Author::PERLANCAR/Rinci::Validate' version: '0.20' - class: Dist::Zilla::Plugin::SetScriptShebang name: '@Author::PERLANCAR/SetScriptShebang' version: '0.01' - class: Dist::Zilla::Plugin::Test::Compile config: Dist::Zilla::Plugin::Test::Compile: bail_out_on_fail: '0' fail_on_warning: author fake_home: '0' filename: t/00-compile.t module_finder: - ':InstallModules' needs_display: '0' phase: test script_finder: - ':ExecFiles' skips: [] name: '@Author::PERLANCAR/Test::Compile' version: '2.053' - class: Dist::Zilla::Plugin::Test::Rinci name: '@Author::PERLANCAR/Test::Rinci' version: '0.02' - class: Dist::Zilla::Plugin::EnsureSQLSchemaVersionedTest name: '@Author::PERLANCAR/EnsureSQLSchemaVersionedTest' version: '0.01' - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: test type: requires name: TestRequires version: '5.037' - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: runtime type: requires name: Prereqs version: '5.037' - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: develop type: recommends name: DevelopRecommends version: '5.037' - class: Dist::Zilla::Plugin::FinderCode name: ':InstallModules' version: '5.037' - class: Dist::Zilla::Plugin::FinderCode name: ':IncModules' version: '5.037' - class: Dist::Zilla::Plugin::FinderCode name: ':TestFiles' version: '5.037' - class: Dist::Zilla::Plugin::FinderCode name: ':ExecFiles' version: '5.037' - class: Dist::Zilla::Plugin::FinderCode name: ':ShareFiles' version: '5.037' - class: Dist::Zilla::Plugin::FinderCode name: ':MainModule' version: '5.037' - class: Dist::Zilla::Plugin::FinderCode name: ':AllFiles' version: '5.037' - class: Dist::Zilla::Plugin::FinderCode name: ':NoFiles' version: '5.037' zilla: class: Dist::Zilla::Dist::Builder config: is_trial: '0' version: '5.037' x_authority: cpan:PERLANCAR