NAME

Dezi::ReplaceRules - filename mangler

SYNOPSIS

use Dezi::ReplaceRules;
my $rules = Dezi::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

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

This class is typically used internally by Dezi. The filter() feature of Dezi is generated to use ReplaceRules if they are defined in a Dezi::Indexer::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.

BUILDARGS

Internal method. Allows for single argument to new().

BUILD

Parses the rules and initializes the object.

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=Dezi-App. 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 Dezi::ReplaceRules

You can also look for information at:

COPYRIGHT AND LICENSE

Copyright 2018 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