List-AllUtils-0.15/0000755000175000017500000000000013403536165013747 5ustar autarchautarchList-AllUtils-0.15/Makefile.PL0000644000175000017500000000312313403536165015720 0ustar autarchautarch# This Makefile.PL for List-AllUtils was generated by # Dist::Zilla::Plugin::DROLSKY::MakeMaker 1.01 # and Dist::Zilla::Plugin::MakeMaker::Awesome 0.42. # Don't edit it but the dist.ini and plugins used to construct it. use strict; use warnings; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( "ABSTRACT" => "Combines List::Util, List::SomeUtils and List::UtilsBy in one bite-sized package", "AUTHOR" => "Dave Rolsky ", "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => 0 }, "DISTNAME" => "List-AllUtils", "LICENSE" => "artistic_2", "NAME" => "List::AllUtils", "PREREQ_PM" => { "Exporter" => 0, "List::SomeUtils" => "0.56", "List::Util" => "1.45", "List::UtilsBy" => "0.11", "base" => 0, "strict" => 0, "warnings" => 0 }, "TEST_REQUIRES" => { "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "Sub::Util" => 0, "Test::More" => "0.96" }, "VERSION" => "0.15", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "Exporter" => 0, "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "List::SomeUtils" => "0.56", "List::Util" => "1.45", "List::UtilsBy" => "0.11", "Sub::Util" => 0, "Test::More" => "0.96", "base" => 0, "strict" => 0, "warnings" => 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); List-AllUtils-0.15/META.yml0000644000175000017500000005562513403536165015235 0ustar autarchautarch--- abstract: 'Combines List::Util, List::SomeUtils and List::UtilsBy in one bite-sized package' author: - 'Dave Rolsky ' build_requires: ExtUtils::MakeMaker: '0' File::Spec: '0' Sub::Util: '0' Test::More: '0.96' configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 0 generated_by: 'Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010' license: artistic_2 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: List-AllUtils provides: List::AllUtils: file: lib/List/AllUtils.pm version: '0.15' requires: Exporter: '0' List::SomeUtils: '0.56' List::Util: '1.45' List::UtilsBy: '0.11' base: '0' strict: '0' warnings: '0' resources: bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=List-AllUtils homepage: http://metacpan.org/release/List-AllUtils repository: git://github.com/houseabsolute/List-AllUtils.git version: '0.15' x_Dist_Zilla: perl: version: '5.026002' plugins: - class: Dist::Zilla::Plugin::Git::GatherDir config: Dist::Zilla::Plugin::GatherDir: exclude_filename: - CODE_OF_CONDUCT.md - CONTRIBUTING.md - LICENSE - Makefile.PL - README.md - cpanfile exclude_match: [] follow_symlinks: 0 include_dotfiles: 0 prefix: '' prune_directory: [] root: . Dist::Zilla::Plugin::Git::GatherDir: include_untracked: 0 name: '@DROLSKY/Git::GatherDir' version: '2.045' - class: Dist::Zilla::Plugin::ManifestSkip name: '@DROLSKY/ManifestSkip' version: '6.012' - class: Dist::Zilla::Plugin::License name: '@DROLSKY/License' version: '6.012' - class: Dist::Zilla::Plugin::ExecDir name: '@DROLSKY/ExecDir' version: '6.012' - class: Dist::Zilla::Plugin::ShareDir name: '@DROLSKY/ShareDir' version: '6.012' - class: Dist::Zilla::Plugin::Manifest name: '@DROLSKY/Manifest' version: '6.012' - class: Dist::Zilla::Plugin::CheckVersionIncrement name: '@DROLSKY/CheckVersionIncrement' version: '0.121750' - class: Dist::Zilla::Plugin::TestRelease name: '@DROLSKY/TestRelease' version: '6.012' - class: Dist::Zilla::Plugin::ConfirmRelease name: '@DROLSKY/ConfirmRelease' version: '6.012' - class: Dist::Zilla::Plugin::UploadToCPAN name: '@DROLSKY/UploadToCPAN' version: '6.012' - class: Dist::Zilla::Plugin::VersionFromMainModule config: Dist::Zilla::Role::ModuleMetadata: Module::Metadata: '1.000033' version: '0.006' name: '@DROLSKY/VersionFromMainModule' version: '0.04' - class: Dist::Zilla::Plugin::Authority name: '@DROLSKY/Authority' version: '1.009' - class: Dist::Zilla::Plugin::AutoPrereqs name: '@DROLSKY/AutoPrereqs' version: '6.012' - class: Dist::Zilla::Plugin::CopyFilesFromBuild name: '@DROLSKY/CopyFilesFromBuild' version: '0.170880' - class: Dist::Zilla::Plugin::GitHub::Meta name: '@DROLSKY/GitHub::Meta' version: '0.47' - class: Dist::Zilla::Plugin::GitHub::Update config: Dist::Zilla::Plugin::GitHub::Update: metacpan: 1 name: '@DROLSKY/GitHub::Update' version: '0.47' - class: Dist::Zilla::Plugin::MetaResources name: '@DROLSKY/MetaResources' version: '6.012' - class: Dist::Zilla::Plugin::MetaProvides::Package config: Dist::Zilla::Plugin::MetaProvides::Package: finder_objects: - class: Dist::Zilla::Plugin::FinderCode name: '@DROLSKY/MetaProvides::Package/AUTOVIV/:InstallModulesPM' version: '6.012' include_underscores: 0 Dist::Zilla::Role::MetaProvider::Provider: $Dist::Zilla::Role::MetaProvider::Provider::VERSION: '2.002004' inherit_missing: '1' inherit_version: '1' meta_noindex: '1' Dist::Zilla::Role::ModuleMetadata: Module::Metadata: '1.000033' version: '0.006' name: '@DROLSKY/MetaProvides::Package' version: '2.004003' - class: Dist::Zilla::Plugin::Meta::Contributors name: '@DROLSKY/Meta::Contributors' version: '0.003' - class: Dist::Zilla::Plugin::MetaConfig name: '@DROLSKY/MetaConfig' version: '6.012' - class: Dist::Zilla::Plugin::MetaJSON name: '@DROLSKY/MetaJSON' version: '6.012' - class: Dist::Zilla::Plugin::MetaYAML name: '@DROLSKY/MetaYAML' version: '6.012' - class: Dist::Zilla::Plugin::NextRelease name: '@DROLSKY/NextRelease' version: '6.012' - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: test type: requires name: '@DROLSKY/Test::More with subtest' version: '6.012' - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: develop type: requires name: '@DROLSKY/Modules for use with tidyall' version: '6.012' - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: develop type: requires name: '@DROLSKY/Test::Version which fixes https://github.com/plicease/Test-Version/issues/7' version: '6.012' - class: Dist::Zilla::Plugin::PromptIfStale config: Dist::Zilla::Plugin::PromptIfStale: check_all_plugins: 0 check_all_prereqs: 0 modules: - Dist::Zilla::PluginBundle::DROLSKY phase: build run_under_travis: 0 skip: [] name: '@DROLSKY/Dist::Zilla::PluginBundle::DROLSKY' version: '0.055' - class: Dist::Zilla::Plugin::PromptIfStale config: Dist::Zilla::Plugin::PromptIfStale: check_all_plugins: 1 check_all_prereqs: 1 modules: [] phase: release run_under_travis: 0 skip: - Dist::Zilla::Plugin::DROLSKY::Contributors - Dist::Zilla::Plugin::DROLSKY::Git::CheckFor::CorrectBranch - Dist::Zilla::Plugin::DROLSKY::License - Dist::Zilla::Plugin::DROLSKY::TidyAll - Dist::Zilla::Plugin::DROLSKY::WeaverConfig - Pod::Weaver::PluginBundle::DROLSKY name: '@DROLSKY/PromptIfStale' version: '0.055' - class: Dist::Zilla::Plugin::Test::Pod::Coverage::Configurable name: '@DROLSKY/Test::Pod::Coverage::Configurable' version: '0.07' - class: Dist::Zilla::Plugin::Test::PodSpelling config: Dist::Zilla::Plugin::Test::PodSpelling: directories: - bin - lib spell_cmd: '' stopwords: - ARRAYn - "BLOCK's" - DROLSKY - "DROLSKY's" - EXPR - Haskell - KEYFUNC - KVLIST - PayPal - Rolsky - "Rolsky's" - bsearchidx - drolsky - firstidx - firstres - firstval - lastidx - lastres - lastval - maxstr - minmax - minstr - natatime - notall - onlyidx - onlyres - onlyval - pairfirst - pairgrep - pairkeys - pairmap - pairvalues - probability - randomisation - specialisations - thusly - uniq - unselected - util wordlist: Pod::Wordlist name: '@DROLSKY/Test::PodSpelling' version: '2.007005' - class: Dist::Zilla::Plugin::PodSyntaxTests name: '@DROLSKY/PodSyntaxTests' version: '6.012' - class: Dist::Zilla::Plugin::DROLSKY::RunExtraTests config: Dist::Zilla::Role::TestRunner: default_jobs: 24 name: '@DROLSKY/DROLSKY::RunExtraTests' version: '1.01' - class: Dist::Zilla::Plugin::MojibakeTests name: '@DROLSKY/MojibakeTests' version: '0.8' - class: Dist::Zilla::Plugin::Test::CPAN::Changes config: Dist::Zilla::Plugin::Test::CPAN::Changes: changelog: Changes name: '@DROLSKY/Test::CPAN::Changes' version: '0.012' - class: Dist::Zilla::Plugin::Test::CPAN::Meta::JSON name: '@DROLSKY/Test::CPAN::Meta::JSON' version: '0.004' - class: Dist::Zilla::Plugin::Test::EOL config: Dist::Zilla::Plugin::Test::EOL: filename: xt/author/eol.t finder: - ':ExecFiles' - ':InstallModules' - ':TestFiles' trailing_whitespace: 1 name: '@DROLSKY/Test::EOL' version: '0.19' - class: Dist::Zilla::Plugin::Test::NoTabs config: Dist::Zilla::Plugin::Test::NoTabs: filename: xt/author/no-tabs.t finder: - ':InstallModules' - ':ExecFiles' - ':TestFiles' name: '@DROLSKY/Test::NoTabs' version: '0.15' - class: Dist::Zilla::Plugin::Test::Portability config: Dist::Zilla::Plugin::Test::Portability: options: '' name: '@DROLSKY/Test::Portability' version: '2.001000' - class: Dist::Zilla::Plugin::Test::Synopsis name: '@DROLSKY/Test::Synopsis' version: '2.000007' - class: Dist::Zilla::Plugin::Test::TidyAll name: '@DROLSKY/Test::TidyAll' version: '0.04' - 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: xt/author/00-compile.t module_finder: - ':InstallModules' needs_display: 0 phase: develop script_finder: - ':PerlExecFiles' skips: [] switch: [] name: '@DROLSKY/Test::Compile' version: '2.058' - class: Dist::Zilla::Plugin::Test::ReportPrereqs name: '@DROLSKY/Test::ReportPrereqs' version: '0.027' - class: Dist::Zilla::Plugin::Test::Version name: '@DROLSKY/Test::Version' version: '1.09' - class: Dist::Zilla::Plugin::DROLSKY::Contributors name: '@DROLSKY/DROLSKY::Contributors' version: '1.01' - class: Dist::Zilla::Plugin::Git::Contributors config: Dist::Zilla::Plugin::Git::Contributors: git_version: 2.19.2 include_authors: 0 include_releaser: 1 order_by: name paths: [] name: '@DROLSKY/Git::Contributors' version: '0.035' - class: Dist::Zilla::Plugin::SurgicalPodWeaver config: Dist::Zilla::Plugin::PodWeaver: config_plugins: - '@DROLSKY' finder: - ':InstallModules' - ':ExecFiles' plugins: - class: Pod::Weaver::Plugin::EnsurePod5 name: '@CorePrep/EnsurePod5' version: '4.015' - class: Pod::Weaver::Plugin::H1Nester name: '@CorePrep/H1Nester' version: '4.015' - class: Pod::Weaver::Plugin::SingleEncoding name: '@DROLSKY/SingleEncoding' version: '4.015' - class: Pod::Weaver::Plugin::Transformer name: '@DROLSKY/List' version: '4.015' - class: Pod::Weaver::Plugin::Transformer name: '@DROLSKY/Verbatim' version: '4.015' - class: Pod::Weaver::Section::Region name: '@DROLSKY/header' version: '4.015' - class: Pod::Weaver::Section::Name name: '@DROLSKY/Name' version: '4.015' - class: Pod::Weaver::Section::Version name: '@DROLSKY/Version' version: '4.015' - class: Pod::Weaver::Section::Region name: '@DROLSKY/prelude' version: '4.015' - class: Pod::Weaver::Section::Generic name: SYNOPSIS version: '4.015' - class: Pod::Weaver::Section::Generic name: DESCRIPTION version: '4.015' - class: Pod::Weaver::Section::Generic name: OVERVIEW version: '4.015' - class: Pod::Weaver::Section::Collect name: ATTRIBUTES version: '4.015' - class: Pod::Weaver::Section::Collect name: METHODS version: '4.015' - class: Pod::Weaver::Section::Collect name: FUNCTIONS version: '4.015' - class: Pod::Weaver::Section::Collect name: TYPES version: '4.015' - class: Pod::Weaver::Section::Leftovers name: '@DROLSKY/Leftovers' version: '4.015' - class: Pod::Weaver::Section::Region name: '@DROLSKY/postlude' version: '4.015' - class: Pod::Weaver::Section::GenerateSection name: '@DROLSKY/generate SUPPORT' version: '1.06' - class: Pod::Weaver::Section::AllowOverride name: '@DROLSKY/allow override SUPPORT' version: '0.05' - class: Pod::Weaver::Section::GenerateSection name: '@DROLSKY/generate SOURCE' version: '1.06' - class: Pod::Weaver::Section::GenerateSection name: '@DROLSKY/generate DONATIONS' version: '1.06' - class: Pod::Weaver::Section::Authors name: '@DROLSKY/Authors' version: '4.015' - class: Pod::Weaver::Section::Contributors name: '@DROLSKY/Contributors' version: '0.009' - class: Pod::Weaver::Section::Legal name: '@DROLSKY/Legal' version: '4.015' - class: Pod::Weaver::Section::Region name: '@DROLSKY/footer' version: '4.015' name: '@DROLSKY/SurgicalPodWeaver' version: '0.0023' - class: Dist::Zilla::Plugin::DROLSKY::WeaverConfig name: '@DROLSKY/DROLSKY::WeaverConfig' version: '1.01' - class: Dist::Zilla::Plugin::ReadmeAnyFromPod config: Dist::Zilla::Role::FileWatcher: version: '0.006' name: '@DROLSKY/README.md in build' version: '0.163250' - class: Dist::Zilla::Plugin::GenerateFile::FromShareDir config: Dist::Zilla::Plugin::GenerateFile::FromShareDir: destination_filename: CONTRIBUTING.md dist: Dist-Zilla-PluginBundle-DROLSKY encoding: UTF-8 has_xs: '0' location: build source_filename: CONTRIBUTING.md Dist::Zilla::Role::RepoFileInjector: allow_overwrite: 1 repo_root: . version: '0.009' name: '@DROLSKY/Generate CONTRIBUTING.md' version: '0.014' - class: Dist::Zilla::Plugin::GenerateFile::FromShareDir config: Dist::Zilla::Plugin::GenerateFile::FromShareDir: destination_filename: CODE_OF_CONDUCT.md dist: Dist-Zilla-PluginBundle-DROLSKY encoding: UTF-8 has_xs: '0' location: build source_filename: CODE_OF_CONDUCT.md Dist::Zilla::Role::RepoFileInjector: allow_overwrite: 1 repo_root: . version: '0.009' name: '@DROLSKY/Generate CODE_OF_CONDUCT.md' version: '0.014' - class: Dist::Zilla::Plugin::InstallGuide name: '@DROLSKY/InstallGuide' version: '1.200012' - class: Dist::Zilla::Plugin::CPANFile name: '@DROLSKY/CPANFile' version: '6.012' - class: Dist::Zilla::Plugin::DROLSKY::License name: '@DROLSKY/DROLSKY::License' version: '1.01' - class: Dist::Zilla::Plugin::CheckStrictVersion name: '@DROLSKY/CheckStrictVersion' version: '0.001' - class: Dist::Zilla::Plugin::CheckSelfDependency config: Dist::Zilla::Plugin::CheckSelfDependency: finder: - ':InstallModules' Dist::Zilla::Role::ModuleMetadata: Module::Metadata: '1.000033' version: '0.006' name: '@DROLSKY/CheckSelfDependency' version: '0.011' - class: Dist::Zilla::Plugin::CheckPrereqsIndexed name: '@DROLSKY/CheckPrereqsIndexed' version: '0.020' - class: Dist::Zilla::Plugin::DROLSKY::Git::CheckFor::CorrectBranch config: Dist::Zilla::Role::Git::Repo: git_version: 2.19.2 repo_root: . name: '@DROLSKY/DROLSKY::Git::CheckFor::CorrectBranch' version: '1.01' - class: Dist::Zilla::Plugin::EnsureChangesHasContent name: '@DROLSKY/EnsureChangesHasContent' version: '0.02' - class: Dist::Zilla::Plugin::Git::CheckFor::MergeConflicts config: Dist::Zilla::Role::Git::Repo: git_version: 2.19.2 repo_root: . name: '@DROLSKY/Git::CheckFor::MergeConflicts' version: '0.014' - class: Dist::Zilla::Plugin::DROLSKY::TidyAll name: '@DROLSKY/DROLSKY::TidyAll' version: '1.01' - class: Dist::Zilla::Plugin::Git::Check config: Dist::Zilla::Plugin::Git::Check: untracked_files: die Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: - CODE_OF_CONDUCT.md - CONTRIBUTING.md - Changes - LICENSE - Makefile.PL - README.md - cpanfile - tidyall.ini allow_dirty_match: [] changelog: Changes Dist::Zilla::Role::Git::Repo: git_version: 2.19.2 repo_root: . name: '@DROLSKY/Git::Check' version: '2.045' - class: Dist::Zilla::Plugin::Git::Commit config: Dist::Zilla::Plugin::Git::Commit: add_files_in: [] commit_msg: v%v%n%n%c Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: - CODE_OF_CONDUCT.md - CONTRIBUTING.md - Changes - LICENSE - Makefile.PL - README.md - cpanfile - tidyall.ini allow_dirty_match: [] changelog: Changes Dist::Zilla::Role::Git::Repo: git_version: 2.19.2 repo_root: . Dist::Zilla::Role::Git::StringFormatter: time_zone: local name: '@DROLSKY/Commit generated files' version: '2.045' - class: Dist::Zilla::Plugin::Git::Tag config: Dist::Zilla::Plugin::Git::Tag: branch: ~ changelog: Changes signed: 0 tag: v0.15 tag_format: v%v tag_message: v%v Dist::Zilla::Role::Git::Repo: git_version: 2.19.2 repo_root: . Dist::Zilla::Role::Git::StringFormatter: time_zone: local name: '@DROLSKY/Git::Tag' version: '2.045' - class: Dist::Zilla::Plugin::Git::Push config: Dist::Zilla::Plugin::Git::Push: push_to: - origin remotes_must_exist: 1 Dist::Zilla::Role::Git::Repo: git_version: 2.19.2 repo_root: . name: '@DROLSKY/Git::Push' version: '2.045' - class: Dist::Zilla::Plugin::BumpVersionAfterRelease config: Dist::Zilla::Plugin::BumpVersionAfterRelease: finders: - ':ExecFiles' - ':InstallModules' global: 0 munge_makefile_pl: 1 name: '@DROLSKY/BumpVersionAfterRelease' version: '0.018' - class: Dist::Zilla::Plugin::Git::Commit config: Dist::Zilla::Plugin::Git::Commit: add_files_in: [] commit_msg: 'Bump version after release' Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: - Changes - dist.ini allow_dirty_match: - (?^:.+) changelog: Changes Dist::Zilla::Role::Git::Repo: git_version: 2.19.2 repo_root: . Dist::Zilla::Role::Git::StringFormatter: time_zone: local name: '@DROLSKY/Commit version bump' version: '2.045' - class: Dist::Zilla::Plugin::Git::Push config: Dist::Zilla::Plugin::Git::Push: push_to: - origin remotes_must_exist: 1 Dist::Zilla::Role::Git::Repo: git_version: 2.19.2 repo_root: . name: '@DROLSKY/Push version bump' version: '2.045' - class: Dist::Zilla::Plugin::DROLSKY::MakeMaker config: Dist::Zilla::Plugin::MakeMaker: make_path: make version: '6.012' Dist::Zilla::Plugin::MakeMaker::Awesome: version: '0.42' Dist::Zilla::Role::TestRunner: default_jobs: 24 version: '6.012' name: '@DROLSKY/DROLSKY::MakeMaker' version: '1.01' - class: Dist::Zilla::Plugin::FinderCode name: ':InstallModules' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':IncModules' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':TestFiles' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':ExtraTestFiles' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':ExecFiles' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':PerlExecFiles' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':ShareFiles' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':MainModule' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':AllFiles' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':NoFiles' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: '@DROLSKY/MetaProvides::Package/AUTOVIV/:InstallModulesPM' version: '6.012' zilla: class: Dist::Zilla::Dist::Builder config: is_trial: '0' version: '6.012' x_authority: cpan:DROLSKY x_contributors: - 'Karen Etheridge ' - 'Ricardo Signes ' - 'Yanick Champoux ' x_generated_by_perl: v5.26.2 x_serialization_backend: 'YAML::Tiny version 1.73' List-AllUtils-0.15/Changes0000644000175000017500000000457313403536165015253 0ustar autarchautarch0.15 2018-12-10 - Require List::UtilsBy 0.11 and include the docs from that version. - Require List::SomeUtils 0.56 and include the docs from that version. 0.14 2017-02-07 - Re-release after git pull of some changes. 0.13 2017-02-07 - The docs for the subs from List::UtilsBy were repeated twice. Reported by Andy Lester. RT #120123. 0.12 2016-10-16 - Nothing from List::UtilsBy was actually being exported, because of a typo and a lack of testing. Reported by Greg Oschwald. GitHub #5. 0.11 2016-06-26 - Added List::UtilsBy to the list of included modules. Based on a patch from Yanick Champoux. GH #3. 0.10 2016-05-08 - Switched from List::MoreUtils to List::SomeUtils. This should not change any functionality of the module. - Make the test for subroutine redefined warnings much more specific. Previously tests could fail because of totally unrelated warnings from other modules. Reported by ribasushi. RT #113740. 0.09 2014-10-05 - Clarify which of List::Util and List::MoreUtils wins when they both provide the same function. Requested by Karen Etheridge. RT #98560. 0.08 2014-04-01 - This version now works with both List::MoreUtils 0.28-0.33 and the latest trial version, 0.400_006. Note that it does not work with earlier versions of 0.400. 0.07 2013-10-14 - The last version totally broke all exports from List::MoreUtils. Now there are actual tests for this. Reported by Tatsuhiko Miyagawa. RT #89509. 0.06 2013-10-14 - List::Util 1.33 provides some subs that are also provided by List::MoreUtils. This caused subroutine redefeined warnings. List::AllUtils now only imports subs from List::MoreUtils that aren't defined by List::Util. This works with List::Util 1.31+. Reported by Zefram. RT #89467. 0.05 2013-08-30 - Really require List::Util 1.31, instead of just saying so in the Changes. Reported by Przemysław Wesołek. RT #88296 0.04 2013-08-25 - Updated to require List::Util 1.31, which includes a bunch of new pairwise functions. 0.03 2012-02-21 - Updated docs to match List::MoreUtils 0.28+. Reported by ilmari. RT #75196. 0.02 2009-09-12 - Added a generated Makefile.PL. Fixes RT #48805. - Code tweak so that this module will always export everything exported by List::Util, even if that module adds new functions. 0.01 2009-01-23 - First version, released on an unsuspecting world. List-AllUtils-0.15/CONTRIBUTING.md0000644000175000017500000000761013403536165016204 0ustar autarchautarch# CONTRIBUTING Thank you for considering contributing to this distribution. This file contains instructions that will help you work with the source code. Please note that if you have any questions or difficulties, you can reach the maintainer(s) through the bug queue described later in this document (preferred), or by emailing the releaser directly. You are not required to follow any of the steps in this document to submit a patch or bug report; these are just recommendations, intended to help you (and help us help you faster). The distribution is managed with [Dist::Zilla](https://metacpan.org/release/Dist-Zilla). However, you can still compile and test the code with the `MakeFile.PL` in the repository: perl Makefile.PL make make test You may need to satisfy some dependencies. The easiest way to satisfy dependencies is to install the last release. This is available at https://metacpan.org/release/List-AllUtils You can use [`cpanminus`](https://metacpan.org/pod/App::cpanminus) to do this without downloading the tarball first: $ cpanm --reinstall --installdeps --with-recommends List::AllUtils [`Dist::Zilla`](https://metacpan.org/pod/Dist::Zilla) is a very powerful authoring tool, but requires a number of author-specific plugins. If you would like to use it for contributing, install it from CPAN, then the following command to install the needed distros: $ dzil authordeps --missing | cpanm There may also be additional requirements not needed by the dzil build which are needed for tests or other development: $ dzil listdeps --author --missing | cpanm Or, you can use the 'dzil stale' command to install all requirements at once: $ cpanm Dist::Zilla::App::Command::stale $ dzil stale --all | cpanm You can also do this via cpanm directly: $ cpanm --reinstall --installdeps --with-develop --with-recommends List::AllUtils Once installed, here are some dzil commands you might try: $ dzil build $ dzil test $ dzil test --release $ dzil xtest $ dzil listdeps --json $ dzil build --notgz You can learn more about Dist::Zilla at http://dzil.org/. The code for this distribution is [hosted on GitHub](https://github.com/houseabsolute/List-AllUtils). You can submit code changes by forking the repository, pushing your code changes to your clone, and then submitting a pull request. See the GitHub documentation for [detailed instructions on pull requests](https://help.github.com/articles/creating-a-pull-request) If you have found a bug, but do not have an accompanying patch to fix it, you can submit an issue report [via the web](http://rt.cpan.org/Public/Dist/Display.html?Name=List-AllUtils) or [via email](bug-list-allutils@rt.cpan.org). ## Continuous Integration All pull requests for this distribution will be automatically tested on Linux by [Travis](https://travis-ci.org/houseabsolute/List-AllUtils). All CI results will be visible in the pull request on GitHub. Follow the appropriate links for details when tests fail. ## TidyAll This distribution uses [Code::TidyAll](https://metacpan.org/release/Code-TidyAll) to enforce a uniform coding style. This is tested as part of the author testing suite. You can install and run tidyall by running the following commands: $ cpanm Code::TidyAll $ tidyall -a Please run this before committing your changes and address any issues it brings up. ## Contributor Names If you send a patch or pull request, your name and email address will be included in the documentation as a contributor (using the attribution on the commit or patch), unless you specifically request for it not to be. If you wish to be listed under a different name or address, you should submit a pull request to the `.mailmap` file to contain the correct mapping. ## Generated By This file was generated via Dist::Zilla::Plugin::GenerateFile::FromShareDir 0.014 from a template file originating in Dist-Zilla-PluginBundle-DROLSKY-1.01. List-AllUtils-0.15/LICENSE0000644000175000017500000002152013403536165014754 0ustar autarchautarchThis software is Copyright (c) 2018 by Dave Rolsky. This is free software, licensed under: The Artistic License 2.0 (GPL Compatible) The Artistic License 2.0 Copyright (c) 2000-2006, The Perl Foundation. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble This license establishes the terms under which a given free software Package may be copied, modified, distributed, and/or redistributed. The intent is that the Copyright Holder maintains some artistic control over the development of that Package while still keeping the Package available as open source and free software. You are always permitted to make arrangements wholly outside of this license directly with the Copyright Holder of a given Package. If the terms of this license do not permit the full use that you propose to make of the Package, you should contact the Copyright Holder and seek a different licensing arrangement. Definitions "Copyright Holder" means the individual(s) or organization(s) named in the copyright notice for the entire Package. "Contributor" means any party that has contributed code or other material to the Package, in accordance with the Copyright Holder's procedures. "You" and "your" means any person who would like to copy, distribute, or modify the Package. "Package" means the collection of files distributed by the Copyright Holder, and derivatives of that collection and/or of those files. A given Package may consist of either the Standard Version, or a Modified Version. "Distribute" means providing a copy of the Package or making it accessible to anyone else, or in the case of a company or organization, to others outside of your company or organization. "Distributor Fee" means any fee that you charge for Distributing this Package or providing support for this Package to another party. It does not mean licensing fees. "Standard Version" refers to the Package if it has not been modified, or has been modified only in ways explicitly requested by the Copyright Holder. "Modified Version" means the Package, if it has been changed, and such changes were not explicitly requested by the Copyright Holder. "Original License" means this Artistic License as Distributed with the Standard Version of the Package, in its current version or as it may be modified by The Perl Foundation in the future. "Source" form means the source code, documentation source, and configuration files for the Package. "Compiled" form means the compiled bytecode, object code, binary, or any other form resulting from mechanical transformation or translation of the Source form. Permission for Use and Modification Without Distribution (1) You are permitted to use the Standard Version and create and use Modified Versions for any purpose without restriction, provided that you do not Distribute the Modified Version. Permissions for Redistribution of the Standard Version (2) You may Distribute verbatim copies of the Source form of the Standard Version of this Package in any medium without restriction, either gratis or for a Distributor Fee, provided that you duplicate all of the original copyright notices and associated disclaimers. At your discretion, such verbatim copies may or may not include a Compiled form of the Package. (3) You may apply any bug fixes, portability changes, and other modifications made available from the Copyright Holder. The resulting Package will still be considered the Standard Version, and as such will be subject to the Original License. Distribution of Modified Versions of the Package as Source (4) You may Distribute your Modified Version as Source (either gratis or for a Distributor Fee, and with or without a Compiled form of the Modified Version) provided that you clearly document how it differs from the Standard Version, including, but not limited to, documenting any non-standard features, executables, or modules, and provided that you do at least ONE of the following: (a) make the Modified Version available to the Copyright Holder of the Standard Version, under the Original License, so that the Copyright Holder may include your modifications in the Standard Version. (b) ensure that installation of your Modified Version does not prevent the user installing or running the Standard Version. In addition, the Modified Version must bear a name that is different from the name of the Standard Version. (c) allow anyone who receives a copy of the Modified Version to make the Source form of the Modified Version available to others under (i) the Original License or (ii) a license that permits the licensee to freely copy, modify and redistribute the Modified Version using the same licensing terms that apply to the copy that the licensee received, and requires that the Source form of the Modified Version, and of any works derived from it, be made freely available in that license fees are prohibited but Distributor Fees are allowed. Distribution of Compiled Forms of the Standard Version or Modified Versions without the Source (5) You may Distribute Compiled forms of the Standard Version without the Source, provided that you include complete instructions on how to get the Source of the Standard Version. Such instructions must be valid at the time of your distribution. If these instructions, at any time while you are carrying out such distribution, become invalid, you must provide new instructions on demand or cease further distribution. If you provide valid instructions or cease distribution within thirty days after you become aware that the instructions are invalid, then you do not forfeit any of your rights under this license. (6) You may Distribute a Modified Version in Compiled form without the Source, provided that you comply with Section 4 with respect to the Source of the Modified Version. Aggregating or Linking the Package (7) You may aggregate the Package (either the Standard Version or Modified Version) with other packages and Distribute the resulting aggregation provided that you do not charge a licensing fee for the Package. Distributor Fees are permitted, and licensing fees for other components in the aggregation are permitted. The terms of this license apply to the use and Distribution of the Standard or Modified Versions as included in the aggregation. (8) You are permitted to link Modified and Standard Versions with other works, to embed the Package in a larger work of your own, or to build stand-alone binary or bytecode versions of applications that include the Package, and Distribute the result without restriction, provided the result does not expose a direct interface to the Package. Items That are Not Considered Part of a Modified Version (9) Works (including, but not limited to, modules and scripts) that merely extend or make use of the Package, do not, by themselves, cause the Package to be a Modified Version. In addition, such works are not considered parts of the Package itself, and are not subject to the terms of this license. General Provisions (10) Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license. (11) If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license. (12) This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder. (13) This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed. (14) Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. List-AllUtils-0.15/README.md0000644000175000017500000011006513403536165015231 0ustar autarchautarch# NAME List::AllUtils - Combines List::Util, List::SomeUtils and List::UtilsBy in one bite-sized package # VERSION version 0.15 # SYNOPSIS use List::AllUtils qw( first any ); # _Everything_ from List::Util, List::SomeUtils, and List::UtilsBy use List::AllUtils qw( :all ); my @numbers = ( 1, 2, 3, 5, 7 ); # or don't import anything return List::AllUtils::first { $_ > 5 } @numbers; # DESCRIPTION Are you sick of trying to remember whether a particular helper is defined in [List::Util](https://metacpan.org/pod/List::Util), [List::SomeUtils](https://metacpan.org/pod/List::SomeUtils) or [List::UtilsBy](https://metacpan.org/pod/List::UtilsBy)? I sure am. Now you don't have to remember. This module will export all of the functions that either of those three modules defines. Note that all function documentation has been shamelessly copied from [List::Util](https://metacpan.org/pod/List::Util), [List::SomeUtils](https://metacpan.org/pod/List::SomeUtils) and [List::UtilsBy](https://metacpan.org/pod/List::UtilsBy). ## Which One Wins? Recently, [List::Util](https://metacpan.org/pod/List::Util) has started including some of the subs that used to only be in [List::SomeUtils](https://metacpan.org/pod/List::SomeUtils). Similar, [List::SomeUtils](https://metacpan.org/pod/List::SomeUtils) has some small overlap with [List::UtilsBy](https://metacpan.org/pod/List::UtilsBy). `List::AllUtils` always favors the version provided by [List::Util](https://metacpan.org/pod/List::Util), [List::SomeUtils](https://metacpan.org/pod/List::SomeUtils) or [List::UtilsBy](https://metacpan.org/pod/List::UtilsBy) in that order. The docs below come from [List::Util](https://metacpan.org/pod/List::Util) 1.31, [List::SomeUtils](https://metacpan.org/pod/List::SomeUtils) 0.50, and [List::UtilsBy](https://metacpan.org/pod/List::UtilsBy) 0.10. # WHAT IS EXPORTED? All this module does is load [List::Util](https://metacpan.org/pod/List::Util), [List::SomeUtils](https://metacpan.org/pod/List::SomeUtils), and [List::UtilsBy](https://metacpan.org/pod/List::UtilsBy), and then re-export everything that they provide. That means that regardless of the documentation below, you will get any subroutine that your installed version provides. # LIST-REDUCTION FUNCTIONS The following set of functions all reduce a list down to a single value. ## reduce BLOCK LIST Reduces LIST by calling BLOCK, in a scalar context, multiple times, setting `$a` and `$b` each time. The first call will be with `$a` and `$b` set to the first two elements of the list, subsequent calls will be done by setting `$a` to the result of the previous call and `$b` to the next element in the list. Returns the result of the last call to BLOCK. If LIST is empty then `undef` is returned. If LIST only contains one element then that element is returned and BLOCK is not executed. $foo = reduce { $a < $b ? $a : $b } 1..10 # min $foo = reduce { $a lt $b ? $a : $b } 'aa'..'zz' # minstr $foo = reduce { $a + $b } 1 .. 10 # sum $foo = reduce { $a . $b } @bar # concat If your algorithm requires that `reduce` produce an identity value, then make sure that you always pass that identity value as the first argument to prevent `undef` being returned $foo = reduce { $a + $b } 0, @values; # sum with 0 identity value The remaining list-reduction functions are all specialisations of this generic idea. ## first BLOCK LIST Similar to `grep` in that it evaluates BLOCK setting `$_` to each element of LIST in turn. `first` returns the first element where the result from BLOCK is a true value. If BLOCK never returns true or LIST was empty then `undef` is returned. $foo = first { defined($_) } @list # first defined value in @list $foo = first { $_ > $value } @list # first value in @list which # is greater than $value This function could be implemented using `reduce` like this $foo = reduce { defined($a) ? $a : wanted($b) ? $b : undef } undef, @list for example wanted() could be defined() which would return the first defined value in @list ## max LIST Returns the entry in the list with the highest numerical value. If the list is empty then `undef` is returned. $foo = max 1..10 # 10 $foo = max 3,9,12 # 12 $foo = max @bar, @baz # whatever This function could be implemented using `reduce` like this $foo = reduce { $a > $b ? $a : $b } 1..10 ## maxstr LIST Similar to `max`, but treats all the entries in the list as strings and returns the highest string as defined by the `gt` operator. If the list is empty then `undef` is returned. $foo = maxstr 'A'..'Z' # 'Z' $foo = maxstr "hello","world" # "world" $foo = maxstr @bar, @baz # whatever This function could be implemented using `reduce` like this $foo = reduce { $a gt $b ? $a : $b } 'A'..'Z' ## min LIST Similar to `max` but returns the entry in the list with the lowest numerical value. If the list is empty then `undef` is returned. $foo = min 1..10 # 1 $foo = min 3,9,12 # 3 $foo = min @bar, @baz # whatever This function could be implemented using `reduce` like this $foo = reduce { $a < $b ? $a : $b } 1..10 ## minstr LIST Similar to `min`, but treats all the entries in the list as strings and returns the lowest string as defined by the `lt` operator. If the list is empty then `undef` is returned. $foo = minstr 'A'..'Z' # 'A' $foo = minstr "hello","world" # "hello" $foo = minstr @bar, @baz # whatever This function could be implemented using `reduce` like this $foo = reduce { $a lt $b ? $a : $b } 'A'..'Z' ## sum LIST Returns the sum of all the elements in LIST. If LIST is empty then `undef` is returned. $foo = sum 1..10 # 55 $foo = sum 3,9,12 # 24 $foo = sum @bar, @baz # whatever This function could be implemented using `reduce` like this $foo = reduce { $a + $b } 1..10 ## sum0 LIST Similar to `sum`, except this returns 0 when given an empty list, rather than `undef`. # KEY/VALUE PAIR LIST FUNCTIONS The following set of functions, all inspired by [List::Pairwise](https://metacpan.org/pod/List::Pairwise), consume an even-sized list of pairs. The pairs may be key/value associations from a hash, or just a list of values. The functions will all preserve the original ordering of the pairs, and will not be confused by multiple pairs having the same "key" value - nor even do they require that the first of each pair be a plain string. ## pairgrep BLOCK KVLIST Similar to perl's `grep` keyword, but interprets the given list as an even-sized list of pairs. It invokes the BLOCK multiple times, in scalar context, with `$a` and `$b` set to successive pairs of values from the KVLIST. Returns an even-sized list of those pairs for which the BLOCK returned true in list context, or the count of the **number of pairs** in scalar context. (Note, therefore, in scalar context that it returns a number half the size of the count of items it would have returned in list context). @subset = pairgrep { $a =~ m/^[[:upper:]]+$/ } @kvlist Similar to `grep`, `pairgrep` aliases `$a` and `$b` to elements of the given list. Any modifications of it by the code block will be visible to the caller. ## pairfirst BLOCK KVLIST Similar to the `first` function, but interprets the given list as an even-sized list of pairs. It invokes the BLOCK multiple times, in scalar context, with `$a` and `$b` set to successive pairs of values from the KVLIST. Returns the first pair of values from the list for which the BLOCK returned true in list context, or an empty list of no such pair was found. In scalar context it returns a simple boolean value, rather than either the key or the value found. ( $key, $value ) = pairfirst { $a =~ m/^[[:upper:]]+$/ } @kvlist Similar to `grep`, `pairfirst` aliases `$a` and `$b` to elements of the given list. Any modifications of it by the code block will be visible to the caller. ## pairmap BLOCK KVLIST Similar to perl's `map` keyword, but interprets the given list as an even-sized list of pairs. It invokes the BLOCK multiple times, in list context, with `$a` and `$b` set to successive pairs of values from the KVLIST. Returns the concatenation of all the values returned by the BLOCK in list context, or the count of the number of items that would have been returned in scalar context. @result = pairmap { "The key $a has value $b" } @kvlist Similar to `map`, `pairmap` aliases `$a` and `$b` to elements of the given list. Any modifications of it by the code block will be visible to the caller. ## pairs KVLIST A convenient shortcut to operating on even-sized lists of pairs, this function returns a list of ARRAY references, each containing two items from the given list. It is a more efficient version of pairmap { [ $a, $b ] } KVLIST It is most convenient to use in a `foreach` loop, for example: foreach ( pairs @KVLIST ) { my ( $key, $value ) = @$_; ... } ## pairkeys KVLIST A convenient shortcut to operating on even-sized lists of pairs, this function returns a list of the the first values of each of the pairs in the given list. It is a more efficient version of pairmap { $a } KVLIST ## pairvalues KVLIST A convenient shortcut to operating on even-sized lists of pairs, this function returns a list of the the second values of each of the pairs in the given list. It is a more efficient version of pairmap { $b } KVLIST # OTHER FUNCTIONS ## shuffle LIST Returns the elements of LIST in a random order @cards = shuffle 0..51 # 0..51 in a random order # List::SomeUtils FUNCTIONS ## Junctions ### _Treatment of an empty list_ There are two schools of thought for how to evaluate a junction on an empty list: - Reduction to an identity (boolean) - Result is undefined (three-valued) In the first case, the result of the junction applied to the empty list is determined by a mathematical reduction to an identity depending on whether the underlying comparison is "or" or "and". Conceptually: "any are true" "all are true" -------------- -------------- 2 elements: A || B || 0 A && B && 1 1 element: A || 0 A && 1 0 elements: 0 1 In the second case, three-value logic is desired, in which a junction applied to an empty list returns `undef` rather than true or false Junctions with a `_u` suffix implement three-valued logic. Those without are boolean. ### all BLOCK LIST ### all\_u BLOCK LIST Returns a true value if all items in LIST meet the criterion given through BLOCK. Sets `$_` for each item in LIST in turn: print "All values are non-negative" if all { $_ >= 0 } ($x, $y, $z); For an empty LIST, `all` returns true (i.e. no values failed the condition) and `all_u` returns `undef`. Thus, `all_u(@list)` is equivalent to `@list ? all(@list) : undef`. **Note**: because Perl treats `undef` as false, you must check the return value of `all_u` with `defined` or you will get the opposite result of what you expect. ### any BLOCK LIST ### any\_u BLOCK LIST Returns a true value if any item in LIST meets the criterion given through BLOCK. Sets `$_` for each item in LIST in turn: print "At least one non-negative value" if any { $_ >= 0 } ($x, $y, $z); For an empty LIST, `any` returns false and `any_u` returns `undef`. Thus, `any_u(@list)` is equivalent to `@list ? any(@list) : undef`. ### none BLOCK LIST ### none\_u BLOCK LIST Logically the negation of `any`. Returns a true value if no item in LIST meets the criterion given through BLOCK. Sets `$_` for each item in LIST in turn: print "No non-negative values" if none { $_ >= 0 } ($x, $y, $z); For an empty LIST, `none` returns true (i.e. no values failed the condition) and `none_u` returns `undef`. Thus, `none_u(@list)` is equivalent to `@list ? none(@list) : undef`. **Note**: because Perl treats `undef` as false, you must check the return value of `none_u` with `defined` or you will get the opposite result of what you expect. ### notall BLOCK LIST ### notall\_u BLOCK LIST Logically the negation of `all`. Returns a true value if not all items in LIST meet the criterion given through BLOCK. Sets `$_` for each item in LIST in turn: print "Not all values are non-negative" if notall { $_ >= 0 } ($x, $y, $z); For an empty LIST, `notall` returns false and `notall_u` returns `undef`. Thus, `notall_u(@list)` is equivalent to `@list ? notall(@list) : undef`. ### one BLOCK LIST ### one\_u BLOCK LIST Returns a true value if precisely one item in LIST meets the criterion given through BLOCK. Sets `$_` for each item in LIST in turn: print "Precisely one value defined" if one { defined($_) } @list; Returns false otherwise. For an empty LIST, `one` returns false and `one_u` returns `undef`. The expression `one BLOCK LIST` is almost equivalent to `1 == true BLOCK LIST`, except for short-cutting. Evaluation of BLOCK will immediately stop at the second true value. ## Transformation ### apply BLOCK LIST Applies BLOCK to each item in LIST and returns a list of the values after BLOCK has been applied. In scalar context, the last element is returned. This function is similar to `map` but will not modify the elements of the input list: my @list = (1 .. 4); my @mult = apply { $_ *= 2 } @list; print "\@list = @list\n"; print "\@mult = @mult\n"; __END__ @list = 1 2 3 4 @mult = 2 4 6 8 Think of it as syntactic sugar for for (my @mult = @list) { $_ *= 2 } ### insert\_after BLOCK VALUE LIST Inserts VALUE after the first item in LIST for which the criterion in BLOCK is true. Sets `$_` for each item in LIST in turn. my @list = qw/This is a list/; insert_after { $_ eq "a" } "longer" => @list; print "@list"; __END__ This is a longer list ### insert\_after\_string STRING VALUE LIST Inserts VALUE after the first item in LIST which is equal to STRING. my @list = qw/This is a list/; insert_after_string "a", "longer" => @list; print "@list"; __END__ This is a longer list ### pairwise BLOCK ARRAY1 ARRAY2 Evaluates BLOCK for each pair of elements in ARRAY1 and ARRAY2 and returns a new list consisting of BLOCK's return values. The two elements are set to `$a` and `$b`. Note that those two are aliases to the original value so changing them will modify the input arrays. @a = (1 .. 5); @b = (11 .. 15); @x = pairwise { $a + $b } @a, @b; # returns 12, 14, 16, 18, 20 # mesh with pairwise @a = qw/a b c/; @b = qw/1 2 3/; @x = pairwise { ($a, $b) } @a, @b; # returns a, 1, b, 2, c, 3 ### mesh ARRAY1 ARRAY2 \[ ARRAY3 ... \] ### zip ARRAY1 ARRAY2 \[ ARRAY3 ... \] Returns a list consisting of the first elements of each array, then the second, then the third, etc, until all arrays are exhausted. Examples: @x = qw/a b c d/; @y = qw/1 2 3 4/; @z = mesh @x, @y; # returns a, 1, b, 2, c, 3, d, 4 @a = ('x'); @b = ('1', '2'); @c = qw/zip zap zot/; @d = mesh @a, @b, @c; # x, 1, zip, undef, 2, zap, undef, undef, zot `zip` is an alias for `mesh`. ### uniq LIST ### distinct LIST Returns a new list by stripping duplicate values in LIST by comparing the values as hash keys, except that undef is considered separate from ''. The order of elements in the returned list is the same as in LIST. In scalar context, returns the number of unique elements in LIST. my @x = uniq 1, 1, 2, 2, 3, 5, 3, 4; # returns 1 2 3 5 4 my $x = uniq 1, 1, 2, 2, 3, 5, 3, 4; # returns 5 # returns "Mike", "Michael", "Richard", "Rick" my @n = distinct "Mike", "Michael", "Richard", "Rick", "Michael", "Rick" # returns '', undef, 'S1', A5' my @s = distinct '', undef, 'S1', 'A5' # returns '', undef, 'S1', A5' my @w = uniq undef, '', 'S1', 'A5' `distinct` is an alias for `uniq`. **RT#49800** can be used to give feedback about this behavior. ### singleton Returns a new list by stripping values in LIST occurring more than once by comparing the values as hash keys, except that undef is considered separate from ''. The order of elements in the returned list is the same as in LIST. In scalar context, returns the number of elements occurring only once in LIST. my @x = singleton 1,1,2,2,3,4,5 # returns 3 4 5 ## Partitioning ### after BLOCK LIST Returns a list of the values of LIST after (and not including) the point where BLOCK returns a true value. Sets `$_` for each element in LIST in turn. @x = after { $_ % 5 == 0 } (1..9); # returns 6, 7, 8, 9 ### after\_incl BLOCK LIST Same as `after` but also includes the element for which BLOCK is true. ### before BLOCK LIST Returns a list of values of LIST up to (and not including) the point where BLOCK returns a true value. Sets `$_` for each element in LIST in turn. ### before\_incl BLOCK LIST Same as `before` but also includes the element for which BLOCK is true. ### part BLOCK LIST Partitions LIST based on the return value of BLOCK which denotes into which partition the current value is put. Returns a list of the partitions thusly created. Each partition created is a reference to an array. my $i = 0; my @part = part { $i++ % 2 } 1 .. 8; # returns [1, 3, 5, 7], [2, 4, 6, 8] You can have a sparse list of partitions as well where non-set partitions will be undef: my @part = part { 2 } 1 .. 10; # returns undef, undef, [ 1 .. 10 ] Be careful with negative values, though: my @part = part { -1 } 1 .. 10; __END__ Modification of non-creatable array value attempted, subscript -1 ... Negative values are only ok when they refer to a partition previously created: my @idx = ( 0, 1, -1 ); my $i = 0; my @part = part { $idx[$++ % 3] } 1 .. 8; # [1, 4, 7], [2, 3, 5, 6, 8] ## Iteration ### each\_array ARRAY1 ARRAY2 ... Creates an array iterator to return the elements of the list of arrays ARRAY1, ARRAY2 throughout ARRAYn in turn. That is, the first time it is called, it returns the first element of each array. The next time, it returns the second elements. And so on, until all elements are exhausted. This is useful for looping over more than one array at once: my $ea = each_array(@a, @b, @c); while ( my ($a, $b, $c) = $ea->() ) { .... } The iterator returns the empty list when it reached the end of all arrays. If the iterator is passed an argument of '`index`', then it returns the index of the last fetched set of values, as a scalar. ### each\_arrayref LIST Like each\_array, but the arguments are references to arrays, not the plain arrays. ### natatime EXPR, LIST Creates an array iterator, for looping over an array in chunks of `$n` items at a time. (n at a time, get it?). An example is probably a better explanation than I could give in words. Example: my @x = ('a' .. 'g'); my $it = natatime 3, @x; while (my @vals = $it->()) { print "@vals\n"; } This prints a b c d e f g ## Searching ### bsearch BLOCK LIST Performs a binary search on LIST which must be a sorted list of values. BLOCK must return a negative value if the current element (stored in `$_`) is smaller, a positive value if it is bigger and zero if it matches. Returns a boolean value in scalar context. In list context, it returns the element if it was found, otherwise the empty list. ### bsearchidx BLOCK LIST ### bsearch\_index BLOCK LIST Performs a binary search on LIST which must be a sorted list of values. BLOCK must return a negative value if the current element (stored in `$_`) is smaller, a positive value if it is bigger and zero if it matches. Returns the index of found element, otherwise `-1`. `bsearch_index` is an alias for `bsearchidx`. ### firstval BLOCK LIST ### first\_value BLOCK LIST Returns the first element in LIST for which BLOCK evaluates to true. Each element of LIST is set to `$_` in turn. Returns `undef` if no such element has been found. `first_value` is an alias for `firstval`. ### onlyval BLOCK LIST ### only\_value BLOCK LIST Returns the only element in LIST for which BLOCK evaluates to true. Sets `$_` for each item in LIST in turn. Returns `undef` if no such element has been found. `only_value` is an alias for `onlyval`. ### lastval BLOCK LIST ### last\_value BLOCK LIST Returns the last value in LIST for which BLOCK evaluates to true. Each element of LIST is set to `$_` in turn. Returns `undef` if no such element has been found. `last_value` is an alias for `lastval`. ### firstres BLOCK LIST ### first\_result BLOCK LIST Returns the result of BLOCK for the first element in LIST for which BLOCK evaluates to true. Each element of LIST is set to `$_` in turn. Returns `undef` if no such element has been found. `first_result` is an alias for `firstres`. ### onlyres BLOCK LIST ### only\_result BLOCK LIST Returns the result of BLOCK for the first element in LIST for which BLOCK evaluates to true. Sets `$_` for each item in LIST in turn. Returns `undef` if no such element has been found. `only_result` is an alias for `onlyres`. ### lastres BLOCK LIST ### last\_result BLOCK LIST Returns the result of BLOCK for the last element in LIST for which BLOCK evaluates to true. Each element of LIST is set to `$_` in turn. Returns `undef` if no such element has been found. `last_result` is an alias for `lastres`. ### indexes BLOCK LIST Evaluates BLOCK for each element in LIST (assigned to `$_`) and returns a list of the indices of those elements for which BLOCK returned a true value. This is just like `grep` only that it returns indices instead of values: @x = indexes { $_ % 2 == 0 } (1..10); # returns 1, 3, 5, 7, 9 ### firstidx BLOCK LIST ### first\_index BLOCK LIST Returns the index of the first element in LIST for which the criterion in BLOCK is true. Sets `$_` for each item in LIST in turn: my @list = (1, 4, 3, 2, 4, 6); printf "item with index %i in list is 4", firstidx { $_ == 4 } @list; __END__ item with index 1 in list is 4 Returns `-1` if no such item could be found. `first_index` is an alias for `firstidx`. ### onlyidx BLOCK LIST ### only\_index BLOCK LIST Returns the index of the only element in LIST for which the criterion in BLOCK is true. Sets `$_` for each item in LIST in turn: my @list = (1, 3, 4, 3, 2, 4); printf "uniqe index of item 2 in list is %i", onlyidx { $_ == 2 } @list; __END__ unique index of item 2 in list is 4 Returns `-1` if either no such item or more than one of these has been found. `only_index` is an alias for `onlyidx`. ### lastidx BLOCK LIST ### last\_index BLOCK LIST Returns the index of the last element in LIST for which the criterion in BLOCK is true. Sets `$_` for each item in LIST in turn: my @list = (1, 4, 3, 2, 4, 6); printf "item with index %i in list is 4", lastidx { $_ == 4 } @list; __END__ item with index 4 in list is 4 Returns `-1` if no such item could be found. `last_index` is an alias for `lastidx`. ## Sorting ### sort\_by BLOCK LIST Returns the list of values sorted according to the string values returned by the KEYFUNC block or function. A typical use of this may be to sort objects according to the string value of some accessor, such as sort_by { $_->name } @people The key function is called in scalar context, being passed each value in turn as both $\_ and the only argument in the parameters, @\_. The values are then sorted according to string comparisons on the values returned. This is equivalent to sort { $a->name cmp $b->name } @people except that it guarantees the name accessor will be executed only once per value. One interesting use-case is to sort strings which may have numbers embedded in them "naturally", rather than lexically. sort_by { s/(\d+)/sprintf "%09d", $1/eg; $_ } @strings This sorts strings by generating sort keys which zero-pad the embedded numbers to some level (9 digits in this case), helping to ensure the lexical sort puts them in the correct order. ### nsort\_by BLOCK LIST Similar to sort\_by but compares its key values numerically. ## Counting and calculation ### true BLOCK LIST Counts the number of elements in LIST for which the criterion in BLOCK is true. Sets `$_` for each item in LIST in turn: printf "%i item(s) are defined", true { defined($_) } @list; ### false BLOCK LIST Counts the number of elements in LIST for which the criterion in BLOCK is false. Sets `$_` for each item in LIST in turn: printf "%i item(s) are not defined", false { defined($_) } @list; ### minmax LIST Calculates the minimum and maximum of LIST and returns a two element list with the first element being the minimum and the second the maximum. Returns the empty list if LIST was empty. The `minmax` algorithm differs from a naive iteration over the list where each element is compared to two values being the so far calculated min and max value in that it only requires 3n/2 - 2 comparisons. Thus it is the most efficient possible algorithm. However, the Perl implementation of it has some overhead simply due to the fact that there are more lines of Perl code involved. Therefore, LIST needs to be fairly big in order for `minmax` to win over a naive implementation. This limitation does not apply to the XS version. ### mode LIST Calculates the most common items in the list and returns them as a list. This is effectively done by string comparisons, so references will be stringified. If they implement string overloading, this will be used. If more than one item appears the same number of times in the list, all such items will be returned. For example, the mode of a unique list is the list itself. This function **always** returns a list. That means that in scalar context you get a count indicating the number of modes in the list. # List::UtilsBy Functions ## rev\_sort\_by ## rev\_nsort\_by @vals = rev_sort_by { KEYFUNC } @vals @vals = rev_nsort_by { KEYFUNC } @vals _Since version 0.06._ Similar to ["sort\_by"](#sort_by) and ["nsort\_by"](#nsort_by) but returns the list in the reverse order. Equivalent to @vals = reverse sort_by { KEYFUNC } @vals except that these functions are slightly more efficient because they avoid the final `reverse` operation. ## max\_by $optimal = max_by { KEYFUNC } @vals @optimal = max_by { KEYFUNC } @vals Returns the (first) value from `@vals` that gives the numerically largest result from the key function. my $tallest = max_by { $_->height } @people use File::stat qw( stat ); my $newest = max_by { stat($_)->mtime } @files; In scalar context, the first maximal value is returned. In list context, a list of all the maximal values is returned. This may be used to obtain positions other than the first, if order is significant. If called on an empty list, an empty list is returned. For symmetry with the ["nsort\_by"](#nsort_by) function, this is also provided under the name `nmax_by` since it behaves numerically. ## min\_by $optimal = min_by { KEYFUNC } @vals @optimal = min_by { KEYFUNC } @vals Similar to ["max\_by"](#max_by) but returns values which give the numerically smallest result from the key function. Also provided as `nmin_by` ## minmax\_by ( $minimal, $maximal ) = minmax_by { KEYFUNC } @vals Similar to calling both ["min\_by"](#min_by) and ["max\_by"](#max_by) with the same key function on the same list. This version is more efficient than calling the two other functions individually, as it has less work to perform overall. In the case of ties, only the first optimal element found in each case is returned. Also provided as `nminmax_by`. ## uniq\_by @vals = uniq_by { KEYFUNC } @vals Returns a list of the subset of values for which the key function block returns unique values. The first value yielding a particular key is chosen, subsequent values are rejected. my @some_fruit = uniq_by { $_->colour } @fruit; To select instead the last value per key, reverse the input list. If the order of the results is significant, don't forget to reverse the result as well: my @some_fruit = reverse uniq_by { $_->colour } reverse @fruit; Because the values returned by the key function are used as hash keys, they ought to either be strings, or at least well-behaved as strings (such as numbers, or object references which overload stringification in a suitable manner). ## partition\_by %parts = partition_by { KEYFUNC } @vals Returns a key/value list of ARRAY refs containing all the original values distributed according to the result of the key function block. Each value will be an ARRAY ref containing all the values which returned the string from the key function, in their original order. my %balls_by_colour = partition_by { $_->colour } @balls; Because the values returned by the key function are used as hash keys, they ought to either be strings, or at least well-behaved as strings (such as numbers, or object references which overload stringification in a suitable manner). ## count\_by %counts = count_by { KEYFUNC } @vals Returns a key/value list of integers, giving the number of times the key function block returned the key, for each value in the list. my %count_of_balls = count_by { $_->colour } @balls; Because the values returned by the key function are used as hash keys, they ought to either be strings, or at least well-behaved as strings (such as numbers, or object references which overload stringification in a suitable manner). ## zip\_by @vals = zip_by { ITEMFUNC } \@arr0, \@arr1, \@arr2,... Returns a list of each of the values returned by the function block, when invoked with values from across each each of the given ARRAY references. Each value in the returned list will be the result of the function having been invoked with arguments at that position, from across each of the arrays given. my @transposition = zip_by { [ @_ ] } @matrix; my @names = zip_by { "$_[1], $_[0]" } \@firstnames, \@surnames; print zip_by { "$_[0] => $_[1]\n" } [ keys %hash ], [ values %hash ]; If some of the arrays are shorter than others, the function will behave as if they had `undef` in the trailing positions. The following two lines are equivalent: zip_by { f(@_) } [ 1, 2, 3 ], [ "a", "b" ] f( 1, "a" ), f( 2, "b" ), f( 3, undef ) The item function is called by `map`, so if it returns a list, the entire list is included in the result. This can be useful for example, for generating a hash from two separate lists of keys and values my %nums = zip_by { @_ } [qw( one two three )], [ 1, 2, 3 ]; # %nums = ( one => 1, two => 2, three => 3 ) (A function having this behaviour is sometimes called `zipWith`, e.g. in Haskell, but that name would not fit the naming scheme used by this module). ## unzip\_by $arr0, $arr1, $arr2, ... = unzip_by { ITEMFUNC } @vals Returns a list of ARRAY references containing the values returned by the function block, when invoked for each of the values given in the input list. Each of the returned ARRAY references will contain the values returned at that corresponding position by the function block. That is, the first returned ARRAY reference will contain all the values returned in the first position by the function block, the second will contain all the values from the second position, and so on. my ( $firstnames, $lastnames ) = unzip_by { m/^(.*?) (.*)$/ } @names; If the function returns lists of differing lengths, the result will be padded with `undef` in the missing elements. This function is an inverse of ["zip\_by"](#zip_by), if given a corresponding inverse function. ## extract\_by @vals = extract_by { SELECTFUNC } @arr Removes elements from the referenced array on which the selection function returns true, and returns a list containing those elements. This function is similar to `grep`, except that it modifies the referenced array to remove the selected values from it, leaving only the unselected ones. my @red_balls = extract_by { $_->color eq "red" } @balls; # Now there are no red balls in the @balls array This function modifies a real array, unlike most of the other functions in this module. Because of this, it requires a real array, not just a list. This function is implemented by invoking `splice` on the array, not by constructing a new list and assigning it. One result of this is that weak references will not be disturbed. extract_by { !defined $_ } @refs; will leave weak references weakened in the `@refs` array, whereas @refs = grep { defined $_ } @refs; will strengthen them all again. ## extract\_first\_by $val = extract_first_by { SELECTFUNC } @arr A hybrid between ["extract\_by"](#extract_by) and `List::Util::first`. Removes the first element from the referenced array on which the selection function returns true, returning it. As with ["extract\_by"](#extract_by), this function requires a real array and not just a list, and is also implemented using `splice` so that weak references are not disturbed. If this function fails to find a matching element, it will return an empty list in list context. This allows a caller to distinguish the case between no matching element, and the first matching element being `undef`. ## weighted\_shuffle\_by @vals = weighted_shuffle_by { WEIGHTFUNC } @vals Returns the list of values shuffled into a random order. The randomisation is not uniform, but weighted by the value returned by the `WEIGHTFUNC`. The probability of each item being returned first will be distributed with the distribution of the weights, and so on recursively for the remaining items. ## bundle\_by @vals = bundle_by { BLOCKFUNC } $number, @vals Similar to a regular `map` functional, returns a list of the values returned by `BLOCKFUNC`. Values from the input list are given to the block function in bundles of `$number`. If given a list of values whose length does not evenly divide by `$number`, the final call will be passed fewer elements than the others. # EXPORTS This module exports nothing by default. You can import functions by name, or get everything with the `:all` tag. # SEE ALSO [List::Util](https://metacpan.org/pod/List::Util), [List::SomeUtils](https://metacpan.org/pod/List::SomeUtils) and [List::UtilsBy](https://metacpan.org/pod/List::UtilsBy), obviously. Also see `Util::Any`, which unifies many more util modules, and also lets you rename functions as part of the import. # BUGS Please report any bugs or feature requests to `bug-list-allutils@rt.cpan.org`, or through the web interface at [http://rt.cpan.org](http://rt.cpan.org). I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. Bugs may be submitted at [http://rt.cpan.org/Public/Dist/Display.html?Name=List-AllUtils](http://rt.cpan.org/Public/Dist/Display.html?Name=List-AllUtils) or via email to [bug-list-allutils@rt.cpan.org](mailto:bug-list-allutils@rt.cpan.org). I am also usually active on IRC as 'autarch' on `irc://irc.perl.org`. # SOURCE The source code repository for List-AllUtils can be found at [https://github.com/houseabsolute/List-AllUtils](https://github.com/houseabsolute/List-AllUtils). # DONATIONS If you'd like to thank me for the work I've done on this module, please consider making a "donation" to me via PayPal. I spend a lot of free time creating free software, and would appreciate any support you'd care to offer. Please note that **I am not suggesting that you must do this** in order for me to continue working on this particular software. I will continue to do so, inasmuch as I have in the past, for as long as it interests me. Similarly, a donation made in this way will probably not make me work on this software much more, unless I get so many donations that I can consider working on free software full time (let's all have a chuckle at that together). To donate, log into PayPal and send money to autarch@urth.org, or use the button at [http://www.urth.org/~autarch/fs-donation.html](http://www.urth.org/~autarch/fs-donation.html). # AUTHOR Dave Rolsky # CONTRIBUTORS - Karen Etheridge - Ricardo Signes - Yanick Champoux # COPYRIGHT AND LICENSE This software is Copyright (c) 2018 by Dave Rolsky. This is free software, licensed under: The Artistic License 2.0 (GPL Compatible) The full text of the license can be found in the `LICENSE` file included with this distribution. List-AllUtils-0.15/perltidyrc0000644000175000017500000000045513403536165016057 0ustar autarchautarch-l=78 -i=4 -ci=4 -se -b -bar -boc -vt=0 -vtc=0 -cti=0 -pt=1 -bt=1 -sbt=1 -bbt=1 -nolq -npro -nsfs --blank-lines-before-packages=0 --opening-hash-brace-right --no-outdent-long-comments --iterations=2 -wbb="% + - * / x != == >= <= =~ !~ < > | & >= < = **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x=" List-AllUtils-0.15/META.json0000644000175000017500000011000713403536165015367 0ustar autarchautarch{ "abstract" : "Combines List::Util, List::SomeUtils and List::UtilsBy in one bite-sized package", "author" : [ "Dave Rolsky " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010", "license" : [ "artistic_2" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "List-AllUtils", "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "develop" : { "requires" : { "Code::TidyAll" : "0.56", "Code::TidyAll::Plugin::SortLines::Naturally" : "0.000003", "Code::TidyAll::Plugin::Test::Vars" : "0.02", "Cwd" : "0", "File::Spec" : "0", "IO::Handle" : "0", "IPC::Open3" : "0", "Parallel::ForkManager" : "1.19", "Perl::Critic" : "1.126", "Perl::Tidy" : "20160302", "Pod::Coverage::TrustPod" : "0", "Pod::Wordlist" : "0", "Test::CPAN::Changes" : "0.19", "Test::CPAN::Meta::JSON" : "0.16", "Test::Code::TidyAll" : "0.50", "Test::DependentModules" : "0", "Test::EOL" : "0", "Test::Mojibake" : "0", "Test::More" : "0.96", "Test::NoTabs" : "0", "Test::Pod" : "1.41", "Test::Pod::Coverage" : "1.08", "Test::Portability::Files" : "0", "Test::Spelling" : "0.12", "Test::Synopsis" : "0", "Test::Vars" : "0.009", "Test::Version" : "2.05", "perl" : "5.006" } }, "runtime" : { "requires" : { "Exporter" : "0", "List::SomeUtils" : "0.56", "List::Util" : "1.45", "List::UtilsBy" : "0.11", "base" : "0", "strict" : "0", "warnings" : "0" } }, "test" : { "recommends" : { "CPAN::Meta" : "2.120900" }, "requires" : { "ExtUtils::MakeMaker" : "0", "File::Spec" : "0", "Sub::Util" : "0", "Test::More" : "0.96" } } }, "provides" : { "List::AllUtils" : { "file" : "lib/List/AllUtils.pm", "version" : "0.15" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "mailto" : "bug-list-allutils@rt.cpan.org", "web" : "http://rt.cpan.org/Public/Dist/Display.html?Name=List-AllUtils" }, "homepage" : "http://metacpan.org/release/List-AllUtils", "repository" : { "type" : "git", "url" : "git://github.com/houseabsolute/List-AllUtils.git", "web" : "https://github.com/houseabsolute/List-AllUtils" } }, "version" : "0.15", "x_Dist_Zilla" : { "perl" : { "version" : "5.026002" }, "plugins" : [ { "class" : "Dist::Zilla::Plugin::Git::GatherDir", "config" : { "Dist::Zilla::Plugin::GatherDir" : { "exclude_filename" : [ "CODE_OF_CONDUCT.md", "CONTRIBUTING.md", "LICENSE", "Makefile.PL", "README.md", "cpanfile" ], "exclude_match" : [], "follow_symlinks" : 0, "include_dotfiles" : 0, "prefix" : "", "prune_directory" : [], "root" : "." }, "Dist::Zilla::Plugin::Git::GatherDir" : { "include_untracked" : 0 } }, "name" : "@DROLSKY/Git::GatherDir", "version" : "2.045" }, { "class" : "Dist::Zilla::Plugin::ManifestSkip", "name" : "@DROLSKY/ManifestSkip", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::License", "name" : "@DROLSKY/License", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::ExecDir", "name" : "@DROLSKY/ExecDir", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::ShareDir", "name" : "@DROLSKY/ShareDir", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::Manifest", "name" : "@DROLSKY/Manifest", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::CheckVersionIncrement", "name" : "@DROLSKY/CheckVersionIncrement", "version" : "0.121750" }, { "class" : "Dist::Zilla::Plugin::TestRelease", "name" : "@DROLSKY/TestRelease", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::ConfirmRelease", "name" : "@DROLSKY/ConfirmRelease", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::UploadToCPAN", "name" : "@DROLSKY/UploadToCPAN", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::VersionFromMainModule", "config" : { "Dist::Zilla::Role::ModuleMetadata" : { "Module::Metadata" : "1.000033", "version" : "0.006" } }, "name" : "@DROLSKY/VersionFromMainModule", "version" : "0.04" }, { "class" : "Dist::Zilla::Plugin::Authority", "name" : "@DROLSKY/Authority", "version" : "1.009" }, { "class" : "Dist::Zilla::Plugin::AutoPrereqs", "name" : "@DROLSKY/AutoPrereqs", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::CopyFilesFromBuild", "name" : "@DROLSKY/CopyFilesFromBuild", "version" : "0.170880" }, { "class" : "Dist::Zilla::Plugin::GitHub::Meta", "name" : "@DROLSKY/GitHub::Meta", "version" : "0.47" }, { "class" : "Dist::Zilla::Plugin::GitHub::Update", "config" : { "Dist::Zilla::Plugin::GitHub::Update" : { "metacpan" : 1 } }, "name" : "@DROLSKY/GitHub::Update", "version" : "0.47" }, { "class" : "Dist::Zilla::Plugin::MetaResources", "name" : "@DROLSKY/MetaResources", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::MetaProvides::Package", "config" : { "Dist::Zilla::Plugin::MetaProvides::Package" : { "finder_objects" : [ { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : "@DROLSKY/MetaProvides::Package/AUTOVIV/:InstallModulesPM", "version" : "6.012" } ], "include_underscores" : 0 }, "Dist::Zilla::Role::MetaProvider::Provider" : { "$Dist::Zilla::Role::MetaProvider::Provider::VERSION" : "2.002004", "inherit_missing" : 1, "inherit_version" : 1, "meta_noindex" : 1 }, "Dist::Zilla::Role::ModuleMetadata" : { "Module::Metadata" : "1.000033", "version" : "0.006" } }, "name" : "@DROLSKY/MetaProvides::Package", "version" : "2.004003" }, { "class" : "Dist::Zilla::Plugin::Meta::Contributors", "name" : "@DROLSKY/Meta::Contributors", "version" : "0.003" }, { "class" : "Dist::Zilla::Plugin::MetaConfig", "name" : "@DROLSKY/MetaConfig", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::MetaJSON", "name" : "@DROLSKY/MetaJSON", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::MetaYAML", "name" : "@DROLSKY/MetaYAML", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::NextRelease", "name" : "@DROLSKY/NextRelease", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "test", "type" : "requires" } }, "name" : "@DROLSKY/Test::More with subtest", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "develop", "type" : "requires" } }, "name" : "@DROLSKY/Modules for use with tidyall", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "develop", "type" : "requires" } }, "name" : "@DROLSKY/Test::Version which fixes https://github.com/plicease/Test-Version/issues/7", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::PromptIfStale", "config" : { "Dist::Zilla::Plugin::PromptIfStale" : { "check_all_plugins" : 0, "check_all_prereqs" : 0, "modules" : [ "Dist::Zilla::PluginBundle::DROLSKY" ], "phase" : "build", "run_under_travis" : 0, "skip" : [] } }, "name" : "@DROLSKY/Dist::Zilla::PluginBundle::DROLSKY", "version" : "0.055" }, { "class" : "Dist::Zilla::Plugin::PromptIfStale", "config" : { "Dist::Zilla::Plugin::PromptIfStale" : { "check_all_plugins" : 1, "check_all_prereqs" : 1, "modules" : [], "phase" : "release", "run_under_travis" : 0, "skip" : [ "Dist::Zilla::Plugin::DROLSKY::Contributors", "Dist::Zilla::Plugin::DROLSKY::Git::CheckFor::CorrectBranch", "Dist::Zilla::Plugin::DROLSKY::License", "Dist::Zilla::Plugin::DROLSKY::TidyAll", "Dist::Zilla::Plugin::DROLSKY::WeaverConfig", "Pod::Weaver::PluginBundle::DROLSKY" ] } }, "name" : "@DROLSKY/PromptIfStale", "version" : "0.055" }, { "class" : "Dist::Zilla::Plugin::Test::Pod::Coverage::Configurable", "name" : "@DROLSKY/Test::Pod::Coverage::Configurable", "version" : "0.07" }, { "class" : "Dist::Zilla::Plugin::Test::PodSpelling", "config" : { "Dist::Zilla::Plugin::Test::PodSpelling" : { "directories" : [ "bin", "lib" ], "spell_cmd" : "", "stopwords" : [ "ARRAYn", "BLOCK's", "DROLSKY", "DROLSKY's", "EXPR", "Haskell", "KEYFUNC", "KVLIST", "PayPal", "Rolsky", "Rolsky's", "bsearchidx", "drolsky", "firstidx", "firstres", "firstval", "lastidx", "lastres", "lastval", "maxstr", "minmax", "minstr", "natatime", "notall", "onlyidx", "onlyres", "onlyval", "pairfirst", "pairgrep", "pairkeys", "pairmap", "pairvalues", "probability", "randomisation", "specialisations", "thusly", "uniq", "unselected", "util" ], "wordlist" : "Pod::Wordlist" } }, "name" : "@DROLSKY/Test::PodSpelling", "version" : "2.007005" }, { "class" : "Dist::Zilla::Plugin::PodSyntaxTests", "name" : "@DROLSKY/PodSyntaxTests", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::DROLSKY::RunExtraTests", "config" : { "Dist::Zilla::Role::TestRunner" : { "default_jobs" : 24 } }, "name" : "@DROLSKY/DROLSKY::RunExtraTests", "version" : "1.01" }, { "class" : "Dist::Zilla::Plugin::MojibakeTests", "name" : "@DROLSKY/MojibakeTests", "version" : "0.8" }, { "class" : "Dist::Zilla::Plugin::Test::CPAN::Changes", "config" : { "Dist::Zilla::Plugin::Test::CPAN::Changes" : { "changelog" : "Changes" } }, "name" : "@DROLSKY/Test::CPAN::Changes", "version" : "0.012" }, { "class" : "Dist::Zilla::Plugin::Test::CPAN::Meta::JSON", "name" : "@DROLSKY/Test::CPAN::Meta::JSON", "version" : "0.004" }, { "class" : "Dist::Zilla::Plugin::Test::EOL", "config" : { "Dist::Zilla::Plugin::Test::EOL" : { "filename" : "xt/author/eol.t", "finder" : [ ":ExecFiles", ":InstallModules", ":TestFiles" ], "trailing_whitespace" : 1 } }, "name" : "@DROLSKY/Test::EOL", "version" : "0.19" }, { "class" : "Dist::Zilla::Plugin::Test::NoTabs", "config" : { "Dist::Zilla::Plugin::Test::NoTabs" : { "filename" : "xt/author/no-tabs.t", "finder" : [ ":InstallModules", ":ExecFiles", ":TestFiles" ] } }, "name" : "@DROLSKY/Test::NoTabs", "version" : "0.15" }, { "class" : "Dist::Zilla::Plugin::Test::Portability", "config" : { "Dist::Zilla::Plugin::Test::Portability" : { "options" : "" } }, "name" : "@DROLSKY/Test::Portability", "version" : "2.001000" }, { "class" : "Dist::Zilla::Plugin::Test::Synopsis", "name" : "@DROLSKY/Test::Synopsis", "version" : "2.000007" }, { "class" : "Dist::Zilla::Plugin::Test::TidyAll", "name" : "@DROLSKY/Test::TidyAll", "version" : "0.04" }, { "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" : "xt/author/00-compile.t", "module_finder" : [ ":InstallModules" ], "needs_display" : 0, "phase" : "develop", "script_finder" : [ ":PerlExecFiles" ], "skips" : [], "switch" : [] } }, "name" : "@DROLSKY/Test::Compile", "version" : "2.058" }, { "class" : "Dist::Zilla::Plugin::Test::ReportPrereqs", "name" : "@DROLSKY/Test::ReportPrereqs", "version" : "0.027" }, { "class" : "Dist::Zilla::Plugin::Test::Version", "name" : "@DROLSKY/Test::Version", "version" : "1.09" }, { "class" : "Dist::Zilla::Plugin::DROLSKY::Contributors", "name" : "@DROLSKY/DROLSKY::Contributors", "version" : "1.01" }, { "class" : "Dist::Zilla::Plugin::Git::Contributors", "config" : { "Dist::Zilla::Plugin::Git::Contributors" : { "git_version" : "2.19.2", "include_authors" : 0, "include_releaser" : 1, "order_by" : "name", "paths" : [] } }, "name" : "@DROLSKY/Git::Contributors", "version" : "0.035" }, { "class" : "Dist::Zilla::Plugin::SurgicalPodWeaver", "config" : { "Dist::Zilla::Plugin::PodWeaver" : { "config_plugins" : [ "@DROLSKY" ], "finder" : [ ":InstallModules", ":ExecFiles" ], "plugins" : [ { "class" : "Pod::Weaver::Plugin::EnsurePod5", "name" : "@CorePrep/EnsurePod5", "version" : "4.015" }, { "class" : "Pod::Weaver::Plugin::H1Nester", "name" : "@CorePrep/H1Nester", "version" : "4.015" }, { "class" : "Pod::Weaver::Plugin::SingleEncoding", "name" : "@DROLSKY/SingleEncoding", "version" : "4.015" }, { "class" : "Pod::Weaver::Plugin::Transformer", "name" : "@DROLSKY/List", "version" : "4.015" }, { "class" : "Pod::Weaver::Plugin::Transformer", "name" : "@DROLSKY/Verbatim", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Region", "name" : "@DROLSKY/header", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Name", "name" : "@DROLSKY/Name", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Version", "name" : "@DROLSKY/Version", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Region", "name" : "@DROLSKY/prelude", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "SYNOPSIS", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "DESCRIPTION", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "OVERVIEW", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "ATTRIBUTES", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "METHODS", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "FUNCTIONS", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "TYPES", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Leftovers", "name" : "@DROLSKY/Leftovers", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Region", "name" : "@DROLSKY/postlude", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::GenerateSection", "name" : "@DROLSKY/generate SUPPORT", "version" : "1.06" }, { "class" : "Pod::Weaver::Section::AllowOverride", "name" : "@DROLSKY/allow override SUPPORT", "version" : "0.05" }, { "class" : "Pod::Weaver::Section::GenerateSection", "name" : "@DROLSKY/generate SOURCE", "version" : "1.06" }, { "class" : "Pod::Weaver::Section::GenerateSection", "name" : "@DROLSKY/generate DONATIONS", "version" : "1.06" }, { "class" : "Pod::Weaver::Section::Authors", "name" : "@DROLSKY/Authors", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Contributors", "name" : "@DROLSKY/Contributors", "version" : "0.009" }, { "class" : "Pod::Weaver::Section::Legal", "name" : "@DROLSKY/Legal", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Region", "name" : "@DROLSKY/footer", "version" : "4.015" } ] } }, "name" : "@DROLSKY/SurgicalPodWeaver", "version" : "0.0023" }, { "class" : "Dist::Zilla::Plugin::DROLSKY::WeaverConfig", "name" : "@DROLSKY/DROLSKY::WeaverConfig", "version" : "1.01" }, { "class" : "Dist::Zilla::Plugin::ReadmeAnyFromPod", "config" : { "Dist::Zilla::Role::FileWatcher" : { "version" : "0.006" } }, "name" : "@DROLSKY/README.md in build", "version" : "0.163250" }, { "class" : "Dist::Zilla::Plugin::GenerateFile::FromShareDir", "config" : { "Dist::Zilla::Plugin::GenerateFile::FromShareDir" : { "destination_filename" : "CONTRIBUTING.md", "dist" : "Dist-Zilla-PluginBundle-DROLSKY", "encoding" : "UTF-8", "has_xs" : 0, "location" : "build", "source_filename" : "CONTRIBUTING.md" }, "Dist::Zilla::Role::RepoFileInjector" : { "allow_overwrite" : 1, "repo_root" : ".", "version" : "0.009" } }, "name" : "@DROLSKY/Generate CONTRIBUTING.md", "version" : "0.014" }, { "class" : "Dist::Zilla::Plugin::GenerateFile::FromShareDir", "config" : { "Dist::Zilla::Plugin::GenerateFile::FromShareDir" : { "destination_filename" : "CODE_OF_CONDUCT.md", "dist" : "Dist-Zilla-PluginBundle-DROLSKY", "encoding" : "UTF-8", "has_xs" : 0, "location" : "build", "source_filename" : "CODE_OF_CONDUCT.md" }, "Dist::Zilla::Role::RepoFileInjector" : { "allow_overwrite" : 1, "repo_root" : ".", "version" : "0.009" } }, "name" : "@DROLSKY/Generate CODE_OF_CONDUCT.md", "version" : "0.014" }, { "class" : "Dist::Zilla::Plugin::InstallGuide", "name" : "@DROLSKY/InstallGuide", "version" : "1.200012" }, { "class" : "Dist::Zilla::Plugin::CPANFile", "name" : "@DROLSKY/CPANFile", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::DROLSKY::License", "name" : "@DROLSKY/DROLSKY::License", "version" : "1.01" }, { "class" : "Dist::Zilla::Plugin::CheckStrictVersion", "name" : "@DROLSKY/CheckStrictVersion", "version" : "0.001" }, { "class" : "Dist::Zilla::Plugin::CheckSelfDependency", "config" : { "Dist::Zilla::Plugin::CheckSelfDependency" : { "finder" : [ ":InstallModules" ] }, "Dist::Zilla::Role::ModuleMetadata" : { "Module::Metadata" : "1.000033", "version" : "0.006" } }, "name" : "@DROLSKY/CheckSelfDependency", "version" : "0.011" }, { "class" : "Dist::Zilla::Plugin::CheckPrereqsIndexed", "name" : "@DROLSKY/CheckPrereqsIndexed", "version" : "0.020" }, { "class" : "Dist::Zilla::Plugin::DROLSKY::Git::CheckFor::CorrectBranch", "config" : { "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.19.2", "repo_root" : "." } }, "name" : "@DROLSKY/DROLSKY::Git::CheckFor::CorrectBranch", "version" : "1.01" }, { "class" : "Dist::Zilla::Plugin::EnsureChangesHasContent", "name" : "@DROLSKY/EnsureChangesHasContent", "version" : "0.02" }, { "class" : "Dist::Zilla::Plugin::Git::CheckFor::MergeConflicts", "config" : { "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.19.2", "repo_root" : "." } }, "name" : "@DROLSKY/Git::CheckFor::MergeConflicts", "version" : "0.014" }, { "class" : "Dist::Zilla::Plugin::DROLSKY::TidyAll", "name" : "@DROLSKY/DROLSKY::TidyAll", "version" : "1.01" }, { "class" : "Dist::Zilla::Plugin::Git::Check", "config" : { "Dist::Zilla::Plugin::Git::Check" : { "untracked_files" : "die" }, "Dist::Zilla::Role::Git::DirtyFiles" : { "allow_dirty" : [ "CODE_OF_CONDUCT.md", "CONTRIBUTING.md", "Changes", "LICENSE", "Makefile.PL", "README.md", "cpanfile", "tidyall.ini" ], "allow_dirty_match" : [], "changelog" : "Changes" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.19.2", "repo_root" : "." } }, "name" : "@DROLSKY/Git::Check", "version" : "2.045" }, { "class" : "Dist::Zilla::Plugin::Git::Commit", "config" : { "Dist::Zilla::Plugin::Git::Commit" : { "add_files_in" : [], "commit_msg" : "v%v%n%n%c" }, "Dist::Zilla::Role::Git::DirtyFiles" : { "allow_dirty" : [ "CODE_OF_CONDUCT.md", "CONTRIBUTING.md", "Changes", "LICENSE", "Makefile.PL", "README.md", "cpanfile", "tidyall.ini" ], "allow_dirty_match" : [], "changelog" : "Changes" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.19.2", "repo_root" : "." }, "Dist::Zilla::Role::Git::StringFormatter" : { "time_zone" : "local" } }, "name" : "@DROLSKY/Commit generated files", "version" : "2.045" }, { "class" : "Dist::Zilla::Plugin::Git::Tag", "config" : { "Dist::Zilla::Plugin::Git::Tag" : { "branch" : null, "changelog" : "Changes", "signed" : 0, "tag" : "v0.15", "tag_format" : "v%v", "tag_message" : "v%v" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.19.2", "repo_root" : "." }, "Dist::Zilla::Role::Git::StringFormatter" : { "time_zone" : "local" } }, "name" : "@DROLSKY/Git::Tag", "version" : "2.045" }, { "class" : "Dist::Zilla::Plugin::Git::Push", "config" : { "Dist::Zilla::Plugin::Git::Push" : { "push_to" : [ "origin" ], "remotes_must_exist" : 1 }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.19.2", "repo_root" : "." } }, "name" : "@DROLSKY/Git::Push", "version" : "2.045" }, { "class" : "Dist::Zilla::Plugin::BumpVersionAfterRelease", "config" : { "Dist::Zilla::Plugin::BumpVersionAfterRelease" : { "finders" : [ ":ExecFiles", ":InstallModules" ], "global" : 0, "munge_makefile_pl" : 1 } }, "name" : "@DROLSKY/BumpVersionAfterRelease", "version" : "0.018" }, { "class" : "Dist::Zilla::Plugin::Git::Commit", "config" : { "Dist::Zilla::Plugin::Git::Commit" : { "add_files_in" : [], "commit_msg" : "Bump version after release" }, "Dist::Zilla::Role::Git::DirtyFiles" : { "allow_dirty" : [ "Changes", "dist.ini" ], "allow_dirty_match" : [ "(?^:.+)" ], "changelog" : "Changes" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.19.2", "repo_root" : "." }, "Dist::Zilla::Role::Git::StringFormatter" : { "time_zone" : "local" } }, "name" : "@DROLSKY/Commit version bump", "version" : "2.045" }, { "class" : "Dist::Zilla::Plugin::Git::Push", "config" : { "Dist::Zilla::Plugin::Git::Push" : { "push_to" : [ "origin" ], "remotes_must_exist" : 1 }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.19.2", "repo_root" : "." } }, "name" : "@DROLSKY/Push version bump", "version" : "2.045" }, { "class" : "Dist::Zilla::Plugin::DROLSKY::MakeMaker", "config" : { "Dist::Zilla::Plugin::MakeMaker" : { "make_path" : "make", "version" : "6.012" }, "Dist::Zilla::Plugin::MakeMaker::Awesome" : { "version" : "0.42" }, "Dist::Zilla::Role::TestRunner" : { "default_jobs" : 24, "version" : "6.012" } }, "name" : "@DROLSKY/DROLSKY::MakeMaker", "version" : "1.01" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":InstallModules", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":IncModules", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":TestFiles", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExtraTestFiles", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExecFiles", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":PerlExecFiles", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ShareFiles", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":MainModule", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":AllFiles", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":NoFiles", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : "@DROLSKY/MetaProvides::Package/AUTOVIV/:InstallModulesPM", "version" : "6.012" } ], "zilla" : { "class" : "Dist::Zilla::Dist::Builder", "config" : { "is_trial" : 0 }, "version" : "6.012" } }, "x_authority" : "cpan:DROLSKY", "x_contributors" : [ "Karen Etheridge ", "Ricardo Signes ", "Yanick Champoux " ], "x_generated_by_perl" : "v5.26.2", "x_serialization_backend" : "Cpanel::JSON::XS version 4.02" } List-AllUtils-0.15/CODE_OF_CONDUCT.md0000644000175000017500000000625413403536165016555 0ustar autarchautarch# Contributor Covenant Code of Conduct ## Our Pledge In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. ## Our Standards Examples of behavior that contributes to creating a positive environment include: * Using welcoming and inclusive language * Being respectful of differing viewpoints and experiences * Gracefully accepting constructive criticism * Focusing on what is best for the community * Showing empathy towards other community members Examples of unacceptable behavior by participants include: * The use of sexualized language or imagery and unwelcome sexual attention or advances * Trolling, insulting/derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or electronic address, without explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. ## Scope This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at autarch@urth.org. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html [homepage]: https://www.contributor-covenant.org List-AllUtils-0.15/lib/0000755000175000017500000000000013403536165014515 5ustar autarchautarchList-AllUtils-0.15/lib/List/0000755000175000017500000000000013403536165015430 5ustar autarchautarchList-AllUtils-0.15/lib/List/AllUtils.pm0000644000175000017500000011036413403536165017524 0ustar autarchautarchpackage List::AllUtils; use strict; use warnings; our $VERSION = '0.15'; use List::Util 1.45 (); use List::SomeUtils 0.56 (); use List::UtilsBy 0.11 (); BEGIN { my %imported; for my $module (qw( List::Util List::SomeUtils List::UtilsBy )) { my @ok = do { ## no critic (TestingAndDebugging::ProhibitNoStrict) no strict 'refs'; @{ $module . '::EXPORT_OK' }; }; $module->import( grep { !$imported{$_} } @ok ); @imported{@ok} = ($module) x @ok; } } use base 'Exporter'; our @EXPORT_OK = List::Util::uniqstr( @List::Util::EXPORT_OK, @List::SomeUtils::EXPORT_OK, @List::UtilsBy::EXPORT_OK, ); our %EXPORT_TAGS = ( all => \@EXPORT_OK ); 1; # ABSTRACT: Combines List::Util, List::SomeUtils and List::UtilsBy in one bite-sized package __END__ =pod =encoding UTF-8 =head1 NAME List::AllUtils - Combines List::Util, List::SomeUtils and List::UtilsBy in one bite-sized package =head1 VERSION version 0.15 =head1 SYNOPSIS use List::AllUtils qw( first any ); # _Everything_ from List::Util, List::SomeUtils, and List::UtilsBy use List::AllUtils qw( :all ); my @numbers = ( 1, 2, 3, 5, 7 ); # or don't import anything return List::AllUtils::first { $_ > 5 } @numbers; =head1 DESCRIPTION Are you sick of trying to remember whether a particular helper is defined in L, L or L? I sure am. Now you don't have to remember. This module will export all of the functions that either of those three modules defines. Note that all function documentation has been shamelessly copied from L, L and L. =head2 Which One Wins? Recently, L has started including some of the subs that used to only be in L. Similar, L has some small overlap with L. C always favors the version provided by L, L or L in that order. The docs below come from L 1.31, L 0.50, and L 0.10. =head1 WHAT IS EXPORTED? All this module does is load L, L, and L, and then re-export everything that they provide. That means that regardless of the documentation below, you will get any subroutine that your installed version provides. =head1 LIST-REDUCTION FUNCTIONS The following set of functions all reduce a list down to a single value. =head2 reduce BLOCK LIST Reduces LIST by calling BLOCK, in a scalar context, multiple times, setting C<$a> and C<$b> each time. The first call will be with C<$a> and C<$b> set to the first two elements of the list, subsequent calls will be done by setting C<$a> to the result of the previous call and C<$b> to the next element in the list. Returns the result of the last call to BLOCK. If LIST is empty then C is returned. If LIST only contains one element then that element is returned and BLOCK is not executed. $foo = reduce { $a < $b ? $a : $b } 1..10 # min $foo = reduce { $a lt $b ? $a : $b } 'aa'..'zz' # minstr $foo = reduce { $a + $b } 1 .. 10 # sum $foo = reduce { $a . $b } @bar # concat If your algorithm requires that C produce an identity value, then make sure that you always pass that identity value as the first argument to prevent C being returned $foo = reduce { $a + $b } 0, @values; # sum with 0 identity value The remaining list-reduction functions are all specialisations of this generic idea. =head2 first BLOCK LIST Similar to C in that it evaluates BLOCK setting C<$_> to each element of LIST in turn. C returns the first element where the result from BLOCK is a true value. If BLOCK never returns true or LIST was empty then C is returned. $foo = first { defined($_) } @list # first defined value in @list $foo = first { $_ > $value } @list # first value in @list which # is greater than $value This function could be implemented using C like this $foo = reduce { defined($a) ? $a : wanted($b) ? $b : undef } undef, @list for example wanted() could be defined() which would return the first defined value in @list =head2 max LIST Returns the entry in the list with the highest numerical value. If the list is empty then C is returned. $foo = max 1..10 # 10 $foo = max 3,9,12 # 12 $foo = max @bar, @baz # whatever This function could be implemented using C like this $foo = reduce { $a > $b ? $a : $b } 1..10 =head2 maxstr LIST Similar to C, but treats all the entries in the list as strings and returns the highest string as defined by the C operator. If the list is empty then C is returned. $foo = maxstr 'A'..'Z' # 'Z' $foo = maxstr "hello","world" # "world" $foo = maxstr @bar, @baz # whatever This function could be implemented using C like this $foo = reduce { $a gt $b ? $a : $b } 'A'..'Z' =head2 min LIST Similar to C but returns the entry in the list with the lowest numerical value. If the list is empty then C is returned. $foo = min 1..10 # 1 $foo = min 3,9,12 # 3 $foo = min @bar, @baz # whatever This function could be implemented using C like this $foo = reduce { $a < $b ? $a : $b } 1..10 =head2 minstr LIST Similar to C, but treats all the entries in the list as strings and returns the lowest string as defined by the C operator. If the list is empty then C is returned. $foo = minstr 'A'..'Z' # 'A' $foo = minstr "hello","world" # "hello" $foo = minstr @bar, @baz # whatever This function could be implemented using C like this $foo = reduce { $a lt $b ? $a : $b } 'A'..'Z' =head2 sum LIST Returns the sum of all the elements in LIST. If LIST is empty then C is returned. $foo = sum 1..10 # 55 $foo = sum 3,9,12 # 24 $foo = sum @bar, @baz # whatever This function could be implemented using C like this $foo = reduce { $a + $b } 1..10 =head2 sum0 LIST Similar to C, except this returns 0 when given an empty list, rather than C. =head1 KEY/VALUE PAIR LIST FUNCTIONS The following set of functions, all inspired by L, consume an even-sized list of pairs. The pairs may be key/value associations from a hash, or just a list of values. The functions will all preserve the original ordering of the pairs, and will not be confused by multiple pairs having the same "key" value - nor even do they require that the first of each pair be a plain string. =head2 pairgrep BLOCK KVLIST Similar to perl's C keyword, but interprets the given list as an even-sized list of pairs. It invokes the BLOCK multiple times, in scalar context, with C<$a> and C<$b> set to successive pairs of values from the KVLIST. Returns an even-sized list of those pairs for which the BLOCK returned true in list context, or the count of the B in scalar context. (Note, therefore, in scalar context that it returns a number half the size of the count of items it would have returned in list context). @subset = pairgrep { $a =~ m/^[[:upper:]]+$/ } @kvlist Similar to C, C aliases C<$a> and C<$b> to elements of the given list. Any modifications of it by the code block will be visible to the caller. =head2 pairfirst BLOCK KVLIST Similar to the C function, but interprets the given list as an even-sized list of pairs. It invokes the BLOCK multiple times, in scalar context, with C<$a> and C<$b> set to successive pairs of values from the KVLIST. Returns the first pair of values from the list for which the BLOCK returned true in list context, or an empty list of no such pair was found. In scalar context it returns a simple boolean value, rather than either the key or the value found. ( $key, $value ) = pairfirst { $a =~ m/^[[:upper:]]+$/ } @kvlist Similar to C, C aliases C<$a> and C<$b> to elements of the given list. Any modifications of it by the code block will be visible to the caller. =head2 pairmap BLOCK KVLIST Similar to perl's C keyword, but interprets the given list as an even-sized list of pairs. It invokes the BLOCK multiple times, in list context, with C<$a> and C<$b> set to successive pairs of values from the KVLIST. Returns the concatenation of all the values returned by the BLOCK in list context, or the count of the number of items that would have been returned in scalar context. @result = pairmap { "The key $a has value $b" } @kvlist Similar to C, C aliases C<$a> and C<$b> to elements of the given list. Any modifications of it by the code block will be visible to the caller. =head2 pairs KVLIST A convenient shortcut to operating on even-sized lists of pairs, this function returns a list of ARRAY references, each containing two items from the given list. It is a more efficient version of pairmap { [ $a, $b ] } KVLIST It is most convenient to use in a C loop, for example: foreach ( pairs @KVLIST ) { my ( $key, $value ) = @$_; ... } =head2 pairkeys KVLIST A convenient shortcut to operating on even-sized lists of pairs, this function returns a list of the the first values of each of the pairs in the given list. It is a more efficient version of pairmap { $a } KVLIST =head2 pairvalues KVLIST A convenient shortcut to operating on even-sized lists of pairs, this function returns a list of the the second values of each of the pairs in the given list. It is a more efficient version of pairmap { $b } KVLIST =head1 OTHER FUNCTIONS =head2 shuffle LIST Returns the elements of LIST in a random order @cards = shuffle 0..51 # 0..51 in a random order =head1 List::SomeUtils FUNCTIONS =head2 Junctions =head3 I There are two schools of thought for how to evaluate a junction on an empty list: =over =item * Reduction to an identity (boolean) =item * Result is undefined (three-valued) =back In the first case, the result of the junction applied to the empty list is determined by a mathematical reduction to an identity depending on whether the underlying comparison is "or" or "and". Conceptually: "any are true" "all are true" -------------- -------------- 2 elements: A || B || 0 A && B && 1 1 element: A || 0 A && 1 0 elements: 0 1 In the second case, three-value logic is desired, in which a junction applied to an empty list returns C rather than true or false Junctions with a C<_u> suffix implement three-valued logic. Those without are boolean. =head3 all BLOCK LIST =head3 all_u BLOCK LIST Returns a true value if all items in LIST meet the criterion given through BLOCK. Sets C<$_> for each item in LIST in turn: print "All values are non-negative" if all { $_ >= 0 } ($x, $y, $z); For an empty LIST, C returns true (i.e. no values failed the condition) and C returns C. Thus, C<< all_u(@list) >> is equivalent to C<< @list ? all(@list) : undef >>. B: because Perl treats C as false, you must check the return value of C with C or you will get the opposite result of what you expect. =head3 any BLOCK LIST =head3 any_u BLOCK LIST Returns a true value if any item in LIST meets the criterion given through BLOCK. Sets C<$_> for each item in LIST in turn: print "At least one non-negative value" if any { $_ >= 0 } ($x, $y, $z); For an empty LIST, C returns false and C returns C. Thus, C<< any_u(@list) >> is equivalent to C<< @list ? any(@list) : undef >>. =head3 none BLOCK LIST =head3 none_u BLOCK LIST Logically the negation of C. Returns a true value if no item in LIST meets the criterion given through BLOCK. Sets C<$_> for each item in LIST in turn: print "No non-negative values" if none { $_ >= 0 } ($x, $y, $z); For an empty LIST, C returns true (i.e. no values failed the condition) and C returns C. Thus, C<< none_u(@list) >> is equivalent to C<< @list ? none(@list) : undef >>. B: because Perl treats C as false, you must check the return value of C with C or you will get the opposite result of what you expect. =head3 notall BLOCK LIST =head3 notall_u BLOCK LIST Logically the negation of C. Returns a true value if not all items in LIST meet the criterion given through BLOCK. Sets C<$_> for each item in LIST in turn: print "Not all values are non-negative" if notall { $_ >= 0 } ($x, $y, $z); For an empty LIST, C returns false and C returns C. Thus, C<< notall_u(@list) >> is equivalent to C<< @list ? notall(@list) : undef >>. =head3 one BLOCK LIST =head3 one_u BLOCK LIST Returns a true value if precisely one item in LIST meets the criterion given through BLOCK. Sets C<$_> for each item in LIST in turn: print "Precisely one value defined" if one { defined($_) } @list; Returns false otherwise. For an empty LIST, C returns false and C returns C. The expression C is almost equivalent to C<1 == true BLOCK LIST>, except for short-cutting. Evaluation of BLOCK will immediately stop at the second true value. =head2 Transformation =head3 apply BLOCK LIST Applies BLOCK to each item in LIST and returns a list of the values after BLOCK has been applied. In scalar context, the last element is returned. This function is similar to C but will not modify the elements of the input list: my @list = (1 .. 4); my @mult = apply { $_ *= 2 } @list; print "\@list = @list\n"; print "\@mult = @mult\n"; __END__ @list = 1 2 3 4 @mult = 2 4 6 8 Think of it as syntactic sugar for for (my @mult = @list) { $_ *= 2 } =head3 insert_after BLOCK VALUE LIST Inserts VALUE after the first item in LIST for which the criterion in BLOCK is true. Sets C<$_> for each item in LIST in turn. my @list = qw/This is a list/; insert_after { $_ eq "a" } "longer" => @list; print "@list"; __END__ This is a longer list =head3 insert_after_string STRING VALUE LIST Inserts VALUE after the first item in LIST which is equal to STRING. my @list = qw/This is a list/; insert_after_string "a", "longer" => @list; print "@list"; __END__ This is a longer list =head3 pairwise BLOCK ARRAY1 ARRAY2 Evaluates BLOCK for each pair of elements in ARRAY1 and ARRAY2 and returns a new list consisting of BLOCK's return values. The two elements are set to C<$a> and C<$b>. Note that those two are aliases to the original value so changing them will modify the input arrays. @a = (1 .. 5); @b = (11 .. 15); @x = pairwise { $a + $b } @a, @b; # returns 12, 14, 16, 18, 20 # mesh with pairwise @a = qw/a b c/; @b = qw/1 2 3/; @x = pairwise { ($a, $b) } @a, @b; # returns a, 1, b, 2, c, 3 =head3 mesh ARRAY1 ARRAY2 [ ARRAY3 ... ] =head3 zip ARRAY1 ARRAY2 [ ARRAY3 ... ] Returns a list consisting of the first elements of each array, then the second, then the third, etc, until all arrays are exhausted. Examples: @x = qw/a b c d/; @y = qw/1 2 3 4/; @z = mesh @x, @y; # returns a, 1, b, 2, c, 3, d, 4 @a = ('x'); @b = ('1', '2'); @c = qw/zip zap zot/; @d = mesh @a, @b, @c; # x, 1, zip, undef, 2, zap, undef, undef, zot C is an alias for C. =head3 uniq LIST =head3 distinct LIST Returns a new list by stripping duplicate values in LIST by comparing the values as hash keys, except that undef is considered separate from ''. The order of elements in the returned list is the same as in LIST. In scalar context, returns the number of unique elements in LIST. my @x = uniq 1, 1, 2, 2, 3, 5, 3, 4; # returns 1 2 3 5 4 my $x = uniq 1, 1, 2, 2, 3, 5, 3, 4; # returns 5 # returns "Mike", "Michael", "Richard", "Rick" my @n = distinct "Mike", "Michael", "Richard", "Rick", "Michael", "Rick" # returns '', undef, 'S1', A5' my @s = distinct '', undef, 'S1', 'A5' # returns '', undef, 'S1', A5' my @w = uniq undef, '', 'S1', 'A5' C is an alias for C. B can be used to give feedback about this behavior. =head3 singleton Returns a new list by stripping values in LIST occurring more than once by comparing the values as hash keys, except that undef is considered separate from ''. The order of elements in the returned list is the same as in LIST. In scalar context, returns the number of elements occurring only once in LIST. my @x = singleton 1,1,2,2,3,4,5 # returns 3 4 5 =head2 Partitioning =head3 after BLOCK LIST Returns a list of the values of LIST after (and not including) the point where BLOCK returns a true value. Sets C<$_> for each element in LIST in turn. @x = after { $_ % 5 == 0 } (1..9); # returns 6, 7, 8, 9 =head3 after_incl BLOCK LIST Same as C but also includes the element for which BLOCK is true. =head3 before BLOCK LIST Returns a list of values of LIST up to (and not including) the point where BLOCK returns a true value. Sets C<$_> for each element in LIST in turn. =head3 before_incl BLOCK LIST Same as C but also includes the element for which BLOCK is true. =head3 part BLOCK LIST Partitions LIST based on the return value of BLOCK which denotes into which partition the current value is put. Returns a list of the partitions thusly created. Each partition created is a reference to an array. my $i = 0; my @part = part { $i++ % 2 } 1 .. 8; # returns [1, 3, 5, 7], [2, 4, 6, 8] You can have a sparse list of partitions as well where non-set partitions will be undef: my @part = part { 2 } 1 .. 10; # returns undef, undef, [ 1 .. 10 ] Be careful with negative values, though: my @part = part { -1 } 1 .. 10; __END__ Modification of non-creatable array value attempted, subscript -1 ... Negative values are only ok when they refer to a partition previously created: my @idx = ( 0, 1, -1 ); my $i = 0; my @part = part { $idx[$++ % 3] } 1 .. 8; # [1, 4, 7], [2, 3, 5, 6, 8] =head2 Iteration =head3 each_array ARRAY1 ARRAY2 ... Creates an array iterator to return the elements of the list of arrays ARRAY1, ARRAY2 throughout ARRAYn in turn. That is, the first time it is called, it returns the first element of each array. The next time, it returns the second elements. And so on, until all elements are exhausted. This is useful for looping over more than one array at once: my $ea = each_array(@a, @b, @c); while ( my ($a, $b, $c) = $ea->() ) { .... } The iterator returns the empty list when it reached the end of all arrays. If the iterator is passed an argument of 'C', then it returns the index of the last fetched set of values, as a scalar. =head3 each_arrayref LIST Like each_array, but the arguments are references to arrays, not the plain arrays. =head3 natatime EXPR, LIST Creates an array iterator, for looping over an array in chunks of C<$n> items at a time. (n at a time, get it?). An example is probably a better explanation than I could give in words. Example: my @x = ('a' .. 'g'); my $it = natatime 3, @x; while (my @vals = $it->()) { print "@vals\n"; } This prints a b c d e f g =head2 Searching =head3 bsearch BLOCK LIST Performs a binary search on LIST which must be a sorted list of values. BLOCK must return a negative value if the current element (stored in C<$_>) is smaller, a positive value if it is bigger and zero if it matches. Returns a boolean value in scalar context. In list context, it returns the element if it was found, otherwise the empty list. =head3 bsearchidx BLOCK LIST =head3 bsearch_index BLOCK LIST Performs a binary search on LIST which must be a sorted list of values. BLOCK must return a negative value if the current element (stored in C<$_>) is smaller, a positive value if it is bigger and zero if it matches. Returns the index of found element, otherwise C<-1>. C is an alias for C. =head3 firstval BLOCK LIST =head3 first_value BLOCK LIST Returns the first element in LIST for which BLOCK evaluates to true. Each element of LIST is set to C<$_> in turn. Returns C if no such element has been found. C is an alias for C. =head3 onlyval BLOCK LIST =head3 only_value BLOCK LIST Returns the only element in LIST for which BLOCK evaluates to true. Sets C<$_> for each item in LIST in turn. Returns C if no such element has been found. C is an alias for C. =head3 lastval BLOCK LIST =head3 last_value BLOCK LIST Returns the last value in LIST for which BLOCK evaluates to true. Each element of LIST is set to C<$_> in turn. Returns C if no such element has been found. C is an alias for C. =head3 firstres BLOCK LIST =head3 first_result BLOCK LIST Returns the result of BLOCK for the first element in LIST for which BLOCK evaluates to true. Each element of LIST is set to C<$_> in turn. Returns C if no such element has been found. C is an alias for C. =head3 onlyres BLOCK LIST =head3 only_result BLOCK LIST Returns the result of BLOCK for the first element in LIST for which BLOCK evaluates to true. Sets C<$_> for each item in LIST in turn. Returns C if no such element has been found. C is an alias for C. =head3 lastres BLOCK LIST =head3 last_result BLOCK LIST Returns the result of BLOCK for the last element in LIST for which BLOCK evaluates to true. Each element of LIST is set to C<$_> in turn. Returns C if no such element has been found. C is an alias for C. =head3 indexes BLOCK LIST Evaluates BLOCK for each element in LIST (assigned to C<$_>) and returns a list of the indices of those elements for which BLOCK returned a true value. This is just like C only that it returns indices instead of values: @x = indexes { $_ % 2 == 0 } (1..10); # returns 1, 3, 5, 7, 9 =head3 firstidx BLOCK LIST =head3 first_index BLOCK LIST Returns the index of the first element in LIST for which the criterion in BLOCK is true. Sets C<$_> for each item in LIST in turn: my @list = (1, 4, 3, 2, 4, 6); printf "item with index %i in list is 4", firstidx { $_ == 4 } @list; __END__ item with index 1 in list is 4 Returns C<-1> if no such item could be found. C is an alias for C. =head3 onlyidx BLOCK LIST =head3 only_index BLOCK LIST Returns the index of the only element in LIST for which the criterion in BLOCK is true. Sets C<$_> for each item in LIST in turn: my @list = (1, 3, 4, 3, 2, 4); printf "uniqe index of item 2 in list is %i", onlyidx { $_ == 2 } @list; __END__ unique index of item 2 in list is 4 Returns C<-1> if either no such item or more than one of these has been found. C is an alias for C. =head3 lastidx BLOCK LIST =head3 last_index BLOCK LIST Returns the index of the last element in LIST for which the criterion in BLOCK is true. Sets C<$_> for each item in LIST in turn: my @list = (1, 4, 3, 2, 4, 6); printf "item with index %i in list is 4", lastidx { $_ == 4 } @list; __END__ item with index 4 in list is 4 Returns C<-1> if no such item could be found. C is an alias for C. =head2 Sorting =head3 sort_by BLOCK LIST Returns the list of values sorted according to the string values returned by the KEYFUNC block or function. A typical use of this may be to sort objects according to the string value of some accessor, such as sort_by { $_->name } @people The key function is called in scalar context, being passed each value in turn as both $_ and the only argument in the parameters, @_. The values are then sorted according to string comparisons on the values returned. This is equivalent to sort { $a->name cmp $b->name } @people except that it guarantees the name accessor will be executed only once per value. One interesting use-case is to sort strings which may have numbers embedded in them "naturally", rather than lexically. sort_by { s/(\d+)/sprintf "%09d", $1/eg; $_ } @strings This sorts strings by generating sort keys which zero-pad the embedded numbers to some level (9 digits in this case), helping to ensure the lexical sort puts them in the correct order. =head3 nsort_by BLOCK LIST Similar to sort_by but compares its key values numerically. =head2 Counting and calculation =head3 true BLOCK LIST Counts the number of elements in LIST for which the criterion in BLOCK is true. Sets C<$_> for each item in LIST in turn: printf "%i item(s) are defined", true { defined($_) } @list; =head3 false BLOCK LIST Counts the number of elements in LIST for which the criterion in BLOCK is false. Sets C<$_> for each item in LIST in turn: printf "%i item(s) are not defined", false { defined($_) } @list; =head3 minmax LIST Calculates the minimum and maximum of LIST and returns a two element list with the first element being the minimum and the second the maximum. Returns the empty list if LIST was empty. The C algorithm differs from a naive iteration over the list where each element is compared to two values being the so far calculated min and max value in that it only requires 3n/2 - 2 comparisons. Thus it is the most efficient possible algorithm. However, the Perl implementation of it has some overhead simply due to the fact that there are more lines of Perl code involved. Therefore, LIST needs to be fairly big in order for C to win over a naive implementation. This limitation does not apply to the XS version. =head3 mode LIST Calculates the most common items in the list and returns them as a list. This is effectively done by string comparisons, so references will be stringified. If they implement string overloading, this will be used. If more than one item appears the same number of times in the list, all such items will be returned. For example, the mode of a unique list is the list itself. This function B returns a list. That means that in scalar context you get a count indicating the number of modes in the list. =head1 List::UtilsBy Functions =head2 rev_sort_by =head2 rev_nsort_by @vals = rev_sort_by { KEYFUNC } @vals @vals = rev_nsort_by { KEYFUNC } @vals I Similar to L and L but returns the list in the reverse order. Equivalent to @vals = reverse sort_by { KEYFUNC } @vals except that these functions are slightly more efficient because they avoid the final C operation. =head2 max_by $optimal = max_by { KEYFUNC } @vals @optimal = max_by { KEYFUNC } @vals Returns the (first) value from C<@vals> that gives the numerically largest result from the key function. my $tallest = max_by { $_->height } @people use File::stat qw( stat ); my $newest = max_by { stat($_)->mtime } @files; In scalar context, the first maximal value is returned. In list context, a list of all the maximal values is returned. This may be used to obtain positions other than the first, if order is significant. If called on an empty list, an empty list is returned. For symmetry with the L function, this is also provided under the name C since it behaves numerically. =head2 min_by $optimal = min_by { KEYFUNC } @vals @optimal = min_by { KEYFUNC } @vals Similar to L but returns values which give the numerically smallest result from the key function. Also provided as C =head2 minmax_by ( $minimal, $maximal ) = minmax_by { KEYFUNC } @vals Similar to calling both L and L with the same key function on the same list. This version is more efficient than calling the two other functions individually, as it has less work to perform overall. In the case of ties, only the first optimal element found in each case is returned. Also provided as C. =head2 uniq_by @vals = uniq_by { KEYFUNC } @vals Returns a list of the subset of values for which the key function block returns unique values. The first value yielding a particular key is chosen, subsequent values are rejected. my @some_fruit = uniq_by { $_->colour } @fruit; To select instead the last value per key, reverse the input list. If the order of the results is significant, don't forget to reverse the result as well: my @some_fruit = reverse uniq_by { $_->colour } reverse @fruit; Because the values returned by the key function are used as hash keys, they ought to either be strings, or at least well-behaved as strings (such as numbers, or object references which overload stringification in a suitable manner). =head2 partition_by %parts = partition_by { KEYFUNC } @vals Returns a key/value list of ARRAY refs containing all the original values distributed according to the result of the key function block. Each value will be an ARRAY ref containing all the values which returned the string from the key function, in their original order. my %balls_by_colour = partition_by { $_->colour } @balls; Because the values returned by the key function are used as hash keys, they ought to either be strings, or at least well-behaved as strings (such as numbers, or object references which overload stringification in a suitable manner). =head2 count_by %counts = count_by { KEYFUNC } @vals Returns a key/value list of integers, giving the number of times the key function block returned the key, for each value in the list. my %count_of_balls = count_by { $_->colour } @balls; Because the values returned by the key function are used as hash keys, they ought to either be strings, or at least well-behaved as strings (such as numbers, or object references which overload stringification in a suitable manner). =head2 zip_by @vals = zip_by { ITEMFUNC } \@arr0, \@arr1, \@arr2,... Returns a list of each of the values returned by the function block, when invoked with values from across each each of the given ARRAY references. Each value in the returned list will be the result of the function having been invoked with arguments at that position, from across each of the arrays given. my @transposition = zip_by { [ @_ ] } @matrix; my @names = zip_by { "$_[1], $_[0]" } \@firstnames, \@surnames; print zip_by { "$_[0] => $_[1]\n" } [ keys %hash ], [ values %hash ]; If some of the arrays are shorter than others, the function will behave as if they had C in the trailing positions. The following two lines are equivalent: zip_by { f(@_) } [ 1, 2, 3 ], [ "a", "b" ] f( 1, "a" ), f( 2, "b" ), f( 3, undef ) The item function is called by C, so if it returns a list, the entire list is included in the result. This can be useful for example, for generating a hash from two separate lists of keys and values my %nums = zip_by { @_ } [qw( one two three )], [ 1, 2, 3 ]; # %nums = ( one => 1, two => 2, three => 3 ) (A function having this behaviour is sometimes called C, e.g. in Haskell, but that name would not fit the naming scheme used by this module). =head2 unzip_by $arr0, $arr1, $arr2, ... = unzip_by { ITEMFUNC } @vals Returns a list of ARRAY references containing the values returned by the function block, when invoked for each of the values given in the input list. Each of the returned ARRAY references will contain the values returned at that corresponding position by the function block. That is, the first returned ARRAY reference will contain all the values returned in the first position by the function block, the second will contain all the values from the second position, and so on. my ( $firstnames, $lastnames ) = unzip_by { m/^(.*?) (.*)$/ } @names; If the function returns lists of differing lengths, the result will be padded with C in the missing elements. This function is an inverse of L, if given a corresponding inverse function. =head2 extract_by @vals = extract_by { SELECTFUNC } @arr Removes elements from the referenced array on which the selection function returns true, and returns a list containing those elements. This function is similar to C, except that it modifies the referenced array to remove the selected values from it, leaving only the unselected ones. my @red_balls = extract_by { $_->color eq "red" } @balls; # Now there are no red balls in the @balls array This function modifies a real array, unlike most of the other functions in this module. Because of this, it requires a real array, not just a list. This function is implemented by invoking C on the array, not by constructing a new list and assigning it. One result of this is that weak references will not be disturbed. extract_by { !defined $_ } @refs; will leave weak references weakened in the C<@refs> array, whereas @refs = grep { defined $_ } @refs; will strengthen them all again. =head2 extract_first_by $val = extract_first_by { SELECTFUNC } @arr A hybrid between L and C. Removes the first element from the referenced array on which the selection function returns true, returning it. As with L, this function requires a real array and not just a list, and is also implemented using C so that weak references are not disturbed. If this function fails to find a matching element, it will return an empty list in list context. This allows a caller to distinguish the case between no matching element, and the first matching element being C. =head2 weighted_shuffle_by @vals = weighted_shuffle_by { WEIGHTFUNC } @vals Returns the list of values shuffled into a random order. The randomisation is not uniform, but weighted by the value returned by the C. The probability of each item being returned first will be distributed with the distribution of the weights, and so on recursively for the remaining items. =head2 bundle_by @vals = bundle_by { BLOCKFUNC } $number, @vals Similar to a regular C functional, returns a list of the values returned by C. Values from the input list are given to the block function in bundles of C<$number>. If given a list of values whose length does not evenly divide by C<$number>, the final call will be passed fewer elements than the others. =head1 EXPORTS This module exports nothing by default. You can import functions by name, or get everything with the C<:all> tag. =head1 SEE ALSO L, L and L, obviously. Also see C, which unifies many more util modules, and also lets you rename functions as part of the import. =head1 BUGS Please report any bugs or feature requests to C, or through the web interface at L. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. Bugs may be submitted at L or via email to L. I am also usually active on IRC as 'autarch' on C. =head1 SOURCE The source code repository for List-AllUtils can be found at L. =head1 DONATIONS If you'd like to thank me for the work I've done on this module, please consider making a "donation" to me via PayPal. I spend a lot of free time creating free software, and would appreciate any support you'd care to offer. Please note that B in order for me to continue working on this particular software. I will continue to do so, inasmuch as I have in the past, for as long as it interests me. Similarly, a donation made in this way will probably not make me work on this software much more, unless I get so many donations that I can consider working on free software full time (let's all have a chuckle at that together). To donate, log into PayPal and send money to autarch@urth.org, or use the button at L. =head1 AUTHOR Dave Rolsky =head1 CONTRIBUTORS =for stopwords Karen Etheridge Ricardo Signes Yanick Champoux =over 4 =item * Karen Etheridge =item * Ricardo Signes =item * Yanick Champoux =back =head1 COPYRIGHT AND LICENSE This software is Copyright (c) 2018 by Dave Rolsky. This is free software, licensed under: The Artistic License 2.0 (GPL Compatible) The full text of the license can be found in the F file included with this distribution. =cut List-AllUtils-0.15/xt/0000755000175000017500000000000013403536165014402 5ustar autarchautarchList-AllUtils-0.15/xt/release/0000755000175000017500000000000013403536165016022 5ustar autarchautarchList-AllUtils-0.15/xt/release/cpan-changes.t0000644000175000017500000000034413403536165020537 0ustar autarchautarchuse strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::CPAN::Changes 0.012 use Test::More 0.96 tests => 1; use Test::CPAN::Changes; subtest 'changes_ok' => sub { changes_file_ok('Changes'); }; List-AllUtils-0.15/xt/release/meta-json.t0000644000175000017500000000006413403536165020104 0ustar autarchautarch#!perl use Test::CPAN::Meta::JSON; meta_json_ok(); List-AllUtils-0.15/xt/author/0000755000175000017500000000000013403536165015704 5ustar autarchautarchList-AllUtils-0.15/xt/author/pod-spell.t0000644000175000017500000000122013403536165017763 0ustar autarchautarchuse strict; use warnings; use Test::More; # generated by Dist::Zilla::Plugin::Test::PodSpelling 2.007005 use Test::Spelling 0.12; use Pod::Wordlist; add_stopwords(); all_pod_files_spelling_ok( qw( bin lib ) ); __DATA__ ARRAYn AllUtils BLOCK's Champoux DROLSKY DROLSKY's Dave EXPR Etheridge Haskell KEYFUNC KVLIST Karen List PayPal Ricardo Rolsky Rolsky's Signes Yanick autarch bsearchidx drolsky ether firstidx firstres firstval lastidx lastres lastval lib maxstr minmax minstr natatime notall onlyidx onlyres onlyval pairfirst pairgrep pairkeys pairmap pairvalues probability randomisation rjbs specialisations thusly uniq unselected util yanick List-AllUtils-0.15/xt/author/synopsis.t0000644000175000017500000000006013403536165017754 0ustar autarchautarch#!perl use Test::Synopsis; all_synopsis_ok(); List-AllUtils-0.15/xt/author/no-tabs.t0000644000175000017500000000050413403536165017433 0ustar autarchautarchuse strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::NoTabs 0.15 use Test::More 0.88; use Test::NoTabs; my @files = ( 'lib/List/AllUtils.pm', 't/00-report-prereqs.dd', 't/00-report-prereqs.t', 't/basic.t', 't/prototype.t' ); notabs_ok($_) foreach @files; done_testing; List-AllUtils-0.15/xt/author/portability.t0000644000175000017500000000026713403536165020440 0ustar autarchautarchuse strict; use warnings; use Test::More; eval 'use Test::Portability::Files'; plan skip_all => 'Test::Portability::Files required for testing portability' if $@; run_tests(); List-AllUtils-0.15/xt/author/mojibake.t0000644000175000017500000000015113403536165017647 0ustar autarchautarch#!perl use strict; use warnings qw(all); use Test::More; use Test::Mojibake; all_files_encoding_ok(); List-AllUtils-0.15/xt/author/test-all-my-deps.t0000644000175000017500000000257313403536165021201 0ustar autarchautarchuse strict; use warnings; use Cwd qw( abs_path ); use Test::More; BEGIN { plan skip_all => 'Must set LIST_ALLUTILS_TEST_DEPS to true in order to run these tests' unless $ENV{LIST_ALLUTILS_TEST_DEPS}; } use Test::DependentModules qw( test_all_dependents ); local $ENV{PERL_TEST_DM_LOG_DIR} = abs_path('.'); my $exclude = qr/ ^ (?: App-Magpie )$ /x; my %exclude = ( 'App-Magpie' => 1, # requires URPM which does not install on Ubuntu 'App-Map-Metro' => 1, # dependency failures 'DBD-TreeData' => 1, # fails tests 'Devel-IPerl' => 1, # depends on ipython 'Dist-Zilla-PluginBundle-Prereqs' => 1, # fails tests 'MarpaX-Grammar-GraphViz2' => 1, # unsatisfiable prereqs 'Gtk3-Ex-PdfViewer' => 1, # requires various gtk libs 'Net-DNS-SPF-Expander' => 1, # fails tests 'Pantry' => 1, # fails tests 'Pcore' => 1, # Build.PL fails 'Silki' => 1, # fails tests 'Statistics-NiceR' => 1, # requires an R executable 'Transform-Alert' => 1, # fails tests ); test_all_dependents( 'List-AllUtils', { filter => sub { !$exclude{ $_[0] } } } ); List-AllUtils-0.15/xt/author/test-version.t0000644000175000017500000000063713403536165020541 0ustar autarchautarchuse strict; use warnings; use Test::More; # generated by Dist::Zilla::Plugin::Test::Version 1.09 use Test::Version; my @imports = qw( version_all_ok ); my $params = { is_strict => 1, has_version => 1, multiple => 0, }; push @imports, $params if version->parse( $Test::Version::VERSION ) >= version->parse('1.002'); Test::Version->import(@imports); version_all_ok; done_testing; List-AllUtils-0.15/xt/author/pod-coverage.t0000644000175000017500000000172013403536165020444 0ustar autarchautarch#!perl # This file was automatically generated by Dist::Zilla::Plugin::Test::Pod::Coverage::Configurable 0.07. use Test::Pod::Coverage 1.08; use Test::More 0.88; BEGIN { if ( $] <= 5.008008 ) { plan skip_all => 'These tests require Pod::Coverage::TrustPod, which only works with Perl 5.8.9+'; } } use Pod::Coverage::TrustPod; my %skip = map { $_ => 1 } qw( ); my @modules; for my $module ( all_modules() ) { next if $skip{$module}; push @modules, $module; } plan skip_all => 'All the modules we found were excluded from POD coverage test.' unless @modules; plan tests => scalar @modules; my %trustme = (); my @also_private; for my $module ( sort @modules ) { pod_coverage_ok( $module, { coverage_class => 'Pod::Coverage::TrustPod', also_private => \@also_private, trustme => $trustme{$module} || [], }, "pod coverage for $module" ); } done_testing(); List-AllUtils-0.15/xt/author/00-compile.t0000644000175000017500000000254513403536165017744 0ustar autarchautarchuse 5.006; use strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::Compile 2.058 use Test::More; plan tests => 2; my @module_files = ( 'List/AllUtils.pm' ); # no fake home requested my @switches = ( -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; diag('Running: ', join(', ', map { my $str = $_; $str =~ s/'/\\'/g; q{'} . $str . q{'} } $^X, @switches, '-e', "require q[$lib]")) if $ENV{PERL_COMPILE_TEST_DEBUG}; my $pid = open3($stdin, '>&STDERR', $stderr, $^X, @switches, '-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 { +require blib; 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) ); List-AllUtils-0.15/xt/author/pod-syntax.t0000644000175000017500000000025213403536165020176 0ustar autarchautarch#!perl # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. use strict; use warnings; use Test::More; use Test::Pod 1.41; all_pod_files_ok(); List-AllUtils-0.15/xt/author/eol.t0000644000175000017500000000053613403536165016654 0ustar autarchautarchuse strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::EOL 0.19 use Test::More 0.88; use Test::EOL; my @files = ( 'lib/List/AllUtils.pm', 't/00-report-prereqs.dd', 't/00-report-prereqs.t', 't/basic.t', 't/prototype.t' ); eol_unix_ok($_, { trailing_whitespace => 1 }) foreach @files; done_testing; List-AllUtils-0.15/xt/author/tidyall.t0000644000175000017500000000067413403536165017542 0ustar autarchautarch# This file was automatically generated by Dist::Zilla::Plugin::Test::TidyAll v$VERSION use Test::More 0.88; BEGIN { if ( $] < 5.010 ) { plan skip_all => 'This test requires Perl version 5.010'; } } use Test::Code::TidyAll 0.24; tidyall_ok( verbose => ( exists $ENV{TEST_TIDYALL_VERBOSE} ? $ENV{TEST_TIDYALL_VERBOSE} : 1 ), jobs => ( exists $ENV{TEST_TIDYALL_JOBS} ? $ENV{TEST_TIDYALL_JOBS} : 4 ), ); done_testing; List-AllUtils-0.15/perlcriticrc0000644000175000017500000000347113403536165016364 0ustar autarchautarchseverity = 3 verbose = 11 theme = core + pbp + bugs + maintenance + cosmetic + complexity + security + tests + moose program-extensions = pl psgi t exclude = Subroutines::ProhibitCallsToUndeclaredSubs [BuiltinFunctions::ProhibitStringySplit] severity = 3 [CodeLayout::RequireTrailingCommas] severity = 3 [ControlStructures::ProhibitCStyleForLoops] severity = 3 [InputOutput::RequireCheckedSyscalls] functions = :builtins exclude_functions = sleep severity = 3 [RegularExpressions::ProhibitComplexRegexes] max_characters = 200 [RegularExpressions::ProhibitUnusualDelimiters] severity = 3 [Subroutines::ProhibitUnusedPrivateSubroutines] private_name_regex = _(?!build)\w+ [TestingAndDebugging::ProhibitNoWarnings] allow = redefine [ValuesAndExpressions::ProhibitEmptyQuotes] severity = 3 [ValuesAndExpressions::ProhibitInterpolationOfLiterals] severity = 3 [ValuesAndExpressions::RequireUpperCaseHeredocTerminator] severity = 3 [Variables::ProhibitPackageVars] add_packages = Carp Test::Builder [-Subroutines::RequireFinalReturn] # This incorrectly thinks signatures are prototypes. [-Subroutines::ProhibitSubroutinePrototypes] [-ErrorHandling::RequireCarping] # No need for /xsm everywhere [-RegularExpressions::RequireDotMatchAnything] [-RegularExpressions::RequireExtendedFormatting] [-RegularExpressions::RequireLineBoundaryMatching] # http://stackoverflow.com/questions/2275317/why-does-perlcritic-dislike-using-shift-to-populate-subroutine-variables [-Subroutines::RequireArgUnpacking] # "use v5.14" is more readable than "use 5.014" [-ValuesAndExpressions::ProhibitVersionStrings] # Explicitly returning undef is a _good_ thing in many cases, since it # prevents very common errors when using a sub in list context to construct a # hash and ending up with a missing value or key. [-Subroutines::ProhibitExplicitReturnUndef] List-AllUtils-0.15/cpanfile0000644000175000017500000000315413403536165015456 0ustar autarchautarchrequires "Exporter" => "0"; requires "List::SomeUtils" => "0.56"; requires "List::Util" => "1.45"; requires "List::UtilsBy" => "0.11"; requires "base" => "0"; requires "strict" => "0"; requires "warnings" => "0"; on 'test' => sub { requires "ExtUtils::MakeMaker" => "0"; requires "File::Spec" => "0"; requires "Sub::Util" => "0"; requires "Test::More" => "0.96"; }; on 'test' => sub { recommends "CPAN::Meta" => "2.120900"; }; on 'configure' => sub { requires "ExtUtils::MakeMaker" => "0"; }; on 'develop' => sub { requires "Code::TidyAll" => "0.56"; requires "Code::TidyAll::Plugin::SortLines::Naturally" => "0.000003"; requires "Code::TidyAll::Plugin::Test::Vars" => "0.02"; requires "Cwd" => "0"; requires "File::Spec" => "0"; requires "IO::Handle" => "0"; requires "IPC::Open3" => "0"; requires "Parallel::ForkManager" => "1.19"; requires "Perl::Critic" => "1.126"; requires "Perl::Tidy" => "20160302"; requires "Pod::Coverage::TrustPod" => "0"; requires "Pod::Wordlist" => "0"; requires "Test::CPAN::Changes" => "0.19"; requires "Test::CPAN::Meta::JSON" => "0.16"; requires "Test::Code::TidyAll" => "0.50"; requires "Test::DependentModules" => "0"; requires "Test::EOL" => "0"; requires "Test::Mojibake" => "0"; requires "Test::More" => "0.96"; requires "Test::NoTabs" => "0"; requires "Test::Pod" => "1.41"; requires "Test::Pod::Coverage" => "1.08"; requires "Test::Portability::Files" => "0"; requires "Test::Spelling" => "0.12"; requires "Test::Synopsis" => "0"; requires "Test::Vars" => "0.009"; requires "Test::Version" => "2.05"; requires "perl" => "5.006"; }; List-AllUtils-0.15/tidyall.ini0000644000175000017500000000106213403536165016111 0ustar autarchautarchignore = .build/**/* ignore = List-AllUtils-*/**/* ignore = blib/**/* ignore = t/00-* ignore = t/author-* ignore = t/release-* ignore = t/zzz-* ignore = xt/**/* [PerlCritic] select = **/*.{pl,pm,t,psgi} argv = --profile=$ROOT/perlcriticrc [PerlCritic non-auto-generated xt] select = xt/author/test-all-my-deps.t argv = --profile=$ROOT/perlcriticrc [PerlTidy] select = **/*.{pl,pm,t,psgi} argv = --profile=$ROOT/perltidyrc [PerlTidy non-auto-generated xt] select = xt/author/test-all-my-deps.t argv = --profile=$ROOT/perltidyrc [Test::Vars] select = **/*.pm List-AllUtils-0.15/t/0000755000175000017500000000000013403536165014212 5ustar autarchautarchList-AllUtils-0.15/t/00-report-prereqs.dd0000644000175000017500000000624013403536165017734 0ustar autarchautarchdo { my $x = { 'configure' => { 'requires' => { 'ExtUtils::MakeMaker' => '0' } }, 'develop' => { 'requires' => { 'Code::TidyAll' => '0.56', 'Code::TidyAll::Plugin::SortLines::Naturally' => '0.000003', 'Code::TidyAll::Plugin::Test::Vars' => '0.02', 'Cwd' => '0', 'File::Spec' => '0', 'IO::Handle' => '0', 'IPC::Open3' => '0', 'Parallel::ForkManager' => '1.19', 'Perl::Critic' => '1.126', 'Perl::Tidy' => '20160302', 'Pod::Coverage::TrustPod' => '0', 'Pod::Wordlist' => '0', 'Test::CPAN::Changes' => '0.19', 'Test::CPAN::Meta::JSON' => '0.16', 'Test::Code::TidyAll' => '0.50', 'Test::DependentModules' => '0', 'Test::EOL' => '0', 'Test::Mojibake' => '0', 'Test::More' => '0.96', 'Test::NoTabs' => '0', 'Test::Pod' => '1.41', 'Test::Pod::Coverage' => '1.08', 'Test::Portability::Files' => '0', 'Test::Spelling' => '0.12', 'Test::Synopsis' => '0', 'Test::Vars' => '0.009', 'Test::Version' => '2.05', 'perl' => '5.006' } }, 'runtime' => { 'requires' => { 'Exporter' => '0', 'List::SomeUtils' => '0.56', 'List::Util' => '1.45', 'List::UtilsBy' => '0.11', 'base' => '0', 'strict' => '0', 'warnings' => '0' } }, 'test' => { 'recommends' => { 'CPAN::Meta' => '2.120900' }, 'requires' => { 'ExtUtils::MakeMaker' => '0', 'File::Spec' => '0', 'Sub::Util' => '0', 'Test::More' => '0.96' } } }; $x; }List-AllUtils-0.15/t/00-report-prereqs.t0000644000175000017500000001342613403536165017614 0ustar autarchautarch#!perl use strict; use warnings; # This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.027 use Test::More tests => 1; use ExtUtils::MakeMaker; use File::Spec; # from $version::LAX my $lax_version_re = qr/(?: undef | (?: (?:[0-9]+) (?: \. | (?:\.[0-9]+) (?:_[0-9]+)? )? | (?:\.[0-9]+) (?:_[0-9]+)? ) | (?: v (?:[0-9]+) (?: (?:\.[0-9]+)+ (?:_[0-9]+)? )? | (?:[0-9]+)? (?:\.[0-9]+){2,} (?:_[0-9]+)? ) )/x; # hide optional CPAN::Meta modules from prereq scanner # and check if they are available my $cpan_meta = "CPAN::Meta"; my $cpan_meta_pre = "CPAN::Meta::Prereqs"; my $HAS_CPAN_META = eval "require $cpan_meta; $cpan_meta->VERSION('2.120900')" && eval "require $cpan_meta_pre"; ## no critic # Verify requirements? my $DO_VERIFY_PREREQS = 1; sub _max { my $max = shift; $max = ( $_ > $max ) ? $_ : $max for @_; return $max; } sub _merge_prereqs { my ($collector, $prereqs) = @_; # CPAN::Meta::Prereqs object if (ref $collector eq $cpan_meta_pre) { return $collector->with_merged_prereqs( CPAN::Meta::Prereqs->new( $prereqs ) ); } # Raw hashrefs for my $phase ( keys %$prereqs ) { for my $type ( keys %{ $prereqs->{$phase} } ) { for my $module ( keys %{ $prereqs->{$phase}{$type} } ) { $collector->{$phase}{$type}{$module} = $prereqs->{$phase}{$type}{$module}; } } } return $collector; } my @include = qw( ); my @exclude = qw( ); # Add static prereqs to the included modules list my $static_prereqs = do './t/00-report-prereqs.dd'; # Merge all prereqs (either with ::Prereqs or a hashref) my $full_prereqs = _merge_prereqs( ( $HAS_CPAN_META ? $cpan_meta_pre->new : {} ), $static_prereqs ); # Add dynamic prereqs to the included modules list (if we can) my ($source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; my $cpan_meta_error; if ( $source && $HAS_CPAN_META && (my $meta = eval { CPAN::Meta->load_file($source) } ) ) { $full_prereqs = _merge_prereqs($full_prereqs, $meta->prereqs); } else { $cpan_meta_error = $@; # capture error from CPAN::Meta->load_file($source) $source = 'static metadata'; } my @full_reports; my @dep_errors; my $req_hash = $HAS_CPAN_META ? $full_prereqs->as_string_hash : $full_prereqs; # Add static includes into a fake section for my $mod (@include) { $req_hash->{other}{modules}{$mod} = 0; } for my $phase ( qw(configure build test runtime develop other) ) { next unless $req_hash->{$phase}; next if ($phase eq 'develop' and not $ENV{AUTHOR_TESTING}); for my $type ( qw(requires recommends suggests conflicts modules) ) { next unless $req_hash->{$phase}{$type}; my $title = ucfirst($phase).' '.ucfirst($type); my @reports = [qw/Module Want Have/]; for my $mod ( sort keys %{ $req_hash->{$phase}{$type} } ) { next if $mod eq 'perl'; next if grep { $_ eq $mod } @exclude; my $file = $mod; $file =~ s{::}{/}g; $file .= ".pm"; my ($prefix) = grep { -e File::Spec->catfile($_, $file) } @INC; my $want = $req_hash->{$phase}{$type}{$mod}; $want = "undef" unless defined $want; $want = "any" if !$want && $want == 0; my $req_string = $want eq 'any' ? 'any version required' : "version '$want' required"; if ($prefix) { my $have = MM->parse_version( File::Spec->catfile($prefix, $file) ); $have = "undef" unless defined $have; push @reports, [$mod, $want, $have]; if ( $DO_VERIFY_PREREQS && $HAS_CPAN_META && $type eq 'requires' ) { if ( $have !~ /\A$lax_version_re\z/ ) { push @dep_errors, "$mod version '$have' cannot be parsed ($req_string)"; } elsif ( ! $full_prereqs->requirements_for( $phase, $type )->accepts_module( $mod => $have ) ) { push @dep_errors, "$mod version '$have' is not in required range '$want'"; } } } else { push @reports, [$mod, $want, "missing"]; if ( $DO_VERIFY_PREREQS && $type eq 'requires' ) { push @dep_errors, "$mod is not installed ($req_string)"; } } } if ( @reports ) { push @full_reports, "=== $title ===\n\n"; my $ml = _max( map { length $_->[0] } @reports ); my $wl = _max( map { length $_->[1] } @reports ); my $hl = _max( map { length $_->[2] } @reports ); if ($type eq 'modules') { splice @reports, 1, 0, ["-" x $ml, "", "-" x $hl]; push @full_reports, map { sprintf(" %*s %*s\n", -$ml, $_->[0], $hl, $_->[2]) } @reports; } else { splice @reports, 1, 0, ["-" x $ml, "-" x $wl, "-" x $hl]; push @full_reports, map { sprintf(" %*s %*s %*s\n", -$ml, $_->[0], $wl, $_->[1], $hl, $_->[2]) } @reports; } push @full_reports, "\n"; } } } if ( @full_reports ) { diag "\nVersions for all modules listed in $source (including optional ones):\n\n", @full_reports; } if ( $cpan_meta_error || @dep_errors ) { diag "\n*** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ***\n"; } if ( $cpan_meta_error ) { my ($orig_source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; diag "\nCPAN::Meta->load_file('$orig_source') failed with: $cpan_meta_error\n"; } if ( @dep_errors ) { diag join("\n", "\nThe following REQUIRED prerequisites were not satisfied:\n", @dep_errors, "\n" ); } pass; # vim: ts=4 sts=4 sw=4 et: List-AllUtils-0.15/t/prototype.t0000644000175000017500000000054213403536165016445 0ustar autarchautarchuse strict; use warnings; use Test::More; use List::AllUtils qw( all pairwise rev_nsort_by ); use Sub::Util qw( prototype ); is( prototype( \&all ), '&@', 'prototype for all' ); is( prototype( \&pairwise ), '&\@\@', 'prototype for pairwise' ); is( prototype( \&rev_nsort_by ), '&@', 'prototype for rev_nsort_by' ); done_testing(); List-AllUtils-0.15/t/basic.t0000644000175000017500000000543213403536165015464 0ustar autarchautarchuse strict; use warnings; # This is needed to produce sub redefined warnings from List::AllUtils when # List::Util and List::MoreUtils export some of the same subs. I'm not sure # why. BEGIN { $^W++; } use Test::More; my @warnings; BEGIN { ## no critic (Variables::RequireLocalizedPunctuationVars) $SIG{__WARN__} = sub { push @warnings, join q{}, @_ }; } ## no critic (Modules::ProhibitMultiplePackages) { package Foo; use List::AllUtils; } ok( !Foo->can('first'), 'no exports by default' ); { package Bar; use List::AllUtils qw( first any apply rev_sort_by ); sub test_first { return first { $_ > 1 } @_; } sub test_apply { return apply { $_ *= 2 } @_; } sub test_rev_sort_by { return rev_sort_by { $_->{name} } @_; } } ok( Bar->can('first'), 'explicitly import first' ); ok( Bar->can('any'), 'explicitly import any' ); ok( Bar->can('apply'), 'explicitly import apply' ); ok( !Bar->can('all'), 'did not import all' ); is( Bar::test_first( 1, 2, 3 ), 2, 'Bar::test_first returns expected value' ); is_deeply( [ Bar::test_apply( 1, 2, 3 ) ], [ 2, 4, 6 ], 'Bar::test_apply returns expected list' ); is_deeply( [ Bar::test_rev_sort_by( { name => 'Dave' }, { name => 'Huey-Ling' }, ) ], [ { name => 'Huey-Ling' }, { name => 'Dave' } ], 'Bar::test_sort_by returns expected list' ); { package Baz; use List::AllUtils qw( :all ); sub test_first { return first { $_ > 1 } @_; } sub test_apply { return apply { $_ *= 2 } @_; } } ok( Baz->can('first'), 'imported everything, got first' ); ok( Baz->can('any'), 'imported everything, got any' ); ok( Baz->can('all'), 'imported everything, got all' ); ok( Baz->can('apply'), 'imported everything, got apply' ); ok( Baz->can('uniq'), 'imported everything, got uniq' ); ok( Baz->can('uniq_by'), 'imported everything, got uniq_by from UtilsBy' ); is( Baz::test_first( 1, 2, 3 ), 2, 'Baz::test_first returns expected value' ); is_deeply( [ Baz::test_apply( 1, 2, 3 ) ], [ 2, 4, 6 ], 'Baz::test_apply returns expected list' ); is( ( List::AllUtils::first { $_ > 5 } ( 1, 2, 5, 22, 7 ) ), 22, 'explicitly calling List::AllUtils::first produces the correct result' ); ok( ( List::AllUtils::any { $_ > 5 } ( 1, 2, 5, 22, 7 ) ), 'explicitly calling List::AllUtils::any produces the correct result' ); { package ImportsAllSub; use List::AllUtils qw( all ); } ok( ImportsAllSub->can('all'), 'ImportsAllSub has all()' ); ok( !ImportsAllSub->can('none'), 'ImportsAllSub does not have none()' ); ok( ( !grep {/Overwriting existing sub 'List::AllUtils.+'/} @warnings ), 'no subroutines were redefined in List::AllUtils' ) or diag(@warnings); done_testing(); List-AllUtils-0.15/MANIFEST0000644000175000017500000000121413403536165015076 0ustar autarchautarch# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.012. CODE_OF_CONDUCT.md CONTRIBUTING.md Changes INSTALL LICENSE MANIFEST META.json META.yml Makefile.PL README.md cpanfile dist.ini lib/List/AllUtils.pm perlcriticrc perltidyrc t/00-report-prereqs.dd t/00-report-prereqs.t t/basic.t t/prototype.t tidyall.ini xt/author/00-compile.t xt/author/eol.t xt/author/mojibake.t xt/author/no-tabs.t xt/author/pod-coverage.t xt/author/pod-spell.t xt/author/pod-syntax.t xt/author/portability.t xt/author/synopsis.t xt/author/test-all-my-deps.t xt/author/test-version.t xt/author/tidyall.t xt/release/cpan-changes.t xt/release/meta-json.t List-AllUtils-0.15/INSTALL0000644000175000017500000000434013403536165015001 0ustar autarchautarchThis is the Perl distribution List-AllUtils. Installing List-AllUtils is straightforward. ## Installation with cpanm If you have cpanm, you only need one line: % cpanm List::AllUtils If it does not have permission to install modules to the current perl, cpanm will automatically set up and install to a local::lib in your home directory. See the local::lib documentation (https://metacpan.org/pod/local::lib) for details on enabling it in your environment. ## Installing with the CPAN shell Alternatively, if your CPAN shell is set up, you should just be able to do: % cpan List::AllUtils ## Manual installation As a last resort, you can manually install it. Download the tarball, untar it, install configure prerequisites (see below), then build it: % perl Makefile.PL % make && make test Then install it: % make install On Windows platforms, you should use `dmake` or `nmake`, instead of `make`. If your perl is system-managed, you can create a local::lib in your home directory to install modules to. For details, see the local::lib documentation: https://metacpan.org/pod/local::lib The prerequisites of this distribution will also have to be installed manually. The prerequisites are listed in one of the files: `MYMETA.yml` or `MYMETA.json` generated by running the manual build process described above. ## Configure Prerequisites This distribution requires other modules to be installed before this distribution's installer can be run. They can be found under the "configure_requires" key of META.yml or the "{prereqs}{configure}{requires}" key of META.json. ## Other Prerequisites This distribution may require additional modules to be installed after running Makefile.PL. Look for prerequisites in the following phases: * to run make, PHASE = build * to use the module code itself, PHASE = runtime * to run tests, PHASE = test They can all be found in the "PHASE_requires" key of MYMETA.yml or the "{prereqs}{PHASE}{requires}" key of MYMETA.json. ## Documentation List-AllUtils documentation is available as POD. You can run `perldoc` from a shell to read the documentation: % perldoc List::AllUtils For more information on installing Perl modules via CPAN, please see: https://www.cpan.org/modules/INSTALL.html List-AllUtils-0.15/dist.ini0000644000175000017500000000156613403536165015423 0ustar autarchautarchname = List-AllUtils author = Dave Rolsky license = Artistic_2_0 copyright_holder = Dave Rolsky [@DROLSKY] dist = List-AllUtils next_release_width = 7 stopwords = ARRAYn stopwords = BLOCK's stopwords = bsearchidx stopwords = EXPR stopwords = firstidx stopwords = firstres stopwords = firstval stopwords = Haskell stopwords = KEYFUNC stopwords = KVLIST stopwords = lastidx stopwords = lastres stopwords = lastval stopwords = maxstr stopwords = minmax stopwords = minstr stopwords = natatime stopwords = notall stopwords = onlyidx stopwords = onlyres stopwords = onlyval stopwords = pairfirst stopwords = pairgrep stopwords = pairkeys stopwords = pairmap stopwords = pairvalues stopwords = probability stopwords = randomisation stopwords = specialisations stopwords = thusly stopwords = uniq stopwords = unselected stopwords = util -remove = Test::CleanNamespaces