NAME

SWISH::Prog::ReplaceRules - filename mangler

SYNOPSIS

use SWISH::Prog::ReplaceRules;
my $rules = SWISH::Prog::ReplaceRules->new(
  qq(replace "the string you want replaced" "what to change it to"),
  qq(remove  "a string to remove"),
  qq(prepend "a string to add before the result"),
  qq(append  "a string to add after the result"),
  qq(regex   "/search string/replace string/options"),
);
my $uri = 'foo/bar/baz';
my $modified_uri = $rules->apply($uri);

DESCRIPTION

SWISH::Prog::ReplaceRules is a pure Perl replacement for the ReplaceRules configuration feature in Swish-e.

This class is typically used internally by SWISH::Prog. The filter() feature of SWISH::Prog is generated to use ReplaceRules if they are defined in a SWISH::Prog::Config object or config file.

METHODS

new( rules )

Constructor for new ReplaceRules object. rules should be an array of strings as defined in http://swish-e.org/docs/swish-config.html#replacerules.

init

Internal method called by new(). Expects an array of rule strings.

rules

Get/set the array ref of parsed rules.

apply( string )

Apply the rules in the object against string. Returns a modified copy of string.

AUTHOR

Peter Karman, <perl@peknet.com>

BUGS

Please report any bugs or feature requests to bug-swish-prog at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=SWISH-Prog. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc SWISH::Prog

You can also look for information at:

COPYRIGHT AND LICENSE

Copyright 2011 by Peter Karman

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

http://swish-e.org/, http://swish-e.org/docs/swish-config.html#replacerules