BSD Ports

textproc/p5-Sort-Naturally 1.03_1 MidnightBSD

Sort lexically, but sort numeral parts numerically

System
MidnightBSD
Repository
mports
Maintainer
[email protected]
License
artistic, gpl+
Categories
textproc, perl5

Description

This module exports two functions, nsort and ncmp; they are used in implementing my idea of a "natural sorting" algorithm. Under natural sorting, numeric substrings are compared numerically, and other word-characters are compared lexically.

This is the way I define natural sorting:

\* Non-numeric word-character substrings are sorted lexically,

case-insensitively: "Foo" comes between "fish" and "fowl". * Numeric substrings are sorted numerically: "100" comes after "20", not before. * \W substrings (neither words-characters nor digits) are ignored. Our use * of \w, \d, \D, and \W is locale-sensitive: Sort::Naturally uses a use locale statement. * When comparing two strings, where a numeric substring in one place is not up against a numeric substring in another, the non-numeric always comes first. This is fudged by reading pretending that the lack of a number substring has the value -1, like so: * The start of a string is exceptional: leading non-\W (non-word, non-digit) components are ignored, and numbers come before letters. * I define "numeric substring" just as sequences matching m/\d+/ -- scientific notation, commas, decimals, etc., are not seen. If your data has thousands separators in numbers ("20,000 Leagues Under The Sea" or "20.000 lieues sous les mers"), consider stripping them before feeding them to nsort or ncmp.

In the other systems

SystemPortVersion
MidnightBSDtextproc/p5-Sort-Naturally1.03_1
FreeBSDtextproc/p5-Sort-Naturally1.03_1
OpenBSDdevel/p5-Sort-Naturally1.03p0
NetBSDdevel/p5-Sort-Naturally1.03nb14
DragonFlytextproc/p5-Sort-Naturally1.03_1
HardenedBSDtextproc/p5-Sort-Naturally1.03_1
GhostBSDtextproc/p5-Sort-Naturally1.03_1

Install

Binary package:

mport install p5-Sort-Naturally

From mports:

cd /usr/mports/textproc/p5-Sort-Naturally && make install clean

To depend on this port in another port's Makefile:

RUN_DEPENDS=	p5-Sort-Naturally>0:textproc/p5-Sort-Naturally

Dependencies

No port depends on this one.

Configuration

No options to configure.

USES
perl5
Service scripts
none

Files

pkg-plist 2
  • %%PERL5_MAN3%%/Sort::Naturally.3.gz
  • %%SITE_PERL%%/Sort/Naturally.pm
distinfo 1
FileSizeSHA256
Sort-Naturally-1.03.tar.gz11150eaab1c5c87575a7826089304ab1f8ffa7f18e6cd8b3937623e998e865ec1e746
Master sites 1
  • CPAN