BillKSmith has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to work through the examples in the section "Adding Additional Modules" in the chapter "Creating Your Own Perl Distribution" in the book "Intermediate Perl". It is not clear from the text whether or not the utility module-starter should start a normal module if the plugin "Module::Starter::AddModule" is specified in the config file. The command module-starter --module=Animal,cow,Horse,Mouse failed with the plugin specified. I deleted the entire distribution and and successfully reran the command without the plugin. I then attempted to add a module by restoring the plugin to my config file and running module-starter --module=Sheep --dist=Animal. Here is the session. The error message appears to be from windows. I have no idea what to do about it.
% type %module_starter_dir%\config author: Willie Gilligan email: gilligan@island.example.com builder: Module::Build verbose: 1 plugins: Module::Starter::AddModule % module-starter --module=Sheep --dist=Animal Found Animal. Use --force if you want to stomp on it. Skipped Animal\lib\Animal.pm Skipped Animal\lib\Cow.pm Skipped Animal\lib\Horse.pm Skipped Animal\lib\Mouse.pm Created Animal\lib\Sheep.pm Skipped Animal\t\pod-coverage.t Skipped Animal\t\manifest.t Skipped Animal\t\pod.t Skipped Animal\t\00-load.t Skipped Animal\xt\boilerplate.t Skipped Animal\Build.PL Skipped Animal\Changes Skipped Animal\README Regenerating MANIFEST Created MYMETA.yml and MYMETA.json Creating new 'Build' script for 'Animal' version '0.01' '.' is not recognized as an internal or external command, operable program or batch file. Created starter directories and files
Bill

Replies are listed 'Best First'.
Re: Unable to use Module::Starter::AddModule under windows
by Corion (Patriarch) on Jul 31, 2018 at 16:40 UTC

    Looking at the source of Module::Starter::AddModule, it suffers from trying to use a Unixish command line approach even with the Windows default shell, which doesn't work there:

    if( $guesser->uses_module_build ) { $self->verbose( "Detected Module::Build" ); system( $^X, 'Build.PL' ); system( './Build', 'manifest' ); }

    I think a good approach here would be to make the module use the appropriate path separator for each platform.

    I don't see how you can easily fix that without patching the module itself.

      Thanks for the help (again). It probably is time to burn that book and be done with really neat things that don't quite work. (Would you believe that its link to its errata page is broken)
      Bill
Re: Unable to use Module::Starter::AddModule under windows
by syphilis (Archbishop) on Jul 31, 2018 at 23:11 UTC
    '.' is not recognized as an internal or external command

    Corion has correctly identified the source of the problem, though I don't think it has anything to do with the path separator. Rather, it's a command beginning with "." that the the Windows Cmd.exe shell can't handle.

    I expect (untested) that it should be fine if you replace:
    system( './Build', 'manifest' );
    with
    system($^X, './Build', 'manifest' );
    or with just
    system($^X 'Build', 'manifest' );

    Best,I think, to also open an issue about this.

    Cheers,
    Rob

      Just a minor correction to your good and portable solution:

      cmd.exe can handle commands starting with ".", but dot as the current directory needs to be followed by a backslash and the filename to run:

      .\cpanm

      The above launches cpanm.cmd (if it exists) from the current directory.

        but dot as the current directory needs to be followed by a backslash

        Yes, you're right - I should have double checked.
        Thanks for correcting my incorrection.

        Cheers,
        Rob
      Thanks for the 'fix', it works perfectly. Reporting an 'issue' will be a new experience for me. I'll give it a try tomorrow.

      UPDATE: Issue submitted.

      Bill