1Module::Faker(3) User Contributed Perl Documentation Module::Faker(3)
2
3
4
6 Module::Faker - build fake dists for testing CPAN tools
7
9 version 0.025
10
12 Module::Faker->make_fakes({
13 source => './dir-of-specs', # ...or a single file
14 dest => './will-contain-tarballs',
15 });
16
17 DESCRIPTION
18 Module::Faker is a tool for building fake CPAN modules and, perhaps
19 more importantly, fake CPAN distributions. These are useful for
20 running tools that operate against CPAN distributions without having to
21 use real CPAN distributions. This is much more useful when testing an
22 entire CPAN instance, rather than a single distribution, for which see
23 CPAN::Faker.
24
26 This module should work on any version of perl still receiving updates
27 from the Perl 5 Porters. This means it should work on any version of
28 perl released in the last two to three years. (That is, if the most
29 recently released version is v5.40, then this module should work on
30 both v5.40 and v5.38.)
31
32 Although it may work on older versions of perl, no guarantee is made
33 that the minimum required version will not be increased. The version
34 may be increased for any reason, and there is no promise that patches
35 will be accepted to lower the minimum required perl.
36
38 make_fakes
39 Module::Faker->make_fakes(\%arg);
40
41 This method creates a new Module::Faker and builds archives in its
42 destination directory for every dist-describing file in its source
43 directory. See the "new" method below.
44
45 new
46 my $faker = Module::Faker->new(\%arg);
47
48 This create the new Module::Faker. All arguments may be accessed later
49 by methods of the same name. Valid arguments are:
50
51 source - the directory in which to find source files
52 dest - the directory in which to construct dist archives
53
54 dist_class - the class used to fake dists; default: Module::Faker::Dist
55
56 The source files are essentially a subset of CPAN::Meta files with some
57 optional extra features. All you really require are the name and
58 abstract. Other bits like requirements can be specified and will be
59 passed through. Out of the box the module will create the main module
60 file based on the module name and a single test file. You can either
61 use the provides section of the CPAN::META file or to specify their
62 contents use the X_Module_Faker append section.
63
64 The X_Module_Faker also allows you to alter the cpan_author from the
65 default 'LOCAL <LOCAL@cpan.local>' which overrides whatever is in the
66 usual CPAN::Meta file.
67
68 Here is an example yaml specification from the tests,
69
70 name: Append
71 abstract: nothing to see here
72 provides:
73 Provides::Inner:
74 file: lib/Provides/Inner.pm
75 version: 0.001
76 Provides::Inner::Util:
77 file: lib/Provides/Inner.pm
78 X_Module_Faker:
79 cpan_author: SOMEONE
80 append:
81 - file: lib/Provides/Inner.pm
82 content: "\n=head1 NAME\n\nAppend - here I am"
83 - file: t/foo.t
84 content: |
85 use Test::More;
86 - file: t/foo.t
87 content: "ok(1);"
88
89 If you need to sort the packages within a file you can use an
90 X_Module_Faker:order parameter on the provides class.
91
92 provides:
93 Provides::Inner::Sorted::Charlie:
94 file: lib/Provides/Inner/Sorted.pm
95 version: 0.008
96 X_Module_Faker:
97 order: 2
98 Provides::Inner::Sorted::Alfa:
99 file: lib/Provides/Inner/Sorted.pm
100 version: 0.001
101 X_Module_Faker:
102 order: 1
103
104 The supported keys from CPAN::Meta are,
105
106 • abstract
107
108 • license
109
110 • name
111
112 • release_status
113
114 • version
115
116 • provides
117
118 • prereqs
119
120 • x_authority
121
123 Ricardo Signes <cpan@semiotic.systems>
124
126 • Colin Newell <colin.newell@gmail.com>
127
128 • David Golden <dagolden@cpan.org>
129
130 • David Steinbrunner <dsteinbrunner@pobox.com>
131
132 • gregor herrmann <gregoa@debian.org>
133
134 • Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>
135
136 • Mohammad S Anwar <mohammad.anwar@yahoo.com>
137
138 • Moritz Onken <onken@netcubed.de>
139
140 • Randy Stauner <randy@magnificent-tears.com>
141
142 • Ricardo Signes <rjbs@semiotic.systems>
143
144 • Ricardo Signes <rjbs@users.noreply.github.com>
145
147 This software is copyright (c) 2008 by Ricardo Signes.
148
149 This is free software; you can redistribute it and/or modify it under
150 the same terms as the Perl 5 programming language system itself.
151
152
153
154perl v5.38.0 2023-07-20 Module::Faker(3)