NAME
SDF::Sort::Random - Sort an PTools::SDF::SDF object in random order
VERSION
This document describes version 0.01, released March, 2005.
SYNOPSIS
use PTools::SDF::SDF; # or any subclass thereof, including:
use PTools::SDF::ARRAY;
use PTools::SDF::IDX;
use PTools::SDF::DIR;
use PTools::SDF::DSET;
$sdfObj = new PTools::SDF::SDF( $fileName );
$sdfObj->extend( "sort", "PTools::SDF::Sort::Random" );
$sdfObj->sort();
($stat,$err) = $sdfObj->status;
$stat and die $err;
DESCRIPTION
This sort class is one of several extended classes used to select which algorithm is employed to sort data in the calling object. It is up to the client script to select the specific algorithm, as shown in the Synopsis section, above.
This class is used to sort the data in random order.
Constructor
- new
-
Note that this is not intended to be a public method. It is only invoked by objects of the PTools::SDF::SDF class, or any subclasses thereof. Objects of this class are not intended for direct access, but only indirectly through the containing object.
Public Methods
The interface of this sort method is documented here. This is the intended usage for clients of the PTools::SDF::* class of objects.
The actual calling syntax for module designers is shown in the following section, below.
- sort
-
As shown in the Synopsis section, above, objects of this class are not accessed directly. Make a call to this method through the containing object where the unsorted data resides.
No arguments are needed, and the resulting ordering will be random.
At least two records must exist in the containing PTools::SDF::SDF object or an exception is generated.
Example:
use PTools::SDF::SDF; $sdfObj = new PTools::SDF::SDF( "/etc/passwd" ); $sdfObj->extend( "sort", "PTools::SDF::Sort::Random" ); $sdfObj->sort(); ($stat,$err) = $sdfObj->status; $stat and die $err;Of course, this just an example. It might seem strange to sort the system password file in a random order.
Private Methods
The actual calling syntax for module designers is documented here. This is the syntax used when invoking this method from withn the extended sort method of the PTools::SDF::SDF class only.
The user interface of this sort method is shown in the preceeding section.
- sort ( SdfRef )
-
The SdfRef is a reference to the actual PTools::SDF::SDF object, or subclass. This is passed as the first parameter to give this object access to the data to be sorted.
No other parameters are necessary when using this class.
INHERITANCE
None currently.
SEE ALSO
Other extended sort classes are available. See PTools::SDF::Sort::Bubble, PTools::SDF::Sort::Quick and PTools::SDF::Sort::Shell.
Also see PTools::SDF::Overview, PTools::SDF::ARRAY, PTools::SDF::CSV, PTools::SDF::DB, PTools::SDF::DIR, PTools::SDF::DSET, PTools::SDF::File, PTools::SDF::IDX, PTools::SDF::INI, PTools::SDF::SDF, PTools::SDF::TAG and PTools::SDF::Lock::Advisory.
AUTHOR
Chris Cobb, <nospamplease@ccobb.net>
COPYRIGHT
Copyright (c) 2005-2007 by Chris Cobb. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.