Subject: | Class::MOP::load_class is deprecated |
Moose now uses Module::Runtime.
The attached patch removes the warning
and adds a basic test for ensuring the class works.
P.S. If you like I'd be happy to accept co-maint and merge this and the other patch and make a new release.
Subject: | module-runtime-for-load-class.patch |
diff --git a/Makefile.PL b/Makefile.PL
index fd2abb1..59963b8 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -21,5 +21,6 @@ WriteMakefile(
"Software::License" => '0',
"File::Spec::Functions" => '0',
"Moose" => '0',
+ "Module::Runtime" => '0',
},
);
diff --git a/lib/App/Software/License.pm b/lib/App/Software/License.pm
index de9e9fc..65c9c03 100644
--- a/lib/App/Software/License.pm
+++ b/lib/App/Software/License.pm
@@ -7,6 +7,7 @@ use Moose;
use MooseX::Types::Moose qw/Str Num Maybe/;
use File::HomeDir;
use File::Spec::Functions qw/catfile/;
+use Module::Runtime ();
use namespace::clean -except => 'meta';
@@ -61,7 +62,7 @@ has _software_license => (
sub _build__software_license {
my ($self) = @_;
my $class = "Software::License::${\$self->license}";
- Class::MOP::load_class($class);
+ Module::Runtime::require_module($class);
return $class->new({
holder => $self->holder,
year => $self->year,
diff --git a/t/basic.t b/t/basic.t
new file mode 100644
index 0000000..81c02ea
--- /dev/null
+++ b/t/basic.t
@@ -0,0 +1,19 @@
+use strict;
+use warnings;
+use Test::More tests => 1;
+
+use App::Software::License;
+
+# Make this a no-op to avoid checking the file system.
+App::Software::License->meta->make_mutable;
+App::Software::License->meta->add_around_method_modifier(
+ get_config_from_file => sub {},
+);
+App::Software::License->meta->make_immutable;
+
+local @ARGV = ('--holder=FooBar');
+
+my $app = App::Software::License->new_with_options;
+
+like $app->notice, qr/^\QThis software is Copyright (c)\E/i,
+ 'Copyright notice generated';