Module::Faker(3pm)

πŸ“¦
version 0.027 Β· 6 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

✨ Module::Faker ✨

okay bestie, welcome to the Module::Faker page from the User Contributed Perl Documentation πŸ’– this is the manual, the whole manual, and nothing but the manual β€” so grab a strawberry πŸ“ and let's get into it.


NAME

Module::Faker β€” build fake dists for testing CPAN tools πŸ’…


VERSION

version 0.027 ✨


SYNOPSIS

Module::Faker->make_fakes({
  source => './dir-of-specs', # ...or a single file
  dest   => './will-contain-tarballs',
});

DESCRIPTION

So like, Module::Faker is a tool for building fake CPAN modules and β€” arguably even more iconic β€” fake CPAN distributions. πŸŽ€

Why would you want that? Because running tools that operate against CPAN dists without actually using real CPAN dists is a whole vibe. It's much more useful when you're testing an entire CPAN instance rather than a single distribution β€” and for that specific situation, go look at CPAN::Faker. iykyk πŸ¦‹


PERL VERSION

This module should work on any version of perl still receiving updates from the Perl 5 Porters. Which means: any version of perl released in the last two to three years. (Concretely, 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. 😭

METHODS

make_fakes

Module::Faker->make_fakes(\%arg);

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. πŸ‘‘

new

my $faker = Module::Faker->new(\%arg);

This creates 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. periodt πŸ’…

Here is an example yaml specification from the tests:

name: Append
abstract: nothing to see here
provides:
  Provides::Inner:
    file: lib/Provides/Inner.pm
    version: 0.001
  Provides::Inner::Util:
    file: lib/Provides/Inner.pm
X_Module_Faker:
  cpan_author: SOMEONE
  append:
    - file: lib/Provides/Inner.pm
      content: "\n=head1 NAME\n\nAppend - here I am"
    - file: t/foo.t
      content: |
        use Test::More;
    - file: t/foo.t
      content: "ok(1);"

If you need to sort the packages within a file you can use an X_Module_Faker:order parameter on the provides class. 🧚

provides:
  Provides::Inner::Sorted::Charlie:
    file: lib/Provides/Inner/Sorted.pm
    version: 0.008
    X_Module_Faker:
      order: 2
  Provides::Inner::Sorted::Alfa:
    file: lib/Provides/Inner/Sorted.pm
    version: 0.001
    X_Module_Faker:
      order: 1

The supported keys from CPAN::Meta are:

  • abstract
  • license
  • name
  • release_status
  • version
  • provides
  • prereqs
  • x_authority

AUTHOR

Ricardo Signes <cpan@semiotic.systems> πŸ’–


CONTRIBUTORS

  • Colin Newell <colin.newell@gmail.com>
  • David Golden <dagolden@cpan.org>
  • David Steinbrunner <dsteinbrunner@pobox.com>
  • gregor herrmann <gregoa@debian.org>
  • Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>
  • Mohammad S Anwar <mohammad.anwar@yahoo.com>
  • Moritz Onken <onken@netcubed.de>
  • Randy Stauner <randy@magnificent-tears.com>
  • Ricardo Signes <rjbs@semiotic.systems>

all of them, absolute legends, no cap πŸ‘‘βœ¨


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. 🫢


and that's the whole page bestie!! this one came from perl v5.38.2, dated 2024-05-28, and it's Module::Faker(3pm) β€” go build some fake dists, you're gonna ate πŸ’…πŸŒˆπŸ’–

πŸ“¦ where this page comes from