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.009
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

PERL VERSION

35       This module should work on any version of perl still receiving updates
36       from the Perl 5 Porters.  This means it should work on any version of
37       perl released in the last two to three years.  (That is, if the most
38       recently released version is v5.40, then this module should work on
39       both v5.40 and v5.38.)
40
41       Although it may work on older versions of perl, no guarantee is made
42       that the minimum required version will not be increased.  The version
43       may be increased for any reason, and there is no promise that patches
44       will be accepted to lower the minimum required perl.
45

METHODS

47   rewrite
48         String::RewritePrefix->rewrite(\%prefix, @strings);
49
50       This rewrites all the given strings using the rules in %prefix.  Its
51       keys are known prefixes for which its values will be substituted.  This
52       is performed in longest-first order, and only one prefix will be
53       rewritten.
54
55       If the prefix value is a coderef, it will be executed with the
56       remaining string as its only argument.  The return value will be used
57       as the prefix.
58

AUTHOR

60       Ricardo Signes <cpan@semiotic.systems>
61

CONTRIBUTORS

63       •   Florian Ragwitz <rafl@debian.org>
64
65       •   Olivier Mengué <dolmen@cpan.org>
66
67       •   Ricardo Signes <rjbs@semiotic.systems>
68
70       This software is copyright (c) 2022 by Ricardo Signes.
71
72       This is free software; you can redistribute it and/or modify it under
73       the same terms as the Perl 5 programming language system itself.
74
75
76
77perl v5.36.0                      2023-01-20          String::RewritePrefix(3)
Impressum