Download Shareware and Freeware Software for Windows, Linux, Macintosh, PDA

line Home  |  About Us  |  Link To Us  |  FAQ  |  Contact

Serving Software Downloads in 956 Categories, Downloaded 50.241.338 Times

Sort::Half::Maker 0.03

  Date Added: January 18, 2010  |  Visits: 1.298

Sort::Half::Maker

Report Broken Link
Printer Friendly Version


Product Homepage
Download (118 downloads)



Sort::Half::Maker is a Perl module to create half-sort subs easily. SYNOPSIS use Sort::Half::Maker qw(make_halfsort); $sub = make_halfsort( start => [ qw(x y z) ], end => [ qw(a b c) ], fallback => sub { $_[0] cmp $_[1] }, ); @list = sort $sub qw(a y f h w z b t x); # qw(x y z f h t w a b) Before anything, what it a half-sort? A half-sort is a sort subroutine defined by a starting list, an ending list and an ordinary sort subroutine. Elements in the starting list always go first in comparison to others and keep the original order. Elements in the ending list always go last in comparison to others and keep their original order. The remaining elements are sorted via the given ordinary sort subroutine. An example, please? Imagine we want to sort the list of key/value pairs of a hash, such that qw(name version abstract license author) come first and qw(meta-spec) comes last, using case-insensitive comparison in-between. With this module, this is done so: $sub = make_halfsort( start => [ qw(name version abstract license author) ], end => [ qw(meta-spec) ], fallback => sub { lc $_[0] cmp lc $_[1] } ); my @pairs = map { ($_, $h{$_}) } sort $sub keys(%h); Why is it good for? I dont see many uses for it. I played with the concept while writing a patch to improve META.yml generation by ExtUtils::MakeMaker. There we wanted to dump some keys (like name, version, abstract, license, author) before and then the ones the module author provided as extra information. FUNCTIONS make_halfsort $sub = make_halfsort(start => @start_list, end => @end_list, fallback => &sort_sub ); @sorted = sort $sub @unsorted; Builds a sort subroutine which can be used with sort. It splits the sorted list into (possibly) three partitions: the elements contained in @start_list, the elements contained in @end_list and the remaining ones. For the elements in @start_list and @end_list, the list order is preserved. For the remaining ones, the given sort sub (or the default) is used. If fallback is ommited, it defaults to use the sort sub sub ($$) { $_[0] cmp $_[1] }. The arguments start or end may be ommited as well. But if you omit both, you could have done it without a half-sort..

Requirements: No special requirements
Platforms: Linux
Keyword: Libraries List Module Perl Module Programming Qw Sort Sorthalfmaker Start Sub To Create
Users rating: 0/10

License: Freeware Size: 4.1 KB
USER REVIEWS
More Reviews or Write Review


