Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Running tests on modules generated by Module::Starter still in /lib directory

by kcott (Archbishop)
on Feb 13, 2017 at 07:21 UTC ( [id://1181885]=note: print w/replies, xml ) Need Help??


in reply to Running tests on modules generated by Module::Starter still in /lib directory

G'day nysus,

"... I'm finally learning how to create a proper Perl module ... Module::Starter along with Damian Conway's plugin for it. ... Can someone please clue me in? Thanks."

The enitre process should be incredibly simple. I don't know if you did something odd initially; or if you're running things from the wrong directories; or something else. I did a complete run to show you what's needed and where all the directories and files are.

ken@ganymede: ~/tmp $ mkdir starting_dir ken@ganymede: ~/tmp $ cd starting_dir ken@ganymede: ~/tmp/starting_dir $ cat ~/.module-starter/config author: Ken Cotterill email: kcott@cpan.org builder: ExtUtils::MakeMaker Module::Build plugins: Module::Starter::PBP template_dir: /Users/ken/.module-starter/PBP ken@ganymede: ~/tmp/starting_dir $ module-starter --module=TestForNysus Added to MANIFEST: Build.PL Added to MANIFEST: Changes Added to MANIFEST: lib/TestForNysus.pm Added to MANIFEST: Makefile.PL Added to MANIFEST: MANIFEST Added to MANIFEST: README Added to MANIFEST: t/00.load.t Added to MANIFEST: t/perlcritic.t Added to MANIFEST: t/pod-coverage.t Added to MANIFEST: t/pod.t Created starter directories and files ken@ganymede: ~/tmp/starting_dir $ ls -al total 0 drwxr-xr-x 3 ken staff 102 Feb 13 17:18 . drwxr-xr-x 6 ken staff 204 Feb 13 17:15 .. drwxr-xr-x 9 ken staff 306 Feb 13 17:18 TestForNysus ken@ganymede: ~/tmp/starting_dir $ cd TestForNysus/ ken@ganymede: ~/tmp/starting_dir/TestForNysus $ ls -al total 20 drwxr-xr-x 9 ken staff 306 Feb 13 17:18 . drwxr-xr-x 3 ken staff 102 Feb 13 17:18 .. -rw-r--r-- 1 ken staff 661 Feb 13 17:18 Build.PL -rw-r--r-- 1 ken staff 110 Feb 13 17:18 Changes -rw-r--r-- 1 ken staff 138 Feb 13 17:18 MANIFEST -rw-r--r-- 1 ken staff 737 Feb 13 17:18 Makefile.PL -rw-r--r-- 1 ken staff 1318 Feb 13 17:18 README drwxr-xr-x 3 ken staff 102 Feb 13 17:18 lib drwxr-xr-x 6 ken staff 204 Feb 13 17:18 t ken@ganymede: ~/tmp/starting_dir/TestForNysus $ perl Makefile.PL && make && make test Checking if your kit is complete... Looks good WARNING: Setting ABSTRACT via file 'lib/TestForNysus.pm' failed at /Users/ken/perl5/perlbrew/perls/perl-5.24.0t/lib/site_perl/5.24.0/ +ExtUtils/MakeMaker.pm line 755. Generating a Unix-style Makefile Writing Makefile for TestForNysus Writing MYMETA.yml and MYMETA.json cp lib/TestForNysus.pm blib/lib/TestForNysus.pm Manifying 1 pod document PERL_DL_NONLAZY=1 "/Users/ken/perl5/perlbrew/perls/perl-5.24.0t/bin/pe +rl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Ha +rness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/00.load.t ....... 1/1 # Testing TestForNysus v0.0.1 t/00.load.t ....... ok t/perlcritic.t .... skipped: Author test. To run: set $ENV{CPAN_TEST_A +UTHOR} to a TRUE value. t/pod-coverage.t .. skipped: Author test. To run: set $ENV{CPAN_TEST_A +UTHOR} to a TRUE value. t/pod.t ........... skipped: Author test. To run: set $ENV{CPAN_TEST_A +UTHOR} to a TRUE value. All tests successful. Files=4, Tests=1, 2 wallclock secs ( 0.03 usr 0.01 sys + 0.47 cusr + 0.07 csys = 0.58 CPU) Result: PASS

So, I hadn't edited the module first. The WARNING is because the POD only has the skeleton code:

=head1 NAME TestForNysus -

I added some text for the ABSTRACT:

=head1 NAME TestForNysus - blah blah blah

I find it easier to run make realclean between changes; so, back at the previous directory:

ken@ganymede: ~/tmp/starting_dir/TestForNysus $ make realclean && perl Makefile.PL && make && make test rm -f ... list of files cleaned up ... Checking if your kit is complete... Looks good Generating a Unix-style Makefile Writing Makefile for TestForNysus Writing MYMETA.yml and MYMETA.json cp lib/TestForNysus.pm blib/lib/TestForNysus.pm Manifying 1 pod document PERL_DL_NONLAZY=1 "/Users/ken/perl5/perlbrew/perls/perl-5.24.0t/bin/pe +rl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Ha +rness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/00.load.t ....... 1/1 # Testing TestForNysus v0.0.1 t/00.load.t ....... ok t/perlcritic.t .... skipped: Author test. To run: set $ENV{CPAN_TEST_A +UTHOR} to a TRUE value. t/pod-coverage.t .. skipped: Author test. To run: set $ENV{CPAN_TEST_A +UTHOR} to a TRUE value. t/pod.t ........... skipped: Author test. To run: set $ENV{CPAN_TEST_A +UTHOR} to a TRUE value. All tests successful. Files=4, Tests=1, 0 wallclock secs ( 0.03 usr 0.02 sys + 0.45 cusr + 0.05 csys = 0.55 CPU) Result: PASS

I always run the make parts in the same window. I have "set -o vi" in my '.bash_profile", so after the first

make realclean && perl Makefile.PL && make && make test

I just need 3 keystrokes to repeat those 4 commands:

<Esc>k<Enter>

While developing a module, I'd normally have 3 windows open at these directories:

For the make commands
~/tmp/starting_dir/TestForNysus/
For editing TestForNysus.pm
~/tmp/starting_dir/TestForNysus/lib/
For editing *.t files
~/tmp/starting_dir/TestForNysus/t/

— Ken

Replies are listed 'Best First'.
Re^2: Running tests on modules generated by Module::Starter still in /lib directory
by nysus (Parson) on Feb 13, 2017 at 15:35 UTC

    Thank you so much. This should provide me with much more of a clue as to how to do this.

    $PM = "Perl Monk's";
    $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate";
    $nysus = $PM . ' ' . $MCF;
    Click here if you love Perl Monks

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-04-20 00:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found