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.477.280 Times

File::FilterFuncs 0.53

  Date Added: June 10, 2010  |  Visits: 926

File::FilterFuncs

Report Broken Link
Printer Friendly Version


Product Homepage
Download (100 downloads)

File::FilterFuncs is a Perl module that specify filter functions for files. SYNOPSIS use File::FilterFuncs qw(filters); filters(source.txt, sub { $_ = uc $_; 1 }, dest.txt ); INTRODUCTION File::FilterFuncs makes it easy to perform transformations on files. When you use this module, you specify a group of filter functions that perform transformations on the lines in a source file. Those transformed lines are written to the destination file that you specify. For example, this code converts an entire file to upper-case, line-by-line: use File::FilterFuncs qw(filters); filters(source.txt, sub { $_ = uc $_; 1 }, dest.txt ); The "1" at the end of the filter subroutine tells filters to keep all the lines. The filter subroutine should return 1 for any lines that should be kept, and it should return 0 for any lines that should be ignored. This program copies only lines that contain something besides just whitespace: use File::FilterFuncs qw(filters); filters(source.txt, sub { /S/ }, dest.txt ); The entire source file is not read into memory. Instead it is read one line at a time, and the destination file is written one line at a time. Just as Perls concept of a line can be changed by setting $/, so the filters functions idea of a line can also be changed by specifying a value for $/ in the call to filters: my $pad = " " x 2; filters(source.dat, $/ => 1022, sub { $_ .= $pad; 1 }, dest.dat ); Filter functions are invoked in the order in which they are seen. This code upper-cases then puts inside parenthses every line in source.txt and copies the output to dest.txt: filters (source.txt, sub { $_ = uc $_; 1 }, sub { chomp $_; $_ = "($_)n"; 1 }, dest.txt ); Obviously, the current line that is being worked on is in $_. The filters subroutine expects its first argument to be the name of the source file, and the last argument should be the name of the destination file. The function filters will die if either one of the file names is missing or if they are inaccessible. OPTIONS A few options determine how the filters subroutine works. binmode Binmode lets you specify a layer to be used for the input data. For example, this will read a utf-8 file and write the data using the default output layer: filters ( source.txt, binmode => :utf8, dest.txt, ); boutmode Boutmode lets the programmer specify a layer to be used for writing the output data. For example, this code on a Linux platform should read text data using the Linux end-of-line format and write it using the DOS (CRLF) end-of-line format: filters ( source.txt, boutmode => :crlf, dest.txt, ); $/ Setting $/ lets you determine how an end-of-line is recognized. Set this option to the same value that you would set the $/ variable to in a program. For example, suppose a file contains this: ABCDEFGHIJKL The following program should write three letters at a time to the output file: filters ( source.txt, $/ => 3, sub { $_ = "$_n"; 1 }, dest.txt, ); NOTES Alternate function name If you consider the function name filters to be too generic, you can import the name filter_funcs instead. Convenience return values For the programmers convenience and to facilitate self-documenting code, the values $KEEP_LINE and $IGNORE_LINE can be exported. As an example, this is another program to filter out lines containing only whitespace: use File::FilterFuncs qw(filters $IGNORE_LINE); filters(source.txt, sub { return $IGNORE_LINE unless /S/ }, dest.txt );.

Requirements: No special requirements
Platforms: Linux
Keyword: File Filefilterfuncs Filter Filter Functions Filterfuncs Filters For Example Ignore Libraries Line Perl Module Specify Sub
Users rating: 0/10

License: Freeware Size: 12.29 KB
FILE::FILTERFUNCS RELATED
Libraries  -  Mac::Errors 1.13
Mac::Errors is a Perl module with constants for Mac error codes. SYNOPSIS use Mac::Errors qw(openErr); if( $value == openErr ) { ... } my $error = $MacErrors{ $symbol }; # -- OR -- my $error = $MacErrors{ $number }; my $symbol =...
54.27 KB  
Audio Encoders & Decoders  -  Free Audio Converter 2010 2.3.7
Free Audio Converter - Completely free audio converter for Windows Sound file converter for Windows. Convert audio files from many different file formats to mp3, wav or wma. For example convert wav to mp3, mp3 to wav, wma to mp3 or many other...
5.53 MB  
Audio Encoders & Decoders  -  Free Audio Converter 2011 2.5.7
Free Audio Converter - Completely free audio converter for Windows Sound file converter for Windows. Convert audio files from many different file formats to mp3, wav or wma. For example convert wav to mp3, mp3 to wav, wma to mp3 or many other...
5.53 MB  
Windows Software  -  Free Audio Converter 2012 2.8.6
Free Audio Converter - Completely free audio converter for Windows Sound file converter for Windows. Convert audio files from many different file formats to mp3, wav or wma. For example convert wav to mp3, mp3 to wav, wma to mp3 or many other...
5.53 MB  
Audio Encoders & Decoders  -  Free Audio Converter 2013 2.9.9
Free Audio Converter - Completely free audio converter for Windows Sound file converter for Windows. Convert audio files from many different file formats to mp3, wav or wma. For example convert wav to mp3, mp3 to wav, wma to mp3 or many other...
5.53 MB  
Audio Tools  -  Free Audio Converter 2014 3.3.8
Free Audio Converter - Completely free audio converter for Windows Sound file converter for Windows. Convert audio files from many different file formats to mp3, wav or wma. For example convert wav to mp3, mp3 to wav, wma to mp3 or many other...
5.53 MB  
Libraries  -  Pod::POM::View::HTML::Filter 0.09
Pod::POM::View::HTML::Filter Perl module can use filters on sections of your pod documents. SYNOPSIS In your POD: Some coloured Perl code: =begin filter perl # now in full colour! $A++; =end filter =for filter=perl $A++; # this works...
24.58 KB  
Libraries  -  Filter::Macro 0.11
Filter::Macro is a Perl module to make macro modules that are expanded inline. SYNOPSIS In MyHandyModules.pm: package MyHandyModules; use Filter::Macro; # lines below will be expanded into callers code use strict; use warnings; use...
13.31 KB  
Libraries  -  SVK::Log::Filter::Babelfish 0.0.3
SVK::Log::Filter::Babelfish is a Perl module to translate logs to various natural languages. SYNOPSIS > svk log --filter babelfish de //mirror/project/trunk ---------------------------------------------------------------------- r1234 (orig...
5.12 KB  
Libraries  -  Filter::decrypt 1.33
Filter::decrypt Perl module contains a template for a decrypt source filter. SYNOPSIS use Filter::decrypt ; This is a sample decrypting source filter. Although this is a fully functional source filter and it does implement a very simple...
40.96 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