SORT::HALF::MAKER RELATED
Libraries  -  OpenInteract2::Manual::Tutorial 1.99_06
OpenInteract2::Manual::Tutorial is a Perl module that will teach learn you how to create and modify a package. SYNOPSIS This tutorial will show you the different methods for creating a package and how to maintain them. CREATING THE PACKAGE...
931.84 KB  
Modules  -  Nodequeue Node 6.x-1.0-beta1
This module extends Nodequeue by providing the ability to create a new Node that is linked with a single Subqueue - a "Meta node" for subqueues. (See also: #471732: Use cases)Requires Nodequeue 6.x-2.1 or higher!Warning: This module will break on...
10 KB  
Backup Utilities  -  HomeBak 1.2 RC2
HomeBak is a Perl program that uses ARJ32 or 7-Zip to create archives of directories you specify in one or more configuration files and backup these archives. You can use more configuration files if you want to or, at least, one. It...
358.4 KB  
Libraries  -  Module::Starter::XSimple 0.0.1
Module::Starter::XSimple is a Perl module to create XS modules with Module::Starter. Replacement class for Module::Starter::Simple. Can be used in two ways: Using the commandline Pass as an override class to the module-starter script:...
6.14 KB  
Libraries  -  Drupal::Module::Starter 0.06
Drupal::Module::Starter is a Perl module to create Drupal Module starter files. SYNOPSIS You probably dont want to use this module directly - you want to use the drupal-module-starter script in the scripts directory of the distribution use...
14.34 KB  
Libraries  -  Module::Starter::PBP 0.0.3
Module::Starter::PBP is a Perl module to create a module as recommended in "Perl Best Practices". SYNOPSIS # In your ~/.module-starter/config file... author: email: plugins: Module::Starter::PBP...
8.19 KB  
Libraries  -  XML::Writer::Simple 0.01
XML::Writer::Simple is a Perl module to create XML files easily! SYNOPSIS use XML::Writer::Simple dtd => "file.dtd"; print para("foo",b("bar"),"zbr"); USAGE This module takes some ideas from CGI to make easier the life for those who need...
4.1 KB  
Libraries  -  Compress::BraceExpansion 0.1.3
Compress::BraceExpansion is a Perl module to create a human-readable compressed string suitable for shell brace expansion. SYNOPSIS use Compress::BraceExpansion; # output: ab{c,d} print Compress::BraceExpansion->new( qw( abc abd )...
11.26 KB  
Libraries  -  Contextual::Return 0.1.0
Contextual::Return is a Perl module to create context-senstive return values. SYNOPSIS use Contextual::Return; use Carp; sub foo { return SCALAR { thirty-twelve } BOOL { 1 } NUM { 7*6 } STR { forty-two } LIST { 1,2,3 } HASHREF {...
22.53 KB  
Libraries  -  MLDBM::TinyDB 0.20
MLDBM::TinyDB is a Perl module that can help you to create and manipulate structured MLDBM tied hash references. SYNOPSIS use MLDBM::TinyDB; ## or use MLDBM::TinyDB qw/db add_common/; @common = qw/created updated/; ## optional $tree =...
10.24 KB  
NEW DOWNLOADS IN PROGRAMMING, LIBRARIES
Programming  -  Cedalion for Linux 0.2.6
Cedalion is a programming language that allows its users to add new abstractions and define (and use) internal DSLs. Its innovation is in the fact that it uses projectional editing to allow the new abstractions to have no syntactic limitations.
471.04 KB  
Programming  -  Math::GMPf 0.29
Math::GMPf - perl interface to the GMP library's floating point (mpf) functions.
30.72 KB  
Programming  -  Net::Wire10 1.08
Net::Wire10 is a Pure Perl connector that talks to Sphinx, MySQL and Drizzle servers. Net::Wire10 implements the low-level network protocol, alias the MySQL wire protocol version 10, necessary for talking to one of the aforementioned...
30.72 KB  
Programming  -  logilab-common 0.56.2
a bunch of modules providing low level functionnalities shared among some python projects devel Please note that some of the modules have some extra dependencies. For instance, logilab.common.db will require a db-api 2.0 compliant...
174.08 KB  
Programming  -  OpenSSL for linux 1.0.0a
The OpenSSL Project is a collaborative effort to develop a robust, commercial-grade, full-featured, and Open Source toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) protocols as well as a...
3.83 MB  
Libraries  -  wolfSSL 4.0.0
The wolfSSL embedded SSL/TLS library is a lightweight SSL library written in ANSI standard C and targeted for embedded and RTOS environments - primarily because of its small size, speed, and feature set. It is commonly used in standard operating...
3.88 MB  
Libraries  -  EuGTK 4.8.9
Makes it easy to develop good- looking, fast, cross-platform programs that run on Linux, OS X, and Windows. Euphoria is a very fast interpreted/compiled language with straight-forward syntax. EuGTK allows programming in a clean, object-oriented...
10.68 MB  
Libraries  -  Linux User Group Library Manager 1.0
The LUG Library Manager is a project to help Linux User Groups start their own library. A LUG library is helpful to the community at large because it increases access to information, and gives everyone the opportunity to become more knowledgeable.
5.35 KB  
Libraries  -  Module::MakefilePL::Parse 0.12
Module::MakefilePL::Parse is a Perl module to parse required modules from Makefile.PL. SYNOPSIS use Module::MakefilePL::Parse; open $fh, Makefile.PL; $parser = Module::MakefilePL::Parse->new( join("", ) ); $info = $parser->required;...
8.19 KB  
Libraries  -  sqlpp 0.06
sqlpp Perl package is a SQL preprocessor. sqlpp is a conventional cpp-alike preprocessor taught to understand SQL ( PgSQL, in particular) syntax specificities. In addition to the standard #define/#ifdef/#else/#endif cohort, provides also...
10.24 KB