shell> module-starter --module Range::Validator --author MyName --email MyName@cpan.org
Added to MANIFEST: Changes
Added to MANIFEST: ignore.txt
Added to MANIFEST: lib/Range/Validator.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/manifest.t
Added to MANIFEST: t/pod-coverage.t
Added to MANIFEST: t/pod.t
Added to MANIFEST: xt/boilerplate.t
Created starter directories and files
####
---Range-Validator
| Changes
| ignore.txt
| Makefile.PL
| MANIFEST
| README
|
|---lib
|
| ---Range
| Validator.pm
|
|----t
| 00-load.t
| manifest.t
| pod-coverage.t
| pod.t
|
|----xt
boilerplate.t
##
##
git-client> git init
Initialized empty Git repository in /path/to/Range-Validator/.git/
##
##
git-client> git status
On branch master
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
Changes
MANIFEST
Makefile.PL
README
ignore.txt
lib/
t/
xt/
nothing added to commit but untracked files present (use "git add" to track)
##
##
git-client> git add .
git-client> git status
On branch master
No commits yet
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: Changes
new file: MANIFEST
new file: Makefile.PL
new file: README
new file: ignore.txt
new file: lib/Range/Validator.pm
new file: t/00-load.t
new file: t/manifest.t
new file: t/pod-coverage.t
new file: t/pod.t
new file: xt/boilerplate.t
##
##
git-client> git commit -m "module-starter created content"
[master (root-commit) 1788c12] module-starter created content
11 files changed, 409 insertions(+)
create mode 100644 Changes
create mode 100644 MANIFEST
create mode 100644 Makefile.PL
create mode 100644 README
create mode 100644 ignore.txt
create mode 100644 lib/Range/Validator.pm
create mode 100644 t/00-load.t
create mode 100644 t/manifest.t
create mode 100644 t/pod-coverage.t
create mode 100644 t/pod.t
create mode 100644 xt/boilerplate.t
git-client> git status
On branch master
nothing to commit, working tree clean
##
##
git-client> git remote add YourGithubLogin https://github.com/YourGithubLogin/Range-Validator.git
git-client> git remote -v
YourGithubLogin https://github.com/YourGithubLogin/Range-Validator.git (fetch)
YourGithubLogin https://github.com/YourGithubLogin/Range-Validator.git (push)
##
##
git-client> git push YourGithubLogin master
fatal: HttpRequestException encountered.
Username for 'https://github.com': YourGithubLogin
Password for 'https://YourGithubLogin@github.com': ***********
Counting objects: 17, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (14/14), done.
Writing objects: 100% (17/17), 5.33 KiB | 303.00 KiB/s, done.
Total 17 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), done.
remote:
remote: Create a pull request for 'master' on GitHub by visiting:
remote: https://github.com/YourGithubLogin/Range-Validator/pull/new/master
remote:
To https://github.com/YourGithubLogin/Range-Validator.git
* [new branch] master -> master
##
##
package Range::Validator;
use 5.006;
use strict;
use warnings;
our $VERSION = '0.01';
sub validate {
}
1;
__DATA__
=head1 NAME
Range::Validator - a simple module to verify array and list ranges
=head1 VERSION
Version 0.01
=cut
=head1 SYNOPSIS
use Range::Validator;
my @range = Range::Validator->validate(0..3); # a valid range
my @range = Range::Validator->validate(0..3,2); # a overlapping range
my @range = Range::Validator->validate('1,3,7'); # a valid range passed as a string
my @range = Range::Validator->validate('1,XXX,3'); # an invalid range passed as a string
# more POD ...
##
##
shell> perl -I ./lib -MRange::Validator -e 1
shell>
##
##
#!perl -T
use 5.006;
use strict;
use warnings;
use Test::More;
plan tests => 1;
BEGIN {
use_ok( 'Range::Validator' ) || print "Bail out!\n";
}
diag( "Testing Range::Validator $Range::Validator::VERSION, Perl $], $^X" );
##
##
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.
##
##
shell> perl -I ./lib ./t/00-load.t
ok 1 - use Range::Validator;
1..1
# Testing Range::Validator 0.01, Perl 5.026000, /path/to/my/perl
##
##
shell> prove -l ./t/00-load.t
./t/00-load.t .. 1/? # Testing Range::Validator 0.01, Perl 5.026000, /path/to/my/perl
./t/00-load.t .. ok
All tests successful.
Files=1, Tests=1, 0 wallclock secs ( 0.01 usr + 0.02 sys = 0.03 CPU)
Result: PASS
##
##
shell> prove -l
t\00-load.t ....... 1/? # Testing Range::Validator 0.01, Perl 5.026000, /path/to/my/perl
t\00-load.t ....... ok
t\manifest.t ...... skipped: Author tests not required for installation
t\pod-coverage.t .. skipped: Author tests not required for installation
t\pod.t ........... skipped: Author tests not required for installation
All tests successful.
Files=4, Tests=1, 1 wallclock secs ( 0.06 usr + 0.02 sys = 0.08 CPU)
Result: PASS
##
##
git-client> git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: lib/Range/Validator.pm
modified: t/00-load.t
no changes added to commit (use "git add" and/or "git commit -a")
##
##
git-client> git commit -a -m "moved POD, removed -T"
[master 49a0690] moved POD, removed -T
2 files changed, 20 insertions(+), 23 deletions(-)
git-client> git status
On branch master
nothing to commit, working tree clean
##
##
git-client>git remote -v
YourGithubLogin https://github.com/YourGithubLogin/Range-Validator (fetch)
YourGithubLogin https://github.com/YourGithubLogin/Range-Validator (push)
git-client> git push YourGithubLogin master
fatal: HttpRequestException encountered.
Username for 'https://github.com': YourGithubLogin
Password for 'https://YourGithubLogin@github.com':
Counting objects: 7, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (7/7), 870 bytes | 435.00 KiB/s, done.
Total 7 (delta 3), reused 0 (delta 0)
remote: Resolving deltas: 100% (3/3), completed with 3 local objects.
To https://github.com/YourGithubLogin/Range-Validator
1788c12..49a0690 master -> master
##
##
sub validate{
my $range;
my @range;
# assume we have a string if we receive only one argument
if ( @_ == 1){
$range = $_[0];
}
# otherwise we received a list
else{
...
}
return @range;
}
##
##
package Range::Validator;
use 5.006;
use strict;
use warnings;
use Carp; # --- new line
our $VERSION = '0.01';
sub validate{
my $range;
my @range;
# assume we have a string if we receive only one argument
if ( @_ == 1){
$range = $_[0];
}
# otherwise we received a list
else{
...
}
# remove any space from string
$range =~ s/\s+//g; # --- new line
# die if invalid characters
croak "invalid character passed in string [$range]!"
if $range =~ /[^\s,.\d]/; # --- new line
@range = eval ($range); # --- new line
return @range;
}
1;
##
##
#!perl
use 5.006;
use strict;
use warnings;
use Test::More qw(no_plan);
use Test::Exception;
use_ok( 'Range::Validator' );
ok (scalar Range::Validator::validate('0..2') == 3,
'ok valid string produces correct number of elements' );
note ("starting test of forbidden characters in the string form");
dies_ok { Range::Validator::validate('xxxinvalidstringxxx') }
"expected to die with invalid character";
##
##
use 5.006;
use strict;
use warnings;
use ExtUtils::MakeMaker;
WriteMakefile(
NAME => 'Range::Validator',
AUTHOR => q{MyName <MyName@cpan.org>},
VERSION_FROM => 'lib/Range/Validator.pm',
ABSTRACT_FROM => 'lib/Range/Validator.pm',
LICENSE => 'artistic_2',
PL_FILES => {},
MIN_PERL_VERSION => '5.006',
CONFIGURE_REQUIRES => {
'ExtUtils::MakeMaker' => '0',
},
BUILD_REQUIRES => {
'Test::More' => '0',
},
PREREQ_PM => {
#'ABC' => '1.6',
#'Foo::Bar::Module' => '5.0401',
},
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
clean => { FILES => 'Range-Validator-*' },
);
##
##
use 5.006;
use strict;
use warnings;
use ExtUtils::MakeMaker;
WriteMakefile(
NAME => 'Range::Validator',
AUTHOR => q{MyName <MyName@cpan.org>},
VERSION_FROM => 'lib/Range/Validator.pm',
ABSTRACT_FROM => 'lib/Range/Validator.pm',
LICENSE => 'artistic_2',
PL_FILES => {},
MIN_PERL_VERSION => '5.006',
CONFIGURE_REQUIRES => {
'ExtUtils::MakeMaker' => '0',
},
BUILD_REQUIRES => {
'Test::More' => '0',
'Test::Exception' => '0', # --- new line
},
PREREQ_PM => {
'Carp' => '0', # --- new line
},
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
clean => { FILES => 'Range-Validator-*' },
);
##
##
shell> prove -l -v ./t/01-validate.t
./t/01-validate.t ..
ok 1 - use Range::Validator;
ok 2 - ok valid string produces correct number of elements
# starting test of forbidden characters in the string form
ok 3 - expected to die with invalid character
1..3
ok
All tests successful.
Files=1, Tests=3, 0 wallclock secs ( 0.05 usr + 0.01 sys = 0.06 CPU)
Result: PASS
##
##
git-client> git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: Makefile.PL
modified: lib/Range/Validator.pm
Untracked files:
(use "git add <file>..." to include in what will be committed)
t/01-validate.t
no changes added to commit (use "git add" and/or "git commit -a")
git-client> git commit -a -m "some code into validate and modified Makefile.PL"
[master 580f628] some code into validate and modified Makefile.PL
2 files changed, 23 insertions(+), 3 deletions(-)
##
##
git-client> git add t/01-validate.t
git-client> git status
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: t/01-validate.t
git-client> git commit -a -m "added 01-validate.t"
[master 5083ec3] added 01-validate.t
1 file changed, 16 insertions(+)
create mode 100644 t/01-validate.t
git-client> git status
On branch master
nothing to commit, working tree clean
##
##
git-client> git remote -v
YourGithubLogin https://github.com/YourGithubLogin/Range-Validator (fetch)
YourGithubLogin https://github.com/YourGithubLogin/Range-Validator (push)
git-client> git push YourGithubLogin master
fatal: HttpRequestException encountered.
Username for 'https://github.com': YourGithubLogin
Password for 'https://YourGithubLogin@github.com': *********
Counting objects: 10, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (10/10), 1.31 KiB | 447.00 KiB/s, done.
Total 10 (delta 5), reused 0 (delta 0)
remote: Resolving deltas: 100% (5/5), completed with 4 local objects.
To https://github.com/YourGithubLogin/Range-Validator
49a0690..5083ec3 master -> master