File perl-XML-Structured.spec of Package perl-XML-Structured

# spec file for package perl-XML-Structured
# Copyright (c) 2019 SUSE LLC
# 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

# define the name from CPAN
%define         cpan_name XML-Structured
Name:           perl-XML-Structured
Version:        1.3
Release:        0
Summary:        Simple conversion API from XML to perl structures and back
License:        Artistic-1.0
Group:          Development/Libraries/Perl
Source:         %{cpan_name}-%{version}.tar.gz
BuildRequires:  perl-XML-Parser
BuildRequires:  perl-XML-SAX
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  perl(Test::More)
%if 0%{?suse_version}

Provides a way to convert XML data into a predefined perl data structure and
back to XML. Unlike with modules like XML::Simple, it is an error if the XML
data does not match the provided skeleton (the "DTD").
Another advantage is that the order of the attributes and elements is taken
from the DTD when converting back to xml.

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

%if 0%{?suse_version}
perl Makefile.PL OPTIMIZE="%{optflags} -Wall"
perl Makefile.PL OPTIMIZE="%{optflags} -Wall" INSTALLDIRS=vendor
make %{?_smp_mflags}

PREFERRED_PARSER=XML::Parser make %{?_smp_mflags} test || exit 1
PREFERRED_PARSER=XML::SAX make %{?_smp_mflags} test || exit 1

%if 0%{?suse_version}
echo "%{perl_vendorarch}/auto/XML" > %{name}.files
echo "%{perl_vendorarch}/XML" >> %{name}.files
echo "%{_mandir}/man3/XML::Structured.*" >> %{name}.files
%if 0%{?fedora} || 0%{?rhel} || 0%{?centos}
%{_fixperms} %{buildroot}/*

%files -f %{name}.files