飛鳥 真一郎 > Apache-StrReplace-0.03 > Apache::StrReplace

Download:
Apache-StrReplace-0.03.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.03   Source  

NAME ^

Apache::StrReplace - Filter between string replace

SYNOPSIS ^

Apache httpd.conf

    PerlModule Apache::StrReplace
    PerlSetVar StrReplaceSearch replace_before_string
    PerlSetVar StrReplaceReplace replace_after_string
    PerlSetVar StrReplaceOption replace_option
    PerlOutputFilterHandler Apache::StrReplace

DESCRIPTION ^

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;";
    }

EXAMPLE ^

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

SEE ALSO ^

Apache2, Apache2::Filter

AUTHOR ^

Shinichiro Aska, <askadna@cpan.org>

COPYRIGHT AND LICENSE ^

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.

syntax highlighting: