Module::CPANfile::Writer - Module for modifying the cpanfile
my $writer = Module::CPANfile::Writer->new('cpanfile');
$writer->add_prereq('Test2::Suite', undef, relationship => 'recommends');
Module::CPANfile::Writer lets you modify the version of modules in the existing cpanfile.
cpanfile is very flexible because it is written in Perl by using DSL, you can write comments and even code. Therefore, modifying the cpanfile is not easy and you have to understand Perl code.
The idea of modifying the cpanfile was inspired by App::CpanfileSliptop. This module uses PPI to parse and analyze the cpanfile as Perl code. But PPI depends XS modules such as Clone and Params::Util, so these modules are annoying to fatpack in one pure-perl script.
Module::CPANfile::Writer has no XS modules in dependencies because it uses Babble and PPR to parse (recognize) Perl code.
This will create a new instance of Module::CPANfile::Writer.
It takes the filename or the content of cpanfile as scalarref.
This will returns the content of modified cpanfile.
Modify the version of specified $module in cpanfile.
You can also pass $version to 0 or undef, this will remove the version requirement of $module.
Write the content of modified cpanfile to the $file.
Copyright (C) Takumi Akiyama.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Takumi Akiyama <email@example.com>
To install Module::CPANfile::Writer, 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.