Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wishlist: Start module with pre-existing .pm #77

Open
LadyAleena opened this issue Sep 7, 2020 · 5 comments
Open

Wishlist: Start module with pre-existing .pm #77

LadyAleena opened this issue Sep 7, 2020 · 5 comments

Comments

@LadyAleena
Copy link

Would it be a great deal of effort to write in the use of a pre-existing .pm file to start a module? I have many I would like to package easily, and module-starter would be the easiest to use; if it would use my pre-existing .pm files.

module-starter --module=Neat::Thing --dir=pkgs --file=mods/lib/Neat/Thing.pm

The .pm would be copied into the package. Whatever is in the .pm could be plugged into the various files in package being started like the version, used modules, and subroutines.

package Neat::Thing;
use v5.10.0;
use strict;
use warnings;

use Exporter qw(import);
use File::ShareDir qw(module_dir);
use String::Util qw(trim);

sub neat_thing {
  ...
}

It might even be able to do nifty things like see the use of File::ShareDir and grab any files in the shared directory and add File::ShareDir::Install where needed. In this case, the shared directory would be mods/lib/auto/Neat/Thing/.

This would make packaging my pre-existing .pm files a lot easier.

@Grinnz
Copy link
Collaborator

Grinnz commented Sep 7, 2020

An option to build out a structure for existing code would be reasonable, but more likely it would work in place (just add the files that are missing) rather than taking a module file from elsewhere.

@Grinnz
Copy link
Collaborator

Grinnz commented Sep 7, 2020

Though it sounds almost like you are talking about a profile and not building around existing code, which in Module::Starter is what plugins are for (admittedly, they are not very good). You may consider looking into Dist::Zilla or other minting profiles which are much more sophisticated. See https://metacpan.org/pod/Dist::Zilla::MintingProfile::Starter for a description of how to customize your own Dist::Zilla minting profile, I believe it would be usable for templating regardless of whether dzil is used to manage to resulting distribution. Minilla and mbtiny mint are a couple other options, but cannot be customized the same way.

@Grinnz
Copy link
Collaborator

Grinnz commented Sep 7, 2020

Note that Module::Starter comes with a Templating plugin but frankly I don't know how to use it and it seems to be incomplete.

@Grinnz
Copy link
Collaborator

Grinnz commented Sep 7, 2020

Ah, I found an implementation of it, though it's quite old so no warranty (use the plugins mentioned in the synopsis with the --plugin option): Module::Starter::Plugin::TT2

@LadyAleena
Copy link
Author

Oh, I have lots of existing code I want to package. Right now my .pm are in one directory where I am working on getting documentation written (and hopefully proofed), tests written, etc. For each of them, I want to take the .pm file with the optional .pod file along with the test file(s) and put them in their own package. It would be nice if I could specify where some of these files are without having to cp them after package creation.

I know this is a big ask, so if it isn't something that interests you, I will drop it.

(I am overwhelmed by all the moving parts needed to prepare a module for CPAN.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants