1Dist::Zilla::Role::HashUDsuemrpeCro(n3t)ributed Perl DocDuimsetn:t:aZtiilolna::Role::HashDumper(3)
2
3
4
6 Dist::Zilla::Role::HashDumper - Dump selected hash keys as a string
7
9 This document describes version 4.13 of Dist::Zilla::Role::HashDumper,
10 released December 17, 2017 as part of Dist-Zilla-Plugins-CJM version
11 6.000.
12
14 Plugins implementing HashDumper may call their own "extract_keys"
15 method to extract selected keys from a hash and return a string
16 suitable for injecting into Perl code. They may also call the
17 "hash_as_string" method to do the same for an entire hash.
18
20 extract_keys
21 my $string = $plugin->extract_keys($name, \%hash, @keys);
22 eval "%new_hash = ($string);";
23
24 This combines "extract_keys_as_hash" and "hash_as_string". It
25 constructs a string of properly quoted keys and values from selected
26 keys in a hash. (Note that "\%hash" is a reference, but @keys is not.)
27 The $name is used only in a log_debug message.
28
29 If any key has no value (or its value is an empty hash or array ref) it
30 will be omitted from the list. If all keys are omitted, the empty
31 string is returned. Otherwise, the result always ends with a comma.
32
33 extract_keys_as_hash
34 my $hashref = $plugin->extract_keys_as_hash($name, \%hash, @keys);
35
36 This constructs a hashref from from selected keys in a hash. (Note
37 that "\%hash" is a reference, but @keys is not.) The $name is used
38 only in a log_debug message.
39
40 If any key has no value (or its value is an empty hash or array ref) it
41 will be omitted from the new hashref. If all keys are omitted, an
42 empty hashref is returned.
43
44 hash_as_string
45 my $string = $plugin->hash_as_string(\%hash);
46 eval "%new_hash = ($string);";
47
48 This constructs a string of properly quoted keys and values from a
49 hash. If the hash is empty, the empty string will be returned.
50 Otherwise, the result always ends with a comma.
51
53 Dist::Zilla::Role::HashDumper requires no configuration files or
54 environment variables.
55
57 Data::Dumper.
58
60 None reported.
61
63 No bugs have been reported.
64
66 Christopher J. Madsen "<perl AT cjmweb.net>"
67
68 Please report any bugs or feature requests to
69 "<bug-Dist-Zilla-Plugins-CJM AT rt.cpan.org>" or through the web
70 interface at
71 <http://rt.cpan.org/Public/Bug/Report.html?Queue=Dist-Zilla-Plugins-CJM>.
72
73 You can follow or contribute to Dist-Zilla-Plugins-CJM's development at
74 <https://github.com/madsen/dist-zilla-plugins-cjm>.
75
77 This software is copyright (c) 2017 by Christopher J. Madsen.
78
79 This is free software; you can redistribute it and/or modify it under
80 the same terms as the Perl 5 programming language system itself.
81
83 BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
84 FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT
85 WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER
86 PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND,
87 EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
88 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
89 ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
90 YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
91 NECESSARY SERVICING, REPAIR, OR CORRECTION.
92
93 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
94 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
95 REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE LIABLE
96 TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR
97 CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
98 SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
99 RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
100 FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
101 SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
102 DAMAGES.
103
104
105
106perl v5.36.0 2023-01-20 Dist::Zilla::Role::HashDumper(3)