Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: Getty/p5-moox
base: a0a5acc19c
...
head fork: Getty/p5-moox
compare: 72f8f21f5e
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 6 files changed
  • 0 commit comments
  • 1 contributor
Commits on May 07, 2012
@Getty Added MooX::Role 28f56ac
@Getty v0.002 72f8f21
View
2  Changes
@@ -2,4 +2,6 @@ Revision history for {{$dist->name}}
{{$NEXT}}
+0.002 2012-05-07 23:00:47 Europe/Berlin
+
0.001 2012-05-07 22:27:35 Europe/Berlin
View
7 lib/MooX.pm
@@ -9,9 +9,14 @@ use Carp;
use Data::OptList;
sub import {
- my ( $self, @modules ) = @_;
+ my ( $class, @modules ) = @_;
my $target = caller;
unshift @modules, '+Moo';
+ MooX::import_base($class,$target,@modules);
+}
+
+sub import_base {
+ my ( $class, $target, @modules ) = @_;
my @optlist = @{Data::OptList::mkopt([@modules],{
must_be => [qw( ARRAY HASH )],
})};
View
49 lib/MooX/Role.pm
@@ -0,0 +1,49 @@
+package MooX::Role;
+# ABSTRACT: Using Moo::Role and MooX:: packages the most lazy way
+
+use strict;
+use warnings;
+use MooX ();
+
+sub import {
+ my ( $class, @modules ) = @_;
+ my $target = caller;
+ unshift @modules, '+Moo::Role';
+ MooX::import_base($class,$target,@modules);
+}
+
+1;
+
+=encoding utf8
+
+=head1 SYNOPSIS
+
+ package MyRole;
+
+ use MooX::Role qw(
+ Options
+ );
+
+ # use Moo::Role;
+ # use MooX::Options;
+
+=head1 DESCRIPTION
+
+Exactly the same behaviour as L<MooX>, but instead importing L<Moo>, it imports L<Moo::Role>.
+
+=head1 SEE ALSO
+
+=head2 L<Role::Tiny>
+
+=head1 SUPPORT
+
+Repository
+
+ http://github.com/Getty/p5-moox
+ Pull request and additional contributors are welcome
+
+Issue Tracker
+
+ http://github.com/Getty/p5-moox/issues
+
+
View
20 t/10-simple-with-role.t
@@ -0,0 +1,20 @@
+#!/usr/bin/perl
+package main;
+
+use strict;
+use warnings;
+use Test::More;
+
+use FindBin qw($Bin);
+use lib "$Bin/lib";
+
+our $COUNT = 0;
+
+eval "use WithRoleMooXTest;";
+
+my $withrolemooxtest = WithRoleMooXTest->new;
+
+is($COUNT,7,'Correct import functions called');
+isa_ok($withrolemooxtest,'Moo::Object');
+
+done_testing;
View
9 t/lib/RoleMooXTest.pm
@@ -0,0 +1,9 @@
+package RoleMooXTest;
+
+use MooX::Role qw(
+ A
+ B
+ C
+);
+
+1;
View
7 t/lib/WithRoleMooXTest.pm
@@ -0,0 +1,7 @@
+package WithRoleMooXTest;
+
+use Moo;
+
+with qw( RoleMooXTest );
+
+1;

No commit comments for this range

Something went wrong with that request. Please try again.