Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^4: Adding a class to a module - Can Module::Starter or Dist::Zilla help?

by mascip (Pilgrim)
on Aug 13, 2012 at 17:35 UTC ( #987169=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Adding a class to a module - Can Module::Starter or Dist::Zilla help?
in thread Adding a class to a module - Can Module::Starter or Dist::Zilla help?

Thank you for feedback. I've tried without the PBP plugin and templates, and it did the same anyway.

I just peeked in the Module::Starter::Smart source code, to find the same thing as you, the error message comes from create_basedir().

The documentation says:
"When invoked, the plugin checks if the distribution is already created. If so, the plugin would bypass C<create_basedir>) and go ahead pull in all the existing modules and test files; these information would be used later in the corresponding file creation subroutines for skipping already-created files"

So, it means that the create_distro() function doesn't do its job : it should not call create_basedir(), when the C:/My-Example already exists.

* Tweaking-searching in the modules... *

Ah !!! Here you go, i found the problem ! By adding print() statements both in Module/Starter/Simple.pm and Module/Starter/Smart.pm, i realized that when i use module-starter, it's Module::Starter::Simple who runs, not Module::Starter::Smart

If anybody knew why, it'd be good to hear. Otherwise, i'll have to try and understand how Module::Starter::Simple checks for plugin in the configuration file, and then uses them. I'll see if-when i have the time.

At least, part of the mystery is solved.

Edit-bis : my last Edit was wrong.


Comment on Re^4: Adding a class to a module - Can Module::Starter or Dist::Zilla help?
Re^5: Adding a class to a module - Can Module::Starter or Dist::Zilla help?
by mascip (Pilgrim) on Aug 13, 2012 at 19:24 UTC

    I found that i could use the --plugin=Module::Starter::Smart argument, to use the plugin. Now it works properly.

    I still don't know why the configuration line's plugin: Module::Starter::Smart didn't work previously. While all the others worked properly.

    Edit: Well, i get it now. I can use one plugin or the other, but not both, as they inherit from the same class (Module::Starter::Simple). So, Module::Starter::PBP and Module::Starter::Smart won't work simultaneously.
    Well... They will, if i cheat. I just changed Module/Starter/Smart.pm, so that it inherits from Module::Starter::PBP, instead of Module::Starter::Simple. It works !

    Is there any way to make a cleaner solution, from this dirty one?

      Ok, i found my solution for now. It also works when i do the opposite inheritance : when Module::Starter::PBP inherits from Module::Starter::Smart.

      So, i'll create my own plugin, maybe called Module::Starter::PBP::Perso. It will just be a copy-paste of Module::Starter::PBP, inheriting from MS-Smart instead of MS-Simple.

      And anyway, i'll have to read the source code and change little details in the module, in order to add the creation of the ./t/My/Example/Class/01_unit_test.t file, as well as ./t/lib My/Example/Class/Builder.pm. And i'll try to add my Log4perl configuration stuff at the same time.

      ~ ~ ~ I'm still curious on whether Dist::Zilla proposes something to do this.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2014-09-22 23:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (208 votes), past polls