Output::Rewrite - Rewrite your script output.
Version 0.03
use Output::Rewrite ( rewrite_rule => { hoge => "fuga", } ); print "hoge hogehoge\n"; # fuga fugafuga use Output::Rewrite ( rewrite_rule => { '(?<=\b)hoge(?=\b)' => "fuga", } ); print "hoge hogehoge\n"; # fuga hogehoge use Output::Rewrite ( rewrite_rule => { '(\d)' => '$1!', } ); print "1234 I love Marine Corps!\n"; # 1!2!3!4! I love Marine Corps! use Output::Rewrite( modifiers => q/msgi/, rewrite_rule => { '(?-i)Sensitive' => 'SENSITIVE', 'NoN sEnsItivE' => 'NON SENSITIVE', }, ); #or use Output::Rewrite; Output::Rewrite::rewrite_rule( '(?-i)Sensitive' => 'SENSITIVE', 'NoN sEnsItivE' => 'NON SENSITIVE', ); Output::Rewrite::modifiers('msgi');
Output::Rewrite helps you to rewrite your script output.
When you print(or write, syswrite, printf) to STDOUT, Output::Rewrite hooks output and rewrite this.
Set rewrite rule(regex) and regex modifiers(i,g,m,s,x) when you load this module,
use Output::Rewrite ( modifiers => 'ig', rewrite_rule => { 'from' => 'to', } );
or with Output::Rewrite::rewrite_rule() and Output::Rewrite::modifiers().
use Output::Rewrite; Output::Rewrite::modifiers('ig'); Output::Rewrite::rewrite_rule( 'from' => 'to', );
This module ties STDOUT so you must use carefully.
Accessor for rewrite rule.
Output::Rewrite::rewrite_rule( 'from' => 'to', 'from' => 'to', );
Accessor for substitution modifiers.(i,g,m,s,x) Default is 'g'.
Output::Rewrite::modifiers('msgi'); my $modifiers = Output::Rewrite::modifiers;
If you want to apply modifiers only one time, you can use (?imsx-imsx) instead of this. For example:
use Output::Rewrite( modifiers => q/msgi/, rewrite_rule => { '(?-i)Sensitive' => 'SENSITIVE', 'NoN sEnsItivE' => 'NON SENSITIVE', }, );
Hogeist, <mahito at cpan.org>, http://www.ornithopter.jp/
<mahito at cpan.org>
Please report any bugs or feature requests to bug-output-rewrite at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Output-Rewrite. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-output-rewrite at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Output::Rewrite
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Output-Rewrite
CPAN Ratings
http://cpanratings.perl.org/d/Output-Rewrite
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Output-Rewrite
Search CPAN
http://search.cpan.org/dist/Output-Rewrite
Copyright 2006 Hogeist, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Output::Rewrite, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Output::Rewrite
CPAN shell
perl -MCPAN -e shell install Output::Rewrite
For more information on module installation, please visit the detailed CPAN module installation guide.