Skip to content
Browse files

Add Mouse support

  • Loading branch information...
1 parent 6af4702 commit 1b4158d29160a9d32bf07ad0444732b4f73aadc4 @hinrik hinrik committed Feb 27, 2010
View
13 lib/Hailo.pm
@@ -2,11 +2,10 @@ package Hailo;
use 5.010;
use autodie qw(open close);
-use Class::MOP;
-use Moose;
-use MooseX::StrictConstructor;
-use MooseX::Types::Moose qw/Int Str Bool HashRef/;
-use MooseX::Getopt;
+use Any::Moose;
+use Any::Moose 'X::Getopt';
+use Any::Moose 'X::Types::'.any_moose() => [qw/Int Str Bool HashRef/];
+BEGIN { eval { 'use MooseX::StrictConstructor' } if Any::Moose::moose_is_preferred }
use Module::Pluggable (
search_path => [ map { "Hailo::$_" } qw(Storage Tokenizer UI) ],
except => [
@@ -21,7 +20,7 @@ use namespace::clean -except => [ qw(meta plugins) ];
our $VERSION = '0.19';
-with qw(MooseX::Getopt::Dashes);
+with any_moose('X::Getopt::Dashes');
has help => (
traits => [qw(Getopt)],
@@ -264,7 +263,7 @@ sub _new_class {
die "Couldn't find a class name matching '$class' in plugins '@plugins'";
}
- eval { Class::MOP::load_class($pkg) };
+ eval "require $pkg";
die $@ if $@;
return $pkg->new(%$args);
View
5 lib/Hailo/Role/Arguments.pm
@@ -1,7 +1,8 @@
package Hailo::Role::Arguments;
use 5.010;
-use MooseX::Role::Strict;
-use MooseX::Types::Moose qw/HashRef/;
+use Any::Moose '::Role';
+eval 'use MooseX::Role::Strict' if Any::Moose::moose_is_preferred;
+use Any::Moose 'X::Types::'.any_moose() => [qw/HashRef/];
use namespace::clean -except => 'meta';
our $VERSION = '0.19';
View
5 lib/Hailo/Role/Storage.pm
@@ -1,7 +1,8 @@
package Hailo::Role::Storage;
use 5.010;
-use MooseX::Role::Strict;
-use MooseX::Types::Moose qw<Str Int>;
+use Any::Moose '::Role';
+eval 'use MooseX::Role::Strict' if Any::Moose::moose_is_preferred;
+use Any::Moose 'X::Types::'.any_moose() => [qw/Str Int/];
use List::Util qw<min>;
use namespace::clean -except => 'meta';
View
3 lib/Hailo/Role/Tokenizer.pm
@@ -1,6 +1,7 @@
package Hailo::Role::Tokenizer;
use 5.010;
-use MooseX::Role::Strict;
+use Any::Moose '::Role';
+eval 'use MooseX::Role::Strict' if Any::Moose::moose_is_preferred;
use namespace::clean -except => 'meta';
our $VERSION = '0.19';
View
3 lib/Hailo/Role/UI.pm
@@ -1,6 +1,7 @@
package Hailo::Role::UI;
use 5.010;
-use MooseX::Role::Strict;
+use Any::Moose '::Role';
+eval 'use MooseX::Role::Strict' if Any::Moose::moose_is_preferred;
use namespace::clean -except => 'meta';
our $VERSION = '0.19';
View
5 lib/Hailo/Storage/DBD.pm
@@ -1,8 +1,7 @@
package Hailo::Storage::DBD;
use 5.010;
-use Moose;
-use MooseX::StrictConstructor;
-use MooseX::Types::Moose qw<ArrayRef HashRef Int Str Bool>;
+use Any::Moose;
+use Any::Moose 'X::Types::'.any_moose() => [qw<ArrayRef HashRef Int Str Bool>];
use DBI;
use List::Util qw<first shuffle>;
use List::MoreUtils qw<uniq>;
View
3 lib/Hailo/Storage/DBD/Pg.pm
@@ -1,7 +1,6 @@
package Hailo::Storage::DBD::Pg;
use 5.010;
-use Moose;
-use MooseX::StrictConstructor;
+use Any::Moose;
use namespace::clean -except => 'meta';
our $VERSION = '0.19';
View
3 lib/Hailo/Storage/DBD/SQLite.pm
@@ -1,7 +1,6 @@
package Hailo::Storage::DBD::SQLite;
use 5.010;
-use Moose;
-use MooseX::StrictConstructor;
+use Any::Moose;
use namespace::clean -except => 'meta';
our $VERSION = '0.19';
View
3 lib/Hailo/Storage/DBD/mysql.pm
@@ -1,7 +1,6 @@
package Hailo::Storage::DBD::mysql;
use 5.010;
-use Moose;
-use MooseX::StrictConstructor;
+use Any::Moose;
use List::MoreUtils qw< all >;
use namespace::clean -except => 'meta';
View
2 lib/Hailo/Tokenizer/Chars.pm
@@ -1,6 +1,6 @@
package Hailo::Tokenizer::Chars;
use 5.010;
-use Moose;
+use Any::Moose;
use namespace::clean -except => 'meta';
our $VERSION = '0.19';
View
3 lib/Hailo/Tokenizer/Words.pm
@@ -1,8 +1,7 @@
package Hailo::Tokenizer::Words;
use 5.010;
use utf8;
-use Moose;
-use MooseX::StrictConstructor;
+use Any::Moose;
use namespace::clean -except => 'meta';
our $VERSION = '0.19';
View
3 lib/Hailo/UI/ReadLine.pm
@@ -1,7 +1,6 @@
package Hailo::UI::ReadLine;
use 5.010;
-use Moose;
-use MooseX::StrictConstructor;
+use Any::Moose;
use Encode 'decode';
use Hailo;
use Term::ReadLine;
View
2 script/hailo
@@ -1,7 +1,7 @@
#!/usr/bin/env perl
use 5.010;
use open qw< :encoding(utf8) :std >;
-use Moose;
+use Mouse;
use Encode qw(decode);
use Hailo;
use namespace::clean -except => 'meta';
View
5 t/usage/options-and-usage.t
@@ -98,7 +98,10 @@ for (my $i = 1; $i <= 10e10; $i += $i * 2) {
}
# new
-dies_ok { Hailo->new( qw( a b c d ) ) } "Hailo dies on unknown arguments";
+TODO: {
+ local $TODO = "Hailo doesn't die on unknown arguments with MouseX::Getop";
+ dies_ok { Hailo->new( qw( a b c d ) ) } "Hailo dies on unknown arguments";
+}
### Usage

0 comments on commit 1b4158d

Please sign in to comment.
Something went wrong with that request. Please try again.