Hello community,
here is the log from the commit of package perl-MooX-Types-MooseLike for
openSUSE:Factory checked in at 2015-04-15 16:26:19
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-MooX-Types-MooseLike (Old)
and /work/SRC/openSUSE:Factory/.perl-MooX-Types-MooseLike.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-MooX-Types-MooseLike"
Changes:
--------
---
/work/SRC/openSUSE:Factory/perl-MooX-Types-MooseLike/perl-MooX-Types-MooseLike.changes
2014-09-22 09:21:36.000000000 +0200
+++
/work/SRC/openSUSE:Factory/.perl-MooX-Types-MooseLike.new/perl-MooX-Types-MooseLike.changes
2015-04-15 16:26:20.000000000 +0200
@@ -1,0 +2,11 @@
+Tue Apr 14 19:41:12 UTC 2015 - [email protected]
+
+- updated to 0.28
+ see /usr/share/doc/packages/perl-MooX-Types-MooseLike/Changes
+
+ 0.28 - 2015-02-27
+ - Refine POD (github.com/meAmidos)
+ - Bump version of Moo and Module::Runtime pre-reqs
+ - Modernize Makefile.PL
+
+-------------------------------------------------------------------
Old:
----
MooX-Types-MooseLike-0.27.tar.gz
New:
----
MooX-Types-MooseLike-0.28.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-MooX-Types-MooseLike.spec ++++++
--- /var/tmp/diff_new_pack.nwGCOc/_old 2015-04-15 16:26:20.000000000 +0200
+++ /var/tmp/diff_new_pack.nwGCOc/_new 2015-04-15 16:26:20.000000000 +0200
@@ -1,7 +1,7 @@
#
# spec file for package perl-MooX-Types-MooseLike
#
-# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
Name: perl-MooX-Types-MooseLike
-Version: 0.27
+Version: 0.28
Release: 0
%define cpan_name MooX-Types-MooseLike
Summary: some Moosish types and a type builder
@@ -29,24 +29,23 @@
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: perl
BuildRequires: perl-macros
-BuildRequires: perl(Module::Runtime) >= 0.012
-BuildRequires: perl(Moo) >= 0.09101
+BuildRequires: perl(Module::Runtime) >= 0.014
+BuildRequires: perl(Moo) >= 1.004002
BuildRequires: perl(Test::Fatal) >= 0.003
BuildRequires: perl(Test::More) >= 0.96
-Requires: perl(Module::Runtime) >= 0.012
+Requires: perl(Module::Runtime) >= 0.014
+Recommends: perl(strictures) >= 2
%{perl_requires}
%description
+This module provides a possibility to build your own set of Moose-like
+types. These custom types can then be used to describe fields in Moo-based
+classes.
+
See the MooX::Types::MooseLike::Base manpage for a list of available base
types. Its source also provides an example of how to build base types,
along with both parameterizable and non-parameterizable.
-See the MooX::Types::MooseLike::Numeric manpage for an example of how to
-build subtypes.
-
-See the MooX::Types::SetObject manpage for an example of how to build
-parameterized types.
-
%prep
%setup -q -n %{cpan_name}-%{version}
++++++ MooX-Types-MooseLike-0.27.tar.gz -> MooX-Types-MooseLike-0.28.tar.gz
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/MooX-Types-MooseLike-0.27/Changes
new/MooX-Types-MooseLike-0.28/Changes
--- old/MooX-Types-MooseLike-0.27/Changes 2014-08-19 18:40:43.000000000
+0200
+++ new/MooX-Types-MooseLike-0.28/Changes 2015-02-27 20:28:11.000000000
+0100
@@ -1,3 +1,8 @@
+0.28 - 2015-02-27
+ - Refine POD (github.com/meAmidos)
+ - Bump version of Moo and Module::Runtime pre-reqs
+ - Modernize Makefile.PL
+
0.27 - 2014-08-19
- Fix tests to not use package B (haarg)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/MooX-Types-MooseLike-0.27/META.json
new/MooX-Types-MooseLike-0.28/META.json
--- old/MooX-Types-MooseLike-0.27/META.json 2014-08-19 18:40:56.000000000
+0200
+++ new/MooX-Types-MooseLike-0.28/META.json 2015-02-27 20:28:27.000000000
+0100
@@ -4,7 +4,7 @@
"mateu - Mateu X. Hunter (cpan:MATEU) <[email protected]>"
],
"dynamic_config" : 1,
- "generated_by" : "ExtUtils::MakeMaker version 6.88, CPAN::Meta::Converter
version 2.141520",
+ "generated_by" : "ExtUtils::MakeMaker version 6.66, CPAN::Meta::Converter
version 2.133380",
"license" : [
"perl_5"
],
@@ -12,7 +12,7 @@
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
"version" : "2"
},
- "name" : "MooX-Types-MooseLike",
+ "name" : "MooX::Types::MooseLike",
"no_index" : {
"directory" : [
"t",
@@ -21,20 +21,39 @@
},
"prereqs" : {
"build" : {
- "requires" : {
- "Moo" : "0.09101",
- "Test::Fatal" : "0.003",
- "Test::More" : "0.96"
- }
+ "requires" : {}
},
"configure" : {
"requires" : {
"ExtUtils::MakeMaker" : "0"
}
},
+ "develop" : {
+ "requires" : {
+ "Moo" : "1.004002",
+ "bareword::filehandles" : "0",
+ "indirect" : "0",
+ "multidimensional" : "0",
+ "strictures" : "2"
+ }
+ },
"runtime" : {
+ "recommends" : {
+ "strictures" : "2"
+ },
+ "requires" : {
+ "Module::Runtime" : "0.014"
+ }
+ },
+ "test" : {
+ "recommends" : {
+ "CPAN::Meta" : "0",
+ "CPAN::Meta::Requirements" : "0"
+ },
"requires" : {
- "Module::Runtime" : "0.012"
+ "Moo" : "1.004002",
+ "Test::Fatal" : "0.003",
+ "Test::More" : "0.96"
}
}
},
@@ -43,10 +62,16 @@
"bugtracker" : {
"web" :
"http://rt.cpan.org/NoAuth/Bugs.html?Dist=MooX-Types-MooseLike"
},
+ "license" : [
+ "http://dev.perl.org/licenses/"
+ ],
"repository" : {
- "url" : "git://github.com/mateu/MooX-Types-MooseLike.git"
+ "type" : "git",
+ "url" : "https://github.com/mateu/MooX-Types-MooseLike.git",
+ "web" : "https://github.com/mateu/MooX-Types-MooseLike"
},
"x_IRC" : "irc://irc.perl.org/#web-simple"
},
- "version" : "0.27"
+ "version" : "0.28",
+ "x_authority" : "cpan:MATEU"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/MooX-Types-MooseLike-0.27/META.yml
new/MooX-Types-MooseLike-0.28/META.yml
--- old/MooX-Types-MooseLike-0.27/META.yml 2014-08-19 18:40:56.000000000
+0200
+++ new/MooX-Types-MooseLike-0.28/META.yml 2015-02-27 20:28:27.000000000
+0100
@@ -3,26 +3,30 @@
author:
- 'mateu - Mateu X. Hunter (cpan:MATEU) <[email protected]>'
build_requires:
- Moo: '0.09101'
- Test::Fatal: '0.003'
- Test::More: '0.96'
+ Moo: 1.004002
+ Test::Fatal: 0.003
+ Test::More: 0.96
configure_requires:
- ExtUtils::MakeMaker: '0'
+ ExtUtils::MakeMaker: 0
dynamic_config: 1
-generated_by: 'ExtUtils::MakeMaker version 6.88, CPAN::Meta::Converter version
2.141520'
+generated_by: 'ExtUtils::MakeMaker version 6.66, CPAN::Meta::Converter version
2.133380'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
- version: '1.4'
-name: MooX-Types-MooseLike
+ version: 1.4
+name: MooX::Types::MooseLike
no_index:
directory:
- t
- inc
+recommends:
+ strictures: 2
requires:
- Module::Runtime: '0.012'
+ Module::Runtime: 0.014
resources:
IRC: irc://irc.perl.org/#web-simple
bugtracker: http://rt.cpan.org/NoAuth/Bugs.html?Dist=MooX-Types-MooseLike
- repository: git://github.com/mateu/MooX-Types-MooseLike.git
-version: '0.27'
+ license: http://dev.perl.org/licenses/
+ repository: https://github.com/mateu/MooX-Types-MooseLike.git
+version: 0.28
+x_authority: cpan:MATEU
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/MooX-Types-MooseLike-0.27/Makefile.PL
new/MooX-Types-MooseLike-0.28/Makefile.PL
--- old/MooX-Types-MooseLike-0.27/Makefile.PL 2013-07-14 17:25:38.000000000
+0200
+++ new/MooX-Types-MooseLike-0.28/Makefile.PL 2015-02-27 20:04:23.000000000
+0100
@@ -1,33 +1,101 @@
use strict;
use warnings FATAL => 'all';
use 5.008001;
-use ExtUtils::MakeMaker;
-(do 'maint/Makefile.PL.include' or die $@) unless -f 'META.yml';
-my %RUN_DEPS = (
- 'Module::Runtime' => 0.012,
-);
-my %BUILD_DEPS = (
- 'Moo' => 0.091010,
- 'Test::More' => 0.96,
- 'Test::Fatal' => 0.003,
-);
-
-WriteMakefile(
- NAME => 'MooX::Types::MooseLike',
- VERSION_FROM => 'lib/MooX/Types/MooseLike.pm',
- PREREQ_PM => {
- %RUN_DEPS,
- },
- BUILD_REQUIRES => {
- %BUILD_DEPS,
+my %META = (
+ name => 'MooX::Types::MooseLike',
+ license => 'perl_5',
+ prereqs => {
+ configure => { requires => {
+ 'ExtUtils::MakeMaker' => 0,
+ } },
+ build => { requires => {
+ } },
+ test => {
+ requires => {
+ 'Test::More' => 0.96,
+ 'Test::Fatal' => 0.003,
+ 'Moo' => 1.004002,
+ },
+ recommends => {
+ 'CPAN::Meta' => 0,
+ 'CPAN::Meta::Requirements' => 0,
+ },
+ },
+ runtime => {
+ requires => {
+ 'Module::Runtime' => 0.014,
+ },
+ recommends => {
+ 'strictures' => 2,
+ },
+ },
+ develop => {
+ requires => {
+ 'strictures' => 2,
+ 'indirect' => 0,
+ 'multidimensional' => 0,
+ 'bareword::filehandles' => 0,
+ 'Moo' => 1.004002,
+ },
+ },
},
- META_ADD => {
- resources => {
- repository => 'git://github.com/mateu/MooX-Types-MooseLike.git',
- bugtracker =>
'http://rt.cpan.org/NoAuth/Bugs.html?Dist=MooX-Types-MooseLike',
- IRC => 'irc://irc.perl.org/#web-simple',
+ resources => {
+ repository => {
+ url => 'https://github.com/mateu/MooX-Types-MooseLike.git',
+ web => 'https://github.com/mateu/MooX-Types-MooseLike',
+ type => 'git',
+ },
+ x_IRC => 'irc://irc.perl.org/#web-simple',
+ bugtracker => {
+ web => 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=MooX-Types-MooseLike',
},
+ license => [ 'http://dev.perl.org/licenses/' ],
},
- LICENSE => 'perl',
+ x_authority => 'cpan:MATEU',
);
+
+my %MM_ARGS = ();
+
+## BOILERPLATE ###############################################################
+require ExtUtils::MakeMaker;
+(do 'maint/Makefile.PL.include' or die $@) unless -f 'META.yml';
+
+# have to do this since old EUMM dev releases miss the eval $VERSION line
+my $eumm_version = eval $ExtUtils::MakeMaker::VERSION;
+my $mymeta = $eumm_version >= 6.57_02;
+my $mymeta_broken = $mymeta && $eumm_version < 6.57_07;
+
+($MM_ARGS{NAME} = $META{name}) =~ s/-/::/g;
+($MM_ARGS{VERSION_FROM} = "lib/$MM_ARGS{NAME}.pm") =~ s{::}{/}g;
+$META{license} = [ $META{license} ]
+ if $META{license} && !ref $META{license};
+$MM_ARGS{LICENSE} = $META{license}[0]
+ if $META{license} && $eumm_version >= 6.30;
+$MM_ARGS{NO_MYMETA} = 1
+ if $mymeta_broken;
+$MM_ARGS{META_ADD} = { 'meta-spec' => { version => 2 }, %META }
+ unless -f 'META.yml';
+
+for (qw(configure build test runtime)) {
+ my $key = $_ eq 'runtime' ? 'PREREQ_PM' : uc $_.'_REQUIRES';
+ my $r = $MM_ARGS{$key} = {
+ %{$META{prereqs}{$_}{requires} || {}},
+ %{delete $MM_ARGS{$key} || {}},
+ };
+ defined $r->{$_} or delete $r->{$_} for keys %$r;
+}
+
+$MM_ARGS{MIN_PERL_VERSION} = delete $MM_ARGS{PREREQ_PM}{perl} || 0;
+
+delete $MM_ARGS{MIN_PERL_VERSION}
+ if $eumm_version < 6.47_01;
+$MM_ARGS{BUILD_REQUIRES} = {%{$MM_ARGS{BUILD_REQUIRES}}, %{delete
$MM_ARGS{TEST_REQUIRES}}}
+ if $eumm_version < 6.63_03;
+$MM_ARGS{PREREQ_PM} = {%{$MM_ARGS{PREREQ_PM}}, %{delete
$MM_ARGS{BUILD_REQUIRES}}}
+ if $eumm_version < 6.55_01;
+delete $MM_ARGS{CONFIGURE_REQUIRES}
+ if $eumm_version < 6.51_03;
+
+ExtUtils::MakeMaker::WriteMakefile(%MM_ARGS);
+## END BOILERPLATE ###########################################################
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/MooX-Types-MooseLike-0.27/README
new/MooX-Types-MooseLike-0.28/README
--- old/MooX-Types-MooseLike-0.27/README 2014-08-19 18:40:56.000000000
+0200
+++ new/MooX-Types-MooseLike-0.28/README 2015-02-27 20:28:27.000000000
+0100
@@ -2,55 +2,102 @@
MooX::Types::MooseLike - some Moosish types and a type builder
SYNOPSIS
- package MyApp::Types;
- use MooX::Types::MooseLike;
- use base qw(Exporter);
- our @EXPORT_OK = ();
-
- # Define some types
- my $defs = [{
- name => 'MyType',
- test => sub { predicate($_[0]) },
- message => sub { "$_[0] is not the type we want!" }
+ package MyApp::Types;
+ use MooX::Types::MooseLike;
+ use base qw(Exporter);
+ our @EXPORT_OK = ();
+
+ # Define some types
+ my $defs = [{
+ name => 'MyType',
+ test => sub { predicate($_[0]) },
+ message => sub { "$_[0] is not the type we want!" }
+ },
+ {
+ name => 'VarChar',
+ test => sub {
+ my ($value, $param) = @_;
+ length($value) <= $param;
},
- {
- name => 'VarChar',
- test => sub {
- my ($value, $param) = @_;
- length($value) <= $param;
- },
- message => sub { "$_[0] is too large! It should be less than or
equal to $_[1]." }
- }];
+ message => sub { "$_[0] is too large! It should be less than or equal
to $_[1]." }
+ }];
- # Make the types available - this adds them to @EXPORT_OK
automatically.
- MooX::Types::MooseLike::register_types($defs, __PACKAGE__);
+ # Make the types available - this adds them to @EXPORT_OK automatically.
+ MooX::Types::MooseLike::register_types($defs, __PACKAGE__);
- ...
+ ...
- # Somewhere in code that uses the type
- package MyApp::Foo;
- use Moo;
- use MyApp::Types qw(MyType VarChar);
- has attribute => (
- is => 'ro',
- isa => MyType,
- );
-
- has string => (
- is => 'ro',
- isa => VarChar[25]
- );
+ # Somewhere in code that uses the type
+ package MyApp::Foo;
+ use Moo;
+ use MyApp::Types qw(MyType VarChar);
+
+ has attribute => (
+ is => 'ro',
+ isa => MyType,
+ );
+
+ has string => (
+ is => 'ro',
+ isa => VarChar[25]
+ );
DESCRIPTION
+ This module provides a possibility to build your own set of Moose-like
+ types. These custom types can then be used to describe fields in
+ Moo-based classes.
+
See MooX::Types::MooseLike::Base for a list of available base types. Its
source also provides an example of how to build base types, along with
both parameterizable and non-parameterizable.
- See MooX::Types::MooseLike::Numeric for an example of how to build
- subtypes.
+SEE ALSO
+ MooX::Types::MooseLike::Numeric - an example of building subtypes.
+
+ MooX::Types::SetObject - an example of building parameterized types.
+
+ MooX::Types::MooseLike::Email, MooX::Types::MooseLike::DateTime
+
+ Type::Tiny - another implementation of type constraints. Compatible with
+ Moo, Moose and Mouse.
+
+FUNCTIONS
+ register_types
+ register_types( types, package, moose_namespace )
+
+ Install the given types within the package. This makes the types
+ automatically exportable by adding them to @EXPORT_OK of the package.
+ Types are expected to be an array ref where every type is of the
+ following format:
+
+ {
+ name => 'MyType',
+ test => sub { check_the_value_somehow($_[0]) },
+ message => sub { "$_[0] is not the type we want!" },
+ parameterizable => sub { ... }, # Optional
+ inflate => sub { ... }, # Optional
+ }
+
+ exception_message
+ exception_message( value, part_of_the_exception_string )
+
+ Helper function to be used in a type definition:
+
+ {
+ ...
+ message => sub { return exception_message($_[0], 'a HashRef' },
+ ...
+ }
+
+ In the event of <value> mismatching the type constraints it produces the
+ message:
+
+ "<value> is not a HashRef!"
+
+ inflate_type
+ inflate_type( coderef )
- See MooX::Types::SetObject for an example of how to build parameterized
- types.
+ Inflates the type to a Moose type. Requires Moose.
AUTHOR
mateu - Mateu X. Hunter (cpan:MATEU) <[email protected]>
@@ -70,7 +117,7 @@
Graham Knop (cpan:HAARG) <[email protected]>
COPYRIGHT
- Copyright (c) 2011-2013 the MooX::Types::MooseLike "AUTHOR" and
+ Copyright (c) 2011-2015 the MooX::Types::MooseLike "AUTHOR" and
"CONTRIBUTORS" as listed above.
LICENSE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/MooX-Types-MooseLike-0.27/lib/MooX/Types/MooseLike/Base.pm
new/MooX-Types-MooseLike-0.28/lib/MooX/Types/MooseLike/Base.pm
--- old/MooX-Types-MooseLike-0.27/lib/MooX/Types/MooseLike/Base.pm
2014-08-19 18:38:28.000000000 +0200
+++ new/MooX-Types-MooseLike-0.28/lib/MooX/Types/MooseLike/Base.pm
2015-02-27 20:10:19.000000000 +0100
@@ -7,7 +7,7 @@
use Exporter 5.57 'import';
our @EXPORT_OK = ();
-our $VERSION = 0.27;
+our $VERSION = 0.28;
# These types act like those found in Moose::Util::TypeConstraints.
# Generally speaking, the same test is used.
@@ -70,9 +70,9 @@
},
{
name => 'Num',
- test => sub {
+ test => sub {
my $val = $_[0];
- defined $val and
+ defined $val and
($val =~ /\A[+-]?[0-9]+\z/) ||
( $val =~ /\A(?:[+-]?) # matches optional +- in the
beginning
(?=[0-9]|\.[0-9]) # matches previous +- only if there
is something like 3 or .3
@@ -367,6 +367,7 @@
},
);
}
+
sub type_definitions {
return
[
@@ -391,27 +392,28 @@
=head1 NAME
-MooX::Types::MooseLike::Base - Moose like types for Moo
+MooX::Types::MooseLike::Base - A set of basic Moose-like types for Moo
=head1 SYNOPSIS
- package MyPackage;
- use Moo;
- use MooX::Types::MooseLike::Base qw(:all);
-
- has "beers_by_day_of_week" => (
- isa => HashRef
- );
- has "current_BAC" => (
- isa => Num
- );
-
- # Also supporting is_$type. For example, is_Int() can be used as follows
- has 'legal_age' => (
- is => 'ro',
- isa => sub { die "$_[0] is not of legal age"
- unless (is_Int($_[0]) && $_[0] > 17) },
- );
+ package MyPackage;
+ use Moo;
+ use MooX::Types::MooseLike::Base qw(:all);
+
+ has "beers_by_day_of_week" => (
+ isa => HashRef
+ );
+
+ has "current_BAC" => (
+ isa => Num
+ );
+
+ # Also supporting is_$type. For example, is_Int() can be used as follows
+ has 'legal_age' => (
+ is => 'ro',
+ isa => sub { die "$_[0] is not of legal age"
+ unless (is_Int($_[0]) && $_[0] > 17) },
+ );
=head1 DESCRIPTION
@@ -420,18 +422,18 @@
One can import all types with ':all' tag or import
a list of types like:
- use MooX::Types::MooseLike::Base qw/HashRef ArrayRef/;
+ use MooX::Types::MooseLike::Base qw/HashRef ArrayRef/;
so one could then declare some attributes like:
- has 'contact' => (
- is => 'ro',
- isa => HashRef,
- );
- has 'guest_list' => (
- is => 'ro',
- isa => ArrayRef[HashRef],
- );
+ has 'contact' => (
+ is => 'ro',
+ isa => HashRef,
+ );
+ has 'guest_list' => (
+ is => 'ro',
+ isa => ArrayRef[HashRef],
+ );
These types provide a check that the I<contact> attribute is a C<hash>
reference,
and that the I<guest_list> is an C<array of hash> references.
@@ -518,7 +520,7 @@
=head3 HashRef
-=head3 ScalarRef
+=head3 ScalarRef
=head3 Maybe
@@ -537,28 +539,27 @@
=head3 AllOf
-Check if the attribute is all of the listed types (think intersection)
+Check if the attribute is all of the listed types (think intersection).
Takes a list of types as the argument. For example:
isa => AllOf[
- InstanceOf['Human'],
- ConsumerOf['Air'],
+ InstanceOf['Human'],
+ ConsumerOf['Air'],
HasMethods['breath', 'dance']
],
-
=head2 Parameterizing Types With (Multiple) Strings
In addition, we have some parameterized types that take string arguments.
=head3 InstanceOf
-Check if the attribute is an object instance of one or more classes.
+Check if the attribute is an object instance of one or more classes.
Uses C<blessed> and C<isa> to do so.
Takes a list of class names as the argument. For example:
isa => InstanceOf['MyClass','MyOtherClass']
-
+
Note: InstanceOf is passed an ArrayRef[Str]
=head3 ConsumerOf
@@ -567,7 +568,7 @@
Uses C<blessed> and C<does> to do so.
Takes a list of role names as the arguments. For example:
- isa => ConsumerOf['My::Role', 'My::AnotherRole']
+ isa => ConsumerOf['My::Role', 'My::AnotherRole']
=head3 HasMethods
@@ -584,6 +585,14 @@
isa => Enum['rock', 'spock', 'paper', 'lizard', 'scissors']
+=head1 SEE ALSO
+
+L<MooX::Types::MooseLike::Numeric> - an example of building subtypes.
+
+L<MooX::Types::SetObject> - an example of building parameterized types.
+
+L<MooX::Types::MooseLike::Email>, L<MooX::Types::MooseLike::DateTime>
+
=head1 AUTHOR
Mateu Hunter C<[email protected]>
@@ -594,7 +603,7 @@
=head1 COPYRIGHT
-Copyright 2011-2013 Mateu Hunter
+Copyright 2011-2015 Mateu Hunter
=head1 LICENSE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/MooX-Types-MooseLike-0.27/lib/MooX/Types/MooseLike.pm
new/MooX-Types-MooseLike-0.28/lib/MooX/Types/MooseLike.pm
--- old/MooX-Types-MooseLike-0.27/lib/MooX/Types/MooseLike.pm 2014-08-19
18:38:18.000000000 +0200
+++ new/MooX-Types-MooseLike-0.28/lib/MooX/Types/MooseLike.pm 2015-02-27
20:09:38.000000000 +0100
@@ -8,7 +8,7 @@
use Carp qw(confess croak);
use List::Util qw(first);
-our $VERSION = '0.27';
+our $VERSION = '0.28';
sub register_types {
my ($type_definitions, $into, $moose_namespace) = @_;
@@ -166,54 +166,100 @@
=head1 SYNOPSIS
- package MyApp::Types;
- use MooX::Types::MooseLike;
- use base qw(Exporter);
- our @EXPORT_OK = ();
-
- # Define some types
- my $defs = [{
- name => 'MyType',
- test => sub { predicate($_[0]) },
- message => sub { "$_[0] is not the type we want!" }
+ package MyApp::Types;
+ use MooX::Types::MooseLike;
+ use base qw(Exporter);
+ our @EXPORT_OK = ();
+
+ # Define some types
+ my $defs = [{
+ name => 'MyType',
+ test => sub { predicate($_[0]) },
+ message => sub { "$_[0] is not the type we want!" }
+ },
+ {
+ name => 'VarChar',
+ test => sub {
+ my ($value, $param) = @_;
+ length($value) <= $param;
},
- {
- name => 'VarChar',
- test => sub {
- my ($value, $param) = @_;
- length($value) <= $param;
- },
- message => sub { "$_[0] is too large! It should be less than or equal to
$_[1]." }
- }];
+ message => sub { "$_[0] is too large! It should be less than or equal to
$_[1]." }
+ }];
- # Make the types available - this adds them to @EXPORT_OK automatically.
- MooX::Types::MooseLike::register_types($defs, __PACKAGE__);
+ # Make the types available - this adds them to @EXPORT_OK automatically.
+ MooX::Types::MooseLike::register_types($defs, __PACKAGE__);
- ...
+ ...
+
+ # Somewhere in code that uses the type
+ package MyApp::Foo;
+ use Moo;
+ use MyApp::Types qw(MyType VarChar);
+
+ has attribute => (
+ is => 'ro',
+ isa => MyType,
+ );
- # Somewhere in code that uses the type
- package MyApp::Foo;
- use Moo;
- use MyApp::Types qw(MyType VarChar);
- has attribute => (
- is => 'ro',
- isa => MyType,
- );
-
- has string => (
- is => 'ro',
- isa => VarChar[25]
- );
+ has string => (
+ is => 'ro',
+ isa => VarChar[25]
+ );
=head1 DESCRIPTION
-See L<MooX::Types::MooseLike::Base> for a list of available base types.
-Its source also provides an example of how to build base types, along
-with both parameterizable and non-parameterizable.
+This module provides a possibility to build your own set of Moose-like types.
These custom types can then be used to describe fields in Moo-based classes.
+
+See L<MooX::Types::MooseLike::Base> for a list of available base types.
+Its source also provides an example of how to build base types, along with
both parameterizable and non-parameterizable.
+
+=head1 SEE ALSO
+
+L<MooX::Types::MooseLike::Numeric> - an example of building subtypes.
+
+L<MooX::Types::SetObject> - an example of building parameterized types.
+
+L<MooX::Types::MooseLike::Email>, L<MooX::Types::MooseLike::DateTime>
+
+L<Type::Tiny> - another implementation of type constraints. Compatible with
L<Moo>, L<Moose> and L<Mouse>.
+
+=head1 FUNCTIONS
+
+=head2 register_types
+
+B<register_types( types, package, moose_namespace )>
+
+Install the given types within the package. This makes the types automatically
exportable by adding them to @EXPORT_OK of the package. Types are expected to
be an array ref where every type is of the following format:
+
+ {
+ name => 'MyType',
+ test => sub { check_the_value_somehow($_[0]) },
+ message => sub { "$_[0] is not the type we want!" },
+ parameterizable => sub { ... }, # Optional
+ inflate => sub { ... }, # Optional
+ }
+
+=head2 exception_message
+
+B<exception_message( value, part_of_the_exception_string )>
+
+Helper function to be used in a type definition:
+
+ {
+ ...
+ message => sub { return exception_message($_[0], 'a HashRef' },
+ ...
+ }
+
+In the event of <value> mismatching the type constraints it produces the
message:
+
+ "<value> is not a HashRef!"
+
+=head2 inflate_type
-See L<MooX::Types::MooseLike::Numeric> for an example of how to build subtypes.
+B<inflate_type( coderef )>
-See L<MooX::Types::SetObject> for an example of how to build parameterized
types.
+Inflates the type to a Moose type. Requires Moose.
=head1 AUTHOR
@@ -235,7 +281,7 @@
=head1 COPYRIGHT
-Copyright (c) 2011-2013 the MooX::Types::MooseLike L</AUTHOR> and
+Copyright (c) 2011-2015 the MooX::Types::MooseLike L</AUTHOR> and
L</CONTRIBUTORS> as listed above.
=head1 LICENSE