1Dist::Metadata::Struct(U3s)er Contributed Perl DocumentatDiiosnt::Metadata::Struct(3)
2
3
4

NAME

6       Dist::Metadata::Struct - Enable Dist::Metadata for a data structure
7

VERSION

9       version 0.927
10

SYNOPSIS

12         my $dm = Dist::Metadata->new(struct => {
13           files => {
14             'lib/Mod.pm' => 'package Mod; sub something { ... }',
15             'README'     => 'this is a fake dist, useful for testing',
16           }
17         });
18

DESCRIPTION

20       This is a subclass of Dist::Metadata::Dist to enable mocking up a dist
21       from perl data structures.
22
23       This is mostly used for testing but might be useful if you already have
24       an in-memory representation of a dist that you'd like to examine.
25
26       It's probably not very useful on it's own though, and should be used
27       from "new" in Dist::Metadata.
28

METHODS

30   new
31         $dist = Dist::Metadata::Struct->new(files => {
32           'lib/Mod.pm' => 'package Mod; sub something { ... }',
33         });
34
35       Accepts a "files" parameter that should be a hash of "{ name =>
36       content, }".  Content can be a string, a reference to a string, or an
37       IO object.
38
39   default_file_spec
40       "Unix" is the default for consistency/simplicity but "file_spec" can be
41       overridden in the constructor.
42
43   file_content
44       Returns the string content for the specified name.
45
46   find_files
47       Returns the keys of the "files" hash.
48

AUTHOR

50       Randy Stauner <rwstauner@cpan.org>
51
53       This software is copyright (c) 2011 by Randy Stauner.
54
55       This is free software; you can redistribute it and/or modify it under
56       the same terms as the Perl 5 programming language system itself.
57
58
59
60perl v5.38.0                      2023-07-20         Dist::Metadata::Struct(3)
Impressum