File perl-MooseX-Traits.spec of Package perl-MooseX-Traits
#
# spec file for package perl-MooseX-Traits
#
# Copyright (c) 2011 SUSE LINUX Products 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 http://bugs.opensuse.org/
#
Name: perl-MooseX-Traits
Version: 0.11
Release: 0
%define cpan_name MooseX-Traits
Summary: automatically apply roles at object creation time
License: Artistic-1.0 or GPL-1.0+
Group: Development/Libraries/Perl
Url: http://search.cpan.org/dist/MooseX-Traits/
Source: http://www.cpan.org/authors/id/F/FL/FLORA/%{cpan_name}-%{version}.tar.gz
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(Class::MOP) >= 0.84
BuildRequires: perl(Moose) >= 0.84
BuildRequires: perl(Moose::Role)
BuildRequires: perl(Sub::Exporter)
BuildRequires: perl(Test::Exception)
BuildRequires: perl(namespace::autoclean)
BuildRequires: perl(ok)
#BuildRequires: perl(Foo)
#BuildRequires: perl(inc::Module::Install)
#BuildRequires: perl(JSON)
#BuildRequires: perl(LWP::Simple)
#BuildRequires: perl(Module::Build)
#BuildRequires: perl(Module::Install::AuthorRequires)
#BuildRequires: perl(Module::Install::Base)
#BuildRequires: perl(MooseX::Role::Parameterized)
#BuildRequires: perl(MooseX::Traits)
#BuildRequires: perl(MooseX::Traits::Util)
#BuildRequires: perl(Parse::CPAN::Meta)
#BuildRequires: perl(YAML::Tiny)
Requires: perl(Class::MOP) >= 0.84
Requires: perl(Moose) >= 0.84
Requires: perl(Moose::Role)
Requires: perl(namespace::autoclean)
Requires: perl(Sub::Exporter)
%{perl_requires}
%description
Often you want to create components that can be added to a class
arbitrarily. This module makes it easy for the end user to use these
components. Instead of requiring the user to create a named class with the
desired roles applied, or apply roles to the instance one-by-one, he can
just create a new class from yours with 'with_traits', and then instantiate
that.
There is also 'new_with_traits', which exists for compatibility reasons. It
accepts a 'traits' parameter, creates a new class with those traits, and
then insantiates it.
Class->new_with_traits( traits => [qw/Foo Bar/], foo => 42, bar => 1 )
returns exactly the same object as
Class->with_traits(qw/Foo Bar/)->new( foo => 42, bar => 1 )
would. But you can also store the result of 'with_traits', and call other
methods:
my $c = Class->with_traits(qw/Foo Bar/);
$c->new( foo => 42 );
$c->whatever( foo => 1234 );
And so on.
%prep
%setup -q -n %{cpan_name}-%{version}
%build
%{__perl} Makefile.PL INSTALLDIRS=vendor
%{__make} %{?_smp_mflags}
%check
%{__make} test
%install
%perl_make_install
%perl_process_packlist
%perl_gen_filelist
%files -f %{name}.files
%defattr(-,root,root,755)
%doc Changes README
%changelog