Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: RFC - Module::Cooker (File::ShareDir::Install)

by Anonymous Monk
on Dec 02, 2013 at 08:37 UTC ( [id://1065254]=note: print w/replies, xml ) Need Help??


in reply to RFC - Module::Cooker - UPDATE

Just today davido was wondering about data files in the distribution .... tye said put it alongside the .pm in the module tree ... you have .pm files which are templates in your file tree, bad idea, use File::Sharedir/File::ShareDir::Install

File::HomeDir + File::ShareDir => File::UserConfig

aside from that :) have you heard of minilla? or Dist::Inkt - Dist::Zilla didn't have the prerequisite amount of crazy for me, so I wrote this instead.?

Maybe you can steal some ideas :)

Replies are listed 'Best First'.
Re^2: RFC - Module::Cooker (File::ShareDir::Install)
by tobyink (Canon) on Dec 02, 2013 at 14:22 UTC

    Actually Dist::Inkt is unlikely to be much help; it only does one job: produces a tarball suitable for uploading to CPAN from the project directory. (That includes building META.yml, META.json, Makefile.PL, etc.) Creating a new project directory from scratch is something outside its mandate.

    However it has a companion project Dist::Inktly::Minty which does that; it should be fairly easy to subclass to do what you want. (A couple of subclasses are bundled with it.)

    Update: as a general design note, if you do publish Module::Cooker... don't waste your time making it super-configurable with config files, etc. The end-users it is aimed at are Perl programmers; they are not opposed to writing Perl to get something done. So just make it easy to subclass - this is a far more powerful form of extensibility. Break everything up into small methods that can be overridden in subclasses; document them, the arguments they take and what (if anything) they're expected to return. Make sure that your command-line tools support a --cooker=Module::Cooker::MySubclass option to allow users to indicate hey want to use a particular subclass of Module::Cooker rather than the base Module::Cooker package.

    use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name
Re^2: RFC - Module::Cooker (File::ShareDir::Install)
by boftx (Deacon) on Dec 02, 2013 at 08:48 UTC

    I'm not quite sure what you mean. I am using File::HomeDir in the script to get what I hope is the user's home dir so I can locate an optional local config file. With regards to data files, Module::Cooker places its data files under its own directory, see _basename_dir, but that can be overridden by specifying a local data dir if desired.

    It helps to remember that the primary goal is to drain the swamp even when you are hip-deep in alligators.

      I'm not quite sure what you mean ... Module::Cooker places its data files under its own directory

      Pretty much what I said, don't do that, use sharedir , sharedir is the "official" way ... perldoc/pod2html... will all find your "data files" and treat them as real perl modules ... because they live in the module tree and are named like modules ... you avoid that with sharedir , its why its the "official" standard :)

      Also remember to consider version-ing or even theme-ing your template sets ...

        I need to think on this. My gut is telling me that there is a reason that what you suggest would not work, but I can't put my finger on it. :)

        As to versioning/theming of the templates, that is something I had not thought of. I just assumed (yeah, I know) that using git to handle that for the distro was enough.

        It helps to remember that the primary goal is to drain the swamp even when you are hip-deep in alligators.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1065254]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-03-19 04:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found