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

[RFC] Discipulus's step by step tutorial on module creation with tests and git

by Discipulus (Canon)
on Dec 19, 2018 at 11:14 UTC ( [id://1227454]=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    shell> module-starter --module Range::Validator --author MyName --emai
    +l MyName@cpan.org
    
    ...
    Added to MANIFEST: xt/boilerplate.t
    Created starter directories and files
    
  2. or download this
    ---Range-Validator
       |   Changes
    ...
       |
       |----xt
               boilerplate.t
    
  3. or download this
    git-client> git init
    
    Initialized empty Git repository in /path/to/Range-Validator/.git/
    
  4. or download this
    git-client> git status
    
    ...
            xt/
    
    nothing added to commit but untracked files present (use "git add" to 
    +track)
    
  5. or download this
    git-client> git add .
    
    ...
            new file:   t/pod.t
            new file:   xt/boilerplate.t
    
  6. or download this
    git-client> git commit -m "module-starter created content"
    
    ...
    On branch master
    nothing to commit, working tree clean
    
  7. or download this
    git-client> git remote add YourGithubLogin https://github.com/YourGith
    +ubLogin/Range-Validator.git
    
    ...
    YourGithubLogin       https://github.com/YourGithubLogin/Range-Validat
    +or.git (fetch)
    YourGithubLogin       https://github.com/YourGithubLogin/Range-Validat
    +or.git (push)
    
  8. or download this
    git-client> git push YourGithubLogin master
    
    ...
    remote:
    To https://github.com/YourGithubLogin/Range-Validator.git
     * [new branch]      master -> master
    
  9. or download this
    package Range::Validator;
    
    ...
        
    # more POD ...
    
  10. or download this
    shell> perl -I ./lib -MRange::Validator -e 1
    
    shell>
    
  11. or download this
    #!perl -T
    use 5.006;
    ...
    
    diag( "Testing Range::Validator $Range::Validator::VERSION, Perl $], $
    +^X" );
    
  12. or download this
    shell> perl -I ./lib ./t/00-load.t
    
    "-T" is on the #! line, it must also be used on the command line at ./
    +t/00-load.t line 1.
    
  13. or download this
    shell> perl -I ./lib ./t/00-load.t
    
    ...
    1..1
    # Testing Range::Validator 0.01, Perl 5.026000, /path/to/my/perl
    
  14. or download this
    shell> prove -l ./t/00-load.t
    
    ...
    Files=1, Tests=1,  0 wallclock secs ( 0.01 usr +  0.02 sys =  0.03 CPU
    +)
    Result: PASS
    
  15. or download this
    shell> prove -l
    
    ...
    Files=4, Tests=1,  1 wallclock secs ( 0.06 usr +  0.02 sys =  0.08 CPU
    +)
    Result: PASS
    
  16. or download this
    git-client> git status
    
    ...
    
    no changes added to commit (use "git add" and/or "git commit -a")
    
  17. or download this
    git-client> git commit -a -m "moved POD, removed -T"
    
    ...
    On branch master
    nothing to commit, working tree clean
    
  18. or download this
    git-client>git remote -v
    
    ...
    To https://github.com/YourGithubLogin/Range-Validator
       1788c12..49a0690  master -> master
    
  19. or download this
    sub validate{
        my $range;
    ...
        return @range;
    }
    
  20. or download this
    package Range::Validator;
    
    ...
    }
    
    1;
    
  21. or download this
    #!perl
    use 5.006;
    ...
    dies_ok { Range::Validator::validate('xxxinvalidstringxxx') }
                "expected to die with invalid character";
    
  22. or download this
    use 5.006;
    use strict;
    ...
        clean => { FILES => 'Range-Validator-*' },
    );
    
  23. or download this
    use 5.006;
    use strict;
    ...
        dist  => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
        clean => { FILES => 'Range-Validator-*' },
    );
    
  24. or download this
    shell> prove -l -v ./t/01-validate.t
    
    ...
    Files=1, Tests=3,  0 wallclock secs ( 0.05 usr +  0.01 sys =  0.06 CPU
    +)
    Result: PASS
    
  25. or download this
    git-client> git status
    
    ...
    [master 580f628] some code into validate and modified Makefile.PL
     2 files changed, 23 insertions(+), 3 deletions(-)
    
  26. or download this
    git-client> git add  t/01-validate.t
    
    ...
    On branch master
    nothing to commit, working tree clean
    
  27. or download this
    git-client> git remote -v
    
    ...
    remote: Resolving deltas: 100% (5/5), completed with 4 local objects.
    To https://github.com/YourGithubLogin/Range-Validator
       49a0690..5083ec3  master -> master
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://1227454]
Approved by marto
Front-paged by kcott
help
Chatterbox?
and the web crawler heard nothing...

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

    No recent polls found