Module::Faker - build fake dists for testing CPAN tools
source => './dir-of-specs', # ...or a single file
dest => './will-contain-tarballs',
Module::Faker is a tool for building fake CPAN modules and, perhaps more importantly, fake CPAN distributions. These are useful for running tools that operate against CPAN distributions without having to use real CPAN distributions. This is much more useful when testing an entire CPAN instance, rather than a single distribution, for which see CPAN::Faker.
This module should work on any version of perl still receiving updates from the Perl 5 Porters. This means it should work on any version of perl released in the last two to three years. (That is, if the most recently released version is v5.40, then this module should work on both v5.40 and v5.38.)
Although it may work on older versions of perl, no guarantee is made that the minimum required version will not be increased. The version may be increased for any reason, and there is no promise that patches will be accepted to lower the minimum required perl.
This method creates a new Module::Faker and builds archives in its destination directory for every dist-describing file in its source directory. See the "new" method below.
my $faker = Module::Faker->new(\%arg);
This create the new Module::Faker. All arguments may be accessed later by methods of the same name. Valid arguments are:
source - the directory in which to find source files
dest - the directory in which to construct dist archives
dist_class - the class used to fake dists; default: Module::Faker::Dist
The source files are essentially a subset of CPAN::Meta files with some optional extra features. All you really require are the name and abstract. Other bits like requirements can be specified and will be passed through. Out of the box the module will create the main module file based on the module name and a single test file. You can either use the provides section of the CPAN::META file or to specify their contents use the X_Module_Faker append section.
The X_Module_Faker also allows you to alter the cpan_author from the default 'LOCAL <LOCAL@cpan.local>' which overrides whatever is in the usual CPAN::Meta file.
Here is an example yaml specification from the tests,
abstract: nothing to see here
- file: lib/Provides/Inner.pm
content: "\n=head1 NAME\n\nAppend - here I am"
- file: t/foo.t
- file: t/foo.t
If you need to sort the packages within a file you can use an X_Module_Faker:order parameter on the provides class.
The supported keys from CPAN::Meta are,
Ricardo Signes <firstname.lastname@example.org>
Colin Newell <email@example.com>
David Golden <firstname.lastname@example.org>
David Steinbrunner <email@example.com>
gregor herrmann <firstname.lastname@example.org>
Jeffrey Ryan Thalhammer <email@example.com>
Mohammad S Anwar <firstname.lastname@example.org>
Moritz Onken <email@example.com>
Randy Stauner <firstname.lastname@example.org>
Ricardo Signes <email@example.com>
Ricardo Signes <firstname.lastname@example.org>
This software is copyright (c) 2008 by Ricardo Signes.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Module::Faker, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.