1String::RewritePrefix(3U)ser Contributed Perl DocumentatiSotnring::RewritePrefix(3)
2
3
4

NAME

6       String::RewritePrefix - rewrite strings based on a set of known
7       prefixes
8

VERSION

10       version 0.008
11

SYNOPSIS

13         use String::RewritePrefix;
14         my @to_load = String::RewritePrefix->rewrite(
15           { '' => 'MyApp::', '+' => '' },
16           qw(Plugin Mixin Addon +Corporate::Thinger),
17         );
18
19         # now you have:
20         qw(MyApp::Plugin MyApp::Mixin MyApp::Addon Corporate::Thinger)
21
22       You can also import a rewrite routine:
23
24         use String::RewritePrefix rewrite => {
25           -as => 'rewrite_dt_prefix',
26           prefixes => { '' => 'MyApp::', '+' => '' },
27         };
28
29         my @to_load = rewrite_dt_prefix( qw(Plugin Mixin Addon +Corporate::Thinger));
30
31         # now you have:
32         qw(MyApp::Plugin MyApp::Mixin MyApp::Addon Corporate::Thinger)
33

METHODS

35   rewrite
36         String::RewritePrefix->rewrite(\%prefix, @strings);
37
38       This rewrites all the given strings using the rules in %prefix.  Its
39       keys are known prefixes for which its values will be substituted.  This
40       is performed in longest-first order, and only one prefix will be
41       rewritten.
42
43       If the prefix value is a coderef, it will be executed with the
44       remaining string as its only argument.  The return value will be used
45       as the prefix.
46

AUTHOR

48       Ricardo Signes <rjbs@cpan.org>
49

CONTRIBUTORS

51       •   Florian Ragwitz <rafl@debian.org>
52
53       •   Olivier Mengué <dolmen@cpan.org>
54
56       This software is copyright (c) 2020 by Ricardo Signes.
57
58       This is free software; you can redistribute it and/or modify it under
59       the same terms as the Perl 5 programming language system itself.
60
61
62
63perl v5.34.0                      2021-07-22          String::RewritePrefix(3)
Impressum