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

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

Serving Software Downloads in 976 Categories, Downloaded 32.405.637 Times

List::RewriteElements 0.09

  Date Added: February 24, 2010  |  Visits: 624

List::RewriteElements

Report Broken Link
Printer Friendly Version


Product Homepage
Download (70 downloads)



List::RewriteElements is a Perl module that can create a new list by rewriting elements of a first list. SYNOPSIS use List::RewriteElements; Constructor Simplest case: Input from array, output to STDOUT. $lre = List::RewriteElements->new( { list => @source, body_rule => sub { my $record = shift; $record .= q{additional field}; }, } ); Input from file, output to STDOUT: $lre = List::RewriteElements->new( { file => "/path/to/source/file", body_rule => sub { my $record = shift; $record .= q{,additional field}; }, } ); Provide a different rule for the first element in the list: $lre = List::RewriteElements->new( { file => "/path/to/source/file", header_rule => sub { my $record = shift; $record .= q{,ADDITIONAL HEADER}; }, body_rule => sub { my $record = shift; $record .= q{,additional field}; }, } ); Input from file, output to file: $lre = List::RewriteElements->new( { file => "/path/to/source/file", body_rule => sub { my $record = shift; $record .= q{additional field}; }, output_file => "/path/to/output/file", } ); To name output file, just provide a suffix to filename: $lre = List::RewriteElements->new( { file => "/path/to/source/file", body_rule => sub { my $record = shift; $record .= q{additional field}; }, output_suffix => .out, } ); Provide criteria to suppress output of header or individual record. $lre = List::RewriteElements->new( { file => "/path/to/source/file", header_suppress => sub { my $record = shift; return if $record =~ /$somepattern/; }, body_suppress => sub { my $record = shift; return if $record ne somestring; }, body_rule => sub { my $record = shift; $record .= q{additional field}; }, } ); Generate Output $lre->generate_output(); Report Output Information $path_to_output_file = $lre->get_output_path(); $output_file_basename = $lre->get_output_basename(); $output_row_count = $lre->get_total_rows(); $output_record_count = $lre->get_total_records(); $records_changed = $lre->get_records_changed(); $records_unchanged = $lre->get_records_unchanged(); $records_deleted = $lre->get_records_deleted(); $header_status = $lre->get_header_status(); It is common in many situations for you to receive a flat data file from someone else and have to generate a new file in which each row or record in the incoming file must either (a) be transformed according to some rule before being printing to the new file; or (b) if it meets certain criteria, not output to the new file at all. List::RewriteElements enables you to write such rules and criteria, generate the file of transformed data records, and get back some basic statistics about the transformation. List::RewriteElements is useful when the number of records in the incoming file may be large and you do not want to hold the entire list in memory. Similarly, the newly generated records are not held in memory but are immediately printed to STDOUT or to file. On the other hand, if for some reason you already have an array of records in memory, you can use List::RewriteElements to apply rules and criteria to each element of the array and then print the transformed records (again, without holding the output in memory)..

Requirements: No special requirements
Platforms: Linux
Keyword: Create A File In Memory Libraries Listrewriteelements New Output Perl Module Programming Record Records Rewriteelements Stdout Sub
Users rating: 0/10

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


LIST::REWRITEELEMENTS RELATED
Desktop Utilities  -  Recursively create M3U playlists 1.1
Recursively create M3U playlists is a service menu which can create a file called playlist.m3u in each directories and sub directories. You can edit recursively_create_M3U_playlist.py to change the name of playlist.m3u To install, simply put...
1.02 KB  
Version Control Tools  -  cvsgdiff 0.04
cvsgdiff uses tkdiff or mgdiff to graphically display diffs between CVS revisions of a file in your sandbox. cvsgdiff is basically a graphical version of "cvs diff". If given no arguments, cvsgdiff will launch the graphical diff program once for...
4.1 KB  
Libraries  -  text-vimcolor 0.11
text-vimcolor is a command-line program to syntax color a file in HTML, XML or PDF. SYNOPSIS $ text-vimcolor --format html --full-page FILENAME > OUTPUT.html $ text-vimcolor --format xml FILENAME > OUTPUT.xml $ text-vimcolor --format pdf...
20.48 KB  
Development Tools  -  What's New for Object-Oriented Programming in MATLAB Webinar - Code Examples 1.0
These are the code examples used in the "What's New for Object-Oriented Programming in MATLABdlT«" webinar, which described the new object oriented features in Release 2008a.To use the code, add the top folder to your path. See the test* M-files...
112.64 KB  
Libraries  -  File::Signature 1.009
File::Signature is a Perl module to detect changes to a files content or attributes. SYNOPSIS use File::Signature; my $sig = File::Signature->new(/some/file); # If you have a stringified signature stored in $string # you can create a...
8.19 KB  
Wallpaper Tools  -  Blended 1.6
Blended provides a simple theme designed to blend in with the menu bar to create a smooth appearance. The theme was designed with the Clearlooks GTK2 theme in mind, but works well with other themes that have plain menu bars. Inculdes 4 theme...
 
Libraries  -  HTML::Latex 1.1
HTML::Latex is a Perl module that creates a Latex file from an HTML file. SYNOPSIS use HTML::Latex my $parser = new HTML::Latex($conffile); $parser->set_option(%options); $parser->add_package(@packages); $parser->ban_tag(@banned);...
48.13 KB  
Libraries  -  File::Save::Home 0.08
File::Save::Home is a Perl module to place file safely under user home directory. SYNOPSIS use File::Save::Home qw( get_home_directory get_subhome_directory_status make_subhome_directory restore_subhome_directory_status...
18.43 KB  
Libraries  -  IPC::SharedCache 1.3
IPC::SharedCache is a Perl module to manage a cache in SysV IPC shared memory. SYNOPSIS use IPC::SharedCache; # the cache is accessed using a tied hash. tie %cache, IPC::SharedCache, ipc_key => AKEY, load_callback => &load,...
19.46 KB  
Graphs and Charts  -  IronPython fade-in window 1.0
This script describes how to create a fade-in window using IronPython. Several applications use fade-in windows for temporary data e.g. new Outlook XP mail messages are shown through a fade-in/fade-out pop-up window. Fading in can be best...
 
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 3.15.3
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