File perl-MooseX-Getopt.spec of Package perl-MooseX-Getopt

#
# spec file for package perl-MooseX-Getopt
#
# 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-Getopt
Version:        0.37
Release:        1
License:        GPL+ or Artistic
%define cpan_name MooseX-Getopt
Summary:        A Moose role for processing command line options
Url:            http://search.cpan.org/dist/MooseX-Getopt/
Group:          Development/Libraries/Perl
Source:         http://www.cpan.org/authors/id/B/BO/BOBTFISH/%{cpan_name}-%{version}.tar.gz
Patch1:         perl-MooseX-Getopt-use_lib.patch 
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  perl
BuildRequires:  perl-macros
BuildRequires:  perl(ExtUtils::MakeMaker)
BuildRequires:  perl(Getopt::Long) >= 2.37
BuildRequires:  perl(Getopt::Long::Descriptive) >= 0.081
BuildRequires:  perl(Moose) >= 0.56
BuildRequires:  perl(MooseX::Role::Parameterized)
BuildRequires:  perl(Test::Fatal) >= 0.003
BuildRequires:  perl(Test::More) >= 0.88
BuildRequires:  perl(Test::Requires) >= 0.05
BuildRequires:  perl(Test::Warn) >= 0.21
Requires:       perl(Getopt::Long) >= 2.37
Requires:       perl(Getopt::Long::Descriptive) >= 0.081
Requires:       perl(Moose) >= 0.56
Requires:       perl(MooseX::Role::Parameterized)
%{perl_requires}

%description
This is a role which provides an alternate constructor for creating objects
using parameters passed in from the command line.

This module attempts to DWIM as much as possible with the command line
params by introspecting your class's attributes. It will use the name of
your attribute as the command line option, and if there is a type
constraint defined, it will configure Getopt::Long to handle the option
accordingly.

You can use the trait the MooseX::Getopt::Meta::Attribute::Trait manpage or
the attribute metaclass the MooseX::Getopt::Meta::Attribute manpage to get
non-default commandline option names and aliases.

You can use the trait the MooseX::Getopt::Meta::Attribute::Trait::NoGetopt
manpage or the attribute metaclass the
MooseX::Getopt::Meta::Attribute::NoGetopt manpage to have 'MooseX::Getopt'
ignore your attribute in the commandline options.

By default, attributes which start with an underscore are not given
commandline argument support, unless the attribute's metaclass is set to
the MooseX::Getopt::Meta::Attribute manpage. If you don't want your
accessors to have the leading underscore in their name, you can do this:

  # for read/write attributes
  has '_foo' => (accessor => 'foo', ...);

  # or for read-only attributes
  has '_bar' => (reader => 'bar', ...);

This will mean that Getopt will not handle a --foo param, but your code can
still call the 'foo' method.

If your class also uses a configfile-loading role based on the
MooseX::ConfigFromFile manpage, such as the MooseX::SimpleConfig manpage,
the MooseX::Getopt manpage's 'new_with_options' will load the configfile
specified by the '--configfile' option (or the default you've given for the
configfile attribute) for you.

Options specified in multiple places follow the following precendence
order: commandline overrides configfile, which overrides explicit
new_with_options parameters.

%prep
%setup -q -n %{cpan_name}-%{version}
%if 0%{?suse_version} <= 1110
%patch1 -p1
sed -i "s|__vendorperl__|%{perl_vendorlib}|g" Makefile.PL t/*.t
%endif

%build
%{__perl} Makefile.PL INSTALLDIRS=vendor
%{__make} %{?_smp_mflags}

%check
%{__make} test

%install
%perl_make_install
%perl_process_packlist
%perl_gen_filelist

%clean
%{__rm} -rf %{buildroot}

%files -f %{name}.files
%defattr(-,root,root,755)
%doc ChangeLog LICENSE README

%changelog
openSUSE Build Service is sponsored by