File perl-MooseX-Role-Parameterized.spec of Package perl-MooseX-Role-Parameterized

# spec file for package perl-MooseX-Role-Parameterized
# 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
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

Name:           perl-MooseX-Role-Parameterized
Version:        1.08
Release:        0
#Upstream: Artistic-1.0 or GPL-1.0+
%define cpan_name MooseX-Role-Parameterized
Summary:        Roles with Composition Parameters
License:        Artistic-1.0 or GPL-1.0+
Group:          Development/Libraries/Perl
Source1:        cpanspec.yml
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  perl
BuildRequires:  perl-macros
BuildRequires:  perl(CPAN::Meta::Check) >= 0.007
BuildRequires:  perl(CPAN::Meta::Requirements)
BuildRequires:  perl(Module::Build::Tiny) >= 0.037
BuildRequires:  perl(Module::Runtime)
BuildRequires:  perl(Moose) >= 2.0300
BuildRequires:  perl(Moose::Exporter)
BuildRequires:  perl(Moose::Meta::Role)
BuildRequires:  perl(Moose::Role)
BuildRequires:  perl(Moose::Util)
BuildRequires:  perl(Moose::Util::TypeConstraints)
BuildRequires:  perl(MooseX::Role::WithOverloading)
BuildRequires:  perl(Test::Fatal)
BuildRequires:  perl(Test::Moose)
BuildRequires:  perl(Test::More) >= 0.96
BuildRequires:  perl(Test::Requires)
BuildRequires:  perl(namespace::autoclean)
BuildRequires:  perl(namespace::clean)
Requires:       perl(Module::Runtime)
Requires:       perl(Moose) >= 2.0300
Requires:       perl(Moose::Exporter)
Requires:       perl(Moose::Meta::Role)
Requires:       perl(Moose::Role)
Requires:       perl(Moose::Util)
Requires:       perl(namespace::autoclean)
Requires:       perl(namespace::clean)

Your parameterized role consists of two new things: parameter declarations
and a 'role' block.

Parameters are declared using the the /parameter manpage keyword which very
much resembles the Moose/has manpage. You can use any option that the
Moose/has manpage accepts. The default value for the 'is' option is 'ro' as
that's a very common case. Use 'is => 'bare'' if you want no accessor.
These parameters will get their values when the consuming class (or role)
uses the Moose/with manpage. A parameter object will be constructed with
these values, and passed to the 'role' block.

The 'role' block then uses the usual the Moose::Role manpage keywords to
build up a role. You can shift off the parameter object to inspect what the
consuming class provided as parameters. You use the parameters to customize
your role however you wish.

There are many possible implementations for parameterized roles (hopefully
with a consistent enough API); I believe this to be the easiest and most
flexible design. Coincidentally, Pugs originally had an eerily similar

See the MooseX::Role::Parameterized::Extending manpage for some tips on how
to extend this module.

%setup -q -n %{cpan_name}-%{version}

%{__perl} Build.PL --installdirs=vendor
./Build build --flags=%{?_smp_mflags}

./Build test

./Build install --destdir=%{buildroot} --create_packlist=0

%files -f %{name}.files