From: Karen Etheridge Date: Mon, 3 Feb 2014 04:42:26 +0000 (-0800) Subject: keep namespaces clean X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d5a304d98a6c9092181f55e00551591aeba03406;p=gitmo%2FMooseX-Daemonize.git keep namespaces clean --- diff --git a/lib/MooseX/Daemonize.pm b/lib/MooseX/Daemonize.pm index 62a9c11..347cd69 100644 --- a/lib/MooseX/Daemonize.pm +++ b/lib/MooseX/Daemonize.pm @@ -5,6 +5,7 @@ package MooseX::Daemonize; use Moose::Role; use MooseX::Types::Path::Class; use File::Path qw(make_path); +use namespace::autoclean; with 'MooseX::Daemonize::WithPidFile', 'MooseX::Getopt'; diff --git a/lib/MooseX/Daemonize/Core.pm b/lib/MooseX/Daemonize/Core.pm index e7d2385..5d9bf92 100644 --- a/lib/MooseX/Daemonize/Core.pm +++ b/lib/MooseX/Daemonize/Core.pm @@ -4,8 +4,8 @@ package MooseX::Daemonize::Core; use MooseX::Getopt; # to load the NoGetopt metaclass use Moose::Role; - use POSIX (); +use namespace::autoclean; has is_daemon => ( # NOTE: diff --git a/lib/MooseX/Daemonize/Pid.pm b/lib/MooseX/Daemonize/Pid.pm index 1a92ff8..e87518a 100644 --- a/lib/MooseX/Daemonize/Pid.pm +++ b/lib/MooseX/Daemonize/Pid.pm @@ -4,6 +4,7 @@ package MooseX::Daemonize::Pid; use Moose; use Moose::Util::TypeConstraints; +use namespace::autoclean; coerce 'MooseX::Daemonize::Pid' => from 'Int' diff --git a/lib/MooseX/Daemonize/Pid/File.pm b/lib/MooseX/Daemonize/Pid/File.pm index 0f5177e..29363ea 100644 --- a/lib/MooseX/Daemonize/Pid/File.pm +++ b/lib/MooseX/Daemonize/Pid/File.pm @@ -7,6 +7,7 @@ use Moose::Util::TypeConstraints; use MooseX::Types::Path::Class; use MooseX::Getopt::OptionTypeMap; +use namespace::autoclean; # NOTE: # set up some basic coercions diff --git a/lib/MooseX/Daemonize/WithPidFile.pm b/lib/MooseX/Daemonize/WithPidFile.pm index d47ed21..28c2133 100644 --- a/lib/MooseX/Daemonize/WithPidFile.pm +++ b/lib/MooseX/Daemonize/WithPidFile.pm @@ -4,6 +4,7 @@ package MooseX::Daemonize::WithPidFile; use MooseX::Getopt; # to load the Getopt metaclass use Moose::Role; +use namespace::autoclean; use MooseX::Daemonize::Pid::File; diff --git a/lib/Test/MooseX/Daemonize.pm b/lib/Test/MooseX/Daemonize.pm index 122c4d4..dbccc44 100644 --- a/lib/Test/MooseX/Daemonize.pm +++ b/lib/Test/MooseX/Daemonize.pm @@ -3,23 +3,14 @@ use warnings; package Test::MooseX::Daemonize; # BEGIN CARGO CULTING -use Sub::Exporter; -use Test::Builder; - - -{ - my @exports = qw[ - daemonize_ok - check_test_output - ]; +use Sub::Exporter::ForMethods 'method_installer'; +use Sub::Exporter -setup => { + exports => [ qw(daemonize_ok check_test_output) ], + groups => { default => [ qw(daemonize_ok check_test_output) ] }, + installer => method_installer, +}; - Sub::Exporter::setup_exporter( - { - exports => \@exports, - groups => { default => \@exports } - } - ); -} +use Test::Builder; our $Test = Test::Builder->new; diff --git a/xt/release/clean-namespaces.t b/xt/release/clean-namespaces.t new file mode 100644 index 0000000..c096aef --- /dev/null +++ b/xt/release/clean-namespaces.t @@ -0,0 +1,9 @@ +use strict; +use warnings FATAL => 'all'; + +use Test::More; +use Test::CleanNamespaces; + +all_namespaces_clean(); + +done_testing;