Apache::StrReplace - Filter between string replace
Apache httpd.conf
PerlModule Apache::StrReplace PerlSetVar StrReplaceSearch replace_before_string PerlSetVar StrReplaceReplace replace_after_string PerlSetVar StrReplaceOption replace_option PerlOutputFilterHandler Apache::StrReplace
StrReplaceSearch ... search strings.
StrReplaceReplace ... replace strings.
StrReplaceOption ... regexp options. ( default "g" )
StrReplaceContentType ... target Content-Type ( default "text/html" )
run code image.
if ($f->r->content_type~/$contentType/) { eval '$f->ctx->{body}=~s/$search/'."$replace/$option;"; }
simple replace.
PerlModule Apache::StrReplace PerlSetVar StrReplaceSearch hoge PerlSetVar StrReplaceReplace foo PerlOutputFilterHandler Apache::StrReplace
The numbered match variables.
PerlModule Apache::StrReplace PerlSetVar StrReplaceSearch "([a-z]*).example.com" PerlSetVar StrReplaceReplace "dev.$1.example.com" PerlOutputFilterHandler Apache::StrReplace
Perl code.
PerlModule Apache::StrReplace PerlSetVar StrReplaceSearch "<taxes>(\d+)</taxes>" PerlSetVar StrReplaceReplace "int( $1 * 1.05 )" PerlSetVar StrReplaceOption "eg" PerlOutputFilterHandler Apache::StrReplace
text/plain support.
PerlModule Apache::StrReplace PerlSetVar StrReplaceSearch "<taxes>(\d+)</taxes>" PerlSetVar StrReplaceReplace "int( $1 * 1.05 )" PerlSetVar StrReplaceOption "eg" PerlSetVar StrReplaceContentType "text/(html|plain)" PerlOutputFilterHandler Apache::StrReplace
Apache2, Apache2::Filter
Shinichiro Aska, <askadna@cpan.org>
Copyright (C) 2007 by Shinichiro Aska
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.5 or, at your option, any later version of Perl 5 you may have available.
To install Apache::StrReplace, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Apache::StrReplace
CPAN shell
perl -MCPAN -e shell install Apache::StrReplace
For more information on module installation, please visit the detailed CPAN module installation guide.