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 30.066.587 Times

File::FilterFuncs 0.53

  Date Added: June 10, 2010  |  Visits: 755

File::FilterFuncs

Report Broken Link
Printer Friendly Version


Product Homepage
Download (70 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
File Utilities  -  File Based Write Filter Management Tool for Windows Thin PC 1.0
This out-of-band feature will offer users a dedicated software for monitoring and configuring the "File Based Write Filter (FBWF)". By default the application will start on system start and will register a notification area icon. The settings,...
 
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  
NEW DOWNLOADS IN PROGRAMMING, LIBRARIES
Programming  -  FLEX-db Digital Asset Manager 3.0.9
FLEX-db - an enterprise Digital Asset Manager (DAM). It ingests and links metadata with files, creates thumbnails, and processes files using business rules. FLEX-db has a JSP client, Java app server for file input and output and an EJB metadata...
21.57 MB  
Programming  -  Libicom 0.9.0
The libicom library is a character based dynamicly linked library for Linux. It is used to remotely control the Icom IC-R8500 wide band receiver via an RS232 link. All call and return parameters to the control functions are character string based....
20.48 KB  
Programming  -  dotdesktop 0.3
Dotdesktop library provides ability to parse desktop entry file and access the information in a convenient way. Desktop entry file format is defined by freedesktop.org, it is used to describe information about an application such as the name and...
327.68 KB  
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  -  libyasl 0.2
Libyasl is a C++ class library to easily realize TCP/UDP/Multicast clientsand servers in IPv4 and IPv6 environments under GNU/Linux systems.
143.36 KB  
Libraries  -  wolfSSL 3.12.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...
2.73 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