Permalink
Browse files

Cpanize.

  • Loading branch information...
hiratara committed Sep 26, 2012
1 parent 42ec663 commit 0a0663b97a975842a73c167b93581160ae9d02e9
Showing with 148 additions and 16 deletions.
  1. +11 −0 .gitignore
  2. +1 −0 .shipit
  3. +4 −0 Changes
  4. +21 −0 MANIFEST.SKIP
  5. +13 −0 Makefile.PL
  6. +27 −0 README
  7. +1 −1 { → ex}/simpath.pl
  8. +28 −1 { → lib/Algorithm}/Simpath.pm
  9. +4 −0 t/00_compile.t
  10. +14 −14 { → t}/simpath.t
  11. +10 −0 xt/01_podspell.t
  12. +8 −0 xt/02_perlcritic.t
  13. +4 −0 xt/03_pod.t
  14. +2 −0 xt/perlcriticrc
View
@@ -0,0 +1,11 @@
+cover_db
+META.yml
+Makefile
+blib
+inc
+pm_to_blib
+MANIFEST
+Makefile.old
+nytprof.out
+MANIFEST.bak
+*.sw[po]
View
@@ -0,0 +1 @@
+steps = FindVersion, ChangeVersion, CheckChangeLog, DistTest, Commit, Tag, MakeDist, UploadCPAN
View
@@ -0,0 +1,4 @@
+Revision history for Perl extension Algorithm::Simpath
+
+0.01 Wed Sep 26 23:20:41 2012
+ - original version
View
@@ -0,0 +1,21 @@
+\bRCS\b
+\bCVS\b
+^MANIFEST\.
+^Makefile$
+~$
+^#
+\.old$
+^blib/
+^pm_to_blib
+^MakeMaker-\d
+\.gz$
+\.cvsignore
+^t/9\d_.*\.t
+^t/perlcritic
+^tools/
+\.svn/
+^[^/]+\.yaml$
+^[^/]+\.pl$
+^\.shipit$
+^\.git/
+\.sw[po]$
View
@@ -0,0 +1,13 @@
+use inc::Module::Install;
+name 'Algorithm-Simpath';
+all_from 'lib/Algorithm/Simpath.pm';
+
+# requires '';
+
+tests 't/*.t';
+author_tests 'xt';
+
+test_requires 'Test::More';
+auto_set_repository;
+auto_include;
+WriteAll;
View
27 README
@@ -0,0 +1,27 @@
+This is Perl module Algorithm::Simpath.
+
+INSTALLATION
+
+Algorithm::Simpath installation is straightforward. If your CPAN shell is set up,
+you should just be able to do
+
+ % cpan Algorithm::Simpath
+
+Download it, unpack it, then build it as per the usual:
+
+ % perl Makefile.PL
+ % make && make test
+
+Then install it:
+
+ % make install
+
+DOCUMENTATION
+
+Algorithm::Simpath documentation is available as in POD. So you can do:
+
+ % perldoc Algorithm::Simpath
+
+to read the documentation online with your favorite pager.
+
+hiratara
@@ -1,6 +1,6 @@
use strict;
use warnings;
-use Simpath;
+use Algorithm::Simpath;
sub count($); sub count($) {
my $node = shift;
@@ -1,6 +1,7 @@
-package Simpath;
+package Algorithm::Simpath;
use strict;
use warnings;
+our $VERSION = '0.01';
use Exporter qw(import);
our @EXPORT = qw(solve);
@@ -146,3 +147,29 @@ sub solve($$) {
}
1;
+__END__
+
+=head1 NAME
+
+Algorithm::Simpath -
+
+=head1 SYNOPSIS
+
+ use Algorithm::Simpath;
+
+=head1 DESCRIPTION
+
+Algorithm::Simpath is
+
+=head1 AUTHOR
+
+hiratara E<lt>hiratara {at} cpan.orgE<gt>
+
+=head1 SEE ALSO
+
+=head1 LICENSE
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
View
@@ -0,0 +1,4 @@
+use strict;
+use Test::More tests => 1;
+
+BEGIN { use_ok 'Algorithm::Simpath' }
View
@@ -1,55 +1,55 @@
use strict;
use warnings;
-use Simpath;
+use Algorithm::Simpath;
use Test::More;
-is_deeply Simpath::high_node(
+is_deeply Algorithm::Simpath::high_node(
{mate => {A => "B", B => "A", C => "D", D => "C"}}, ["B", "C"]
), {mate => {A => "D", B => undef, C => undef, D => "A"}};
-is_deeply Simpath::low_node(
+is_deeply Algorithm::Simpath::low_node(
{mate => {A => "B", B => "A", C => "D", D => "C"}}, ["B", "C"]
), {mate => {A => "B", B => "A", C => "D", D => "C"}};
-is_deeply Simpath::high_node(
+is_deeply Algorithm::Simpath::high_node(
{mate => {A => "B", B => "A",}}, ["B", "C"]
), {mate => {A => "C", B => undef, C => "A"}};
-is_deeply Simpath::low_node(
+is_deeply Algorithm::Simpath::low_node(
{mate => {A => "B", B => "A",}}, ["B", "C"]
), {mate => {A => "B", B => "A", C => "C"}};
-is_deeply Simpath::high_node(
+is_deeply Algorithm::Simpath::high_node(
{mate => {A => undef, B => "D", C => undef, D => "B"}}, ["B", "D"]
), undef, "Loop detected";
-is_deeply Simpath::low_node(
+is_deeply Algorithm::Simpath::low_node(
{mate => {A => undef, B => "D", C => undef, D => "B"}}, ["B", "D"]
), {mate => {A => undef, B => "D", C => undef, D => "B"}};
-is_deeply Simpath::high_node(
+is_deeply Algorithm::Simpath::high_node(
{mate => {A => undef, B => "D", C => undef, D => "B"}}, ["D", "A"]
), undef, "cross route detected";
-is_deeply Simpath::low_node(
+is_deeply Algorithm::Simpath::low_node(
{mate => {A => undef, B => "D", C => undef, D => "B"}}, ["D", "A"]
), {mate => {A => undef, B => "D", C => undef, D => "B"}};
-ok Simpath::has_one_route(
+ok Algorithm::Simpath::has_one_route(
{mate => {"A" => "D", C => undef, D => "A"}},
"A" => "D",
);
-ok ! Simpath::has_one_route(
+ok ! Algorithm::Simpath::has_one_route(
{mate => {"A" => "B", B => "A", D => "D"}},
"A" => "B",
), "It contains unwanted routes.";
-ok ! Simpath::has_one_route(
+ok ! Algorithm::Simpath::has_one_route(
{mate => {"A" => "D", C => undef, D => "A"}},
"C" => "A",
), "Route isn't terminated.";
-ok ! Simpath::has_one_route(
+ok ! Algorithm::Simpath::has_one_route(
{mate => {}},
"C" => "A",
), "Has no route.";
-is Simpath::node_id(
+is Algorithm::Simpath::node_id(
{mate => {"A" => "D", C => undef, D => "A"}}
), "A-D C- D-A", "Route isn't terminated.";
View
@@ -0,0 +1,10 @@
+use Test::More;
+eval q{ use Test::Spelling };
+plan skip_all => "Test::Spelling is not installed." if $@;
+add_stopwords(map { split /[\s\:\-]/ } <DATA>);
+$ENV{LANG} = 'C';
+all_pod_files_spelling_ok('lib');
+__DATA__
+hiratara
+hiratara {at} cpan.org
+Algorithm::Simpath
View
@@ -0,0 +1,8 @@
+use strict;
+use Test::More;
+eval {
+ require Test::Perl::Critic;
+ Test::Perl::Critic->import( -profile => 'xt/perlcriticrc');
+};
+plan skip_all => "Test::Perl::Critic is not installed." if $@;
+all_critic_ok('lib');
View
@@ -0,0 +1,4 @@
+use Test::More;
+eval "use Test::Pod 1.00";
+plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
+all_pod_files_ok();
View
@@ -0,0 +1,2 @@
+[TestingAndDebugging::ProhibitNoStrict]
+allow=refs

0 comments on commit 0a0663b

Please sign in to comment.