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.022
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 make_fakes
27 Module::Faker->make_fakes(\%arg);
28
29 This method creates a new Module::Faker and builds archives in its
30 destination directory for every dist-describing file in its source
31 directory. See the "new" method below.
32
33 new
34 my $faker = Module::Faker->new(\%arg);
35
36 This create the new Module::Faker. All arguments may be accessed later
37 by methods of the same name. Valid arguments are:
38
39 source - the directory in which to find source files
40 dest - the directory in which to construct dist archives
41
42 dist_class - the class used to fake dists; default: Module::Faker::Dist
43
44 The source files are essentially a subset of CPAN::Meta files with some
45 optional extra features. All the you really require are the name and
46 abstract. Other bits like requirements can be specified and will be
47 passed through. Out of the box the module will create the main module
48 file based on the module name and a single test file. You can either
49 use the provides section of the CPAN::META file or to specify their
50 contents use the X_Module_Faker append section.
51
52 The X_Module_Faker also allows you to alter the cpan_author from the
53 default 'LOCAL <LOCAL@cpan.local>' which overrides whatever is in the
54 usual CPAN::Meta file.
55
56 Here is an example yaml specification from the tests,
57
58 name: Append
59 abstract: nothing to see here
60 provides:
61 Provides::Inner:
62 file: lib/Provides/Inner.pm
63 version: 0.001
64 Provides::Inner::Util:
65 file: lib/Provides/Inner.pm
66 X_Module_Faker:
67 cpan_author: SOMEONE
68 append:
69 - file: lib/Provides/Inner.pm
70 content: "\n=head1 NAME\n\nAppend - here I am"
71 - file: t/foo.t
72 content: |
73 use Test::More;
74 - file: t/foo.t
75 content: "ok(1);"
76
77 If you need to sort the packages within a file you can use an
78 X_Module_Faker:order parameter on the provides class.
79
80 provides:
81 Provides::Inner::Sorted::Charlie:
82 file: lib/Provides/Inner/Sorted.pm
83 version: 0.008
84 X_Module_Faker:
85 order: 2
86 Provides::Inner::Sorted::Alfa:
87 file: lib/Provides/Inner/Sorted.pm
88 version: 0.001
89 X_Module_Faker:
90 order: 1
91
92 The supported keys from CPAN::Meta are,
93
94 · abstract
95
96 · license
97
98 · name
99
100 · release_status
101
102 · version
103
104 · provides
105
106 · prereqs
107
108 · x_authority
109
111 Ricardo Signes <rjbs@cpan.org>
112
114 · Colin Newell <colin.newell@gmail.com>
115
116 · David Golden <dagolden@cpan.org>
117
118 · David Steinbrunner <dsteinbrunner@pobox.com>
119
120 · Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>
121
122 · Moritz Onken <onken@netcubed.de>
123
124 · Randy Stauner <randy@magnificent-tears.com>
125
127 This software is copyright (c) 2008 by Ricardo Signes.
128
129 This is free software; you can redistribute it and/or modify it under
130 the same terms as the Perl 5 programming language system itself.
131
132
133
134perl v5.30.0 2019-07-26 Module::Faker(3)