<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">NAME
    Sorter - Sorter

SPECIFICATION VERSION
    0.1

VERSION
    This document describes version 0.1.0 of Sorter (from Perl distribution
    Sorter), released on 2024-01-22.

SYNOPSIS
    Basic:

     use Sorter::naturally;
     my $sorter = Sorter::naturally-&gt;new;

     my @sorted = $sorter-&gt;('track1.mp3', 'track10.mp3', 'track2.mp3', 'track1b.mp3', 'track1a.mp3');
     # =&gt; ('track1.mp3', 'track1a.mp3', 'track1b.mp3', 'track2.mp3', 'track10.mp3')

    Specifying arguments:

     use Sorter::naturally;
     my $sorter = Sorter::naturally-&gt;new(reverse =&gt; 1);
     my @sorted = $sorter-&gt;(...);

    Specifying sorter on the command-line (for other CLI's):

     % customsort -s naturally ...
     % customsort -s naturally=reverse,1 ...

DESCRIPTION
    EXPERIMENTAL. SPEC MIGHT STILL CHANGE.

Glossary
    A sorter is a subroutine that accepts a list of items to sort.

    A sorter module is a module under the "Sorter::*" namespace that you can
    use to generate a sorter.

  Writing a Sorter module
     package Sorter::naturally;

     # required. must return a hash (DefHash)
     sub meta {
         return +{
             v =&gt; 1,
             args =&gt; {
                 reverse =&gt; {
                     schema =&gt; 'bool*', # Sah schema
                 },
             },
         };
     }

     sub gen_sorter {
         my %args = @_;
         ...
     }

     1;

  Namespace organization
HOMEPAGE
    Please visit the project's homepage at
    &lt;https://metacpan.org/release/Sorter&gt;.

SOURCE
    Source repository is at &lt;https://github.com/perlancar/perl-Sorter&gt;.

SEE ALSO
    Base specifications: DefHash, Sah.

    Related: Comparer

    Previous incarnation: Sort::Sub. "Sorter" and "Comparer" are meant to
    eventually supersede Sort::Sub. The main improvement upon Sort::Sub is
    the split into three kinds of subroutines: 1) a sorter (a subroutine
    that accepts a list of items to sort), where "Sorter::*" modules are
    meant to generate; 2) a keymaker (a subroutine that converts an item to
    a string/numeric key suitable for simple comparison using "eq" or "=="
    during sorting); you can use "Data::Sah::Value::perl::KeyMaker"
    namespace for this; and 3) comparer (a subroutine that compares two
    items that can be used in sort()), where "Comparer::*" modules are meant
    to generate. Perl's sort() allows us to specify a comparer, but
    oftentimes it's more efficient to sort by key using a keymaker, and
    sometimes due to preprocessing and/or postprocessing it's more suitable
    to use the more generic "sorter" interface.

AUTHOR
    perlancar &lt;perlancar@cpan.org&gt;

CONTRIBUTING
    To contribute, you can send patches by email/via RT, or send pull
    requests on GitHub.

    Most of the time, you don't need to build the distribution yourself. You
    can simply modify the code, then test via:

     % prove -l

    If you want to build the distribution (e.g. to try to install it locally
    on your system), you can install Dist::Zilla,
    Dist::Zilla::PluginBundle::Author::PERLANCAR,
    Pod::Weaver::PluginBundle::Author::PERLANCAR, and sometimes one or two
    other Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps
    required beyond that are considered a bug and can be reported to me.

COPYRIGHT AND LICENSE
    This software is copyright (c) 2024 by perlancar &lt;perlancar@cpan.org&gt;.

    This is free software; you can redistribute it and/or modify it under
    the same terms as the Perl 5 programming language system itself.

BUGS
    Please report any bugs or feature requests on the bugtracker website
    &lt;https://rt.cpan.org/Public/Dist/Display.html?Name=Sorter&gt;

    When submitting a bug or request, please include a test-file or a patch
    to an existing test-file that illustrates the bug or desired feature.

</pre></body></html>