NAME
Meta::Utils::List - general library for list functions.
COPYRIGHT
Copyright (C) 2001 Mark Veltzer; All rights reserved.
LICENSE
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
DETAILS
MANIFEST: List.pm PROJECT: meta
SYNOPSIS
package foo;
use Meta::Utils::List qw();
my(@list)=["sunday","monday",...];
Meta::Utils::List::print(*FILE,\@list);
DESCRIPTION
This is a general utility perl library for list manipulation in perl. This library works mostly with list references rather than the list themselves to avoid extra work when copying them.
EXPORTS
size($)
empty($)
notempty($)
cmp($$$$$)
print($$)
add_postfix($$)
to_hash($)
chop($)
add_prefix($$)
add_suffix($$)
add_hash_style($$)
has_elem($$)
add_star($$)
add_endx($$)
filter_prefix($$)
filter_suffix($$)
filter_file_regexp($$)
filter_which($$$)
filter_exists($)
filter_notexists($)
read($)
read_exe($)
equa($$)
is_prefix($$)
FUNCTION DOCUMENTATION
- size($)
-
This routine returns the list size at hand (using the #$ shit...) The input is a list reference.
- empty($)
-
This routine receives a list reference. This routine returns a boolean value according to whether the list is empty or not
- notempty($)
-
This routine receives a list reference. This routine returns a boolean value according to whether the list is not empty or not
- cmp($$$$$)
-
This routine compares two lists by printing any value which is in one of them but not in the other. This uses the Meta::Utils::Hash::cmp routine to chieve this. The routine also receives a verbose boolean to direct it whether to write the differences or not.
- print($$)
-
This prints out a list. Currently just receives a list reference as input but could be enriched
- add_postfix()
-
This postfixes every element in a list.
- to_hash($)
-
This converts a list to a hash receiving a list reference and constructing a hash which has a key value of undef on every list entry and no other values.
- chop($)
-
This chops up a list, meaning activates the chop function on every element. This receives a list reference to do the work on.
- add_prefix($$)
-
This adds a prefix to every element of a list. The input is a list reference and the prefix to be added.
- add_suffix($$)
-
This adds a suffix to every element of a list. The input is a list reference and the suffix to be added.
- add_hash_style($$)
-
This adds an element to the list assuming that the list is a hash in disguise. i.e. it does not add the element if the element is already in the list.
- has_elem($$)
-
This routine returns a boolean value based on whether the list it got has a certain element.
- add_star($$)
-
This adds an element to the beginging of a list.
- add_endx($$)
-
This adds an element to the end of a list.
- filter_prefix($$)
-
This gets a list reference as input and produces a list of all the entires which have a certain prefix in them. Should we also have the same routine that actually does the manipulation on the list itself ? it would be faster...
- filter_suffix($$)
-
This gets a list reference as input and produces a list of all the entires which have a certain suffix in them. Should we also have the same routine that actually does the manipulation on the list itself ? it would be faster...
- filter_exists($)
-
This gets a list reference of file names and generates a list of all the entries in the original list which were actuall files that exist Should we also have the same routine that actually does the manipulation on the list itself ? it would be faster...
- filter_notexists($)
-
This does the exact opposite of the previous routine. Should we also have the same routine that actually does the manipulation on the list itself ? it would be faster...
- filter_which($$$)
- filter_file_regexp($$)
-
This routine gets a list reference and a regular expression. The routine will return a list reference to a list contraining all the items in the original list that when taken as file names contain a match for the regular expression. The routine utilises the check_sing_regexp routine to actuall check the regular expression match.
- read($)
-
This reads a list from a file by storing each line in a list entry.
- equa($$)
-
This method will get two lists by reference and will return true off the two lists are the same.
- is_prefix($$)
-
This method will get two lists by references and will return true iff the first is a prefix of the second.
BUGS
None.
AUTHOR
Mark Veltzer <mark2776@yahoo.com>
HISTORY
start of revision info 1 Mon Jan 1 16:38:12 2001 MV initial code brought in 2 Thu Jan 4 06:30:32 2001 MV this time really make the databases work 3 Sat Jan 6 11:39:39 2001 MV make quality checks on perl code 4 Sat Jan 6 17:14:09 2001 MV more perl checks 5 Sun Jan 7 18:17:29 2001 MV make Meta::Utils::Opts object oriented 6 Tue Jan 9 17:00:22 2001 MV fix up perl checks 7 Tue Jan 9 18:15:19 2001 MV check that all uses have qw 8 Tue Jan 9 19:29:31 2001 MV fix todo items look in pod documentation 9 Wed Jan 10 12:05:55 2001 MV more on tests/more checks to perl 10 Wed Jan 10 18:31:05 2001 MV more perl code quality 11 Thu Jan 11 19:25:00 2001 MV more quality testing 12 Thu Jan 11 22:31:19 2001 MV more perl code quality 13 Fri Jan 12 09:25:33 2001 MV more perl quality 14 Thu Jan 18 15:59:13 2001 MV correct die usage 15 Sat Jan 27 19:56:28 2001 MV perl quality change 16 Sun Jan 28 02:34:56 2001 MV perl code quality 17 Sun Jan 28 13:51:26 2001 MV more perl quality 18 Tue Jan 30 03:03:17 2001 MV more perl quality 19 Sat Feb 3 23:41:08 2001 MV perl documentation 20 Mon Feb 5 03:21:02 2001 MV more perl quality 21 Tue Feb 6 01:04:52 2001 MV perl qulity code 22 Tue Feb 6 07:02:13 2001 MV more perl code quality 23 Tue Feb 6 08:47:46 2001 MV more perl quality 24 Tue Feb 6 22:19:51 2001 MV revision change end of revision info
SEE ALSO
Nothing.
TODO
-do prefix and postfix routines. the add_prefix and add_postfix routines are not good enough since they work on the list at hand. This is the most efficient way, but sometimes I dont want no one to change the current list...