update OBS-URL: https://build.opensuse.org/request/show/297832 OBS-URL: https://build.opensuse.org/package/show/devel:languages:perl/perl-Data-Stag?expand=0&rev=7
104 lines
3.3 KiB
RPMSpec
104 lines
3.3 KiB
RPMSpec
#
|
|
# spec file for package perl-Data-Stag
|
|
#
|
|
# 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 http://bugs.opensuse.org/
|
|
#
|
|
|
|
|
|
Name: perl-Data-Stag
|
|
Version: 0.14
|
|
Release: 0
|
|
#Upstream: This module is free software. You may distribute this module under the same terms as perl itself
|
|
%define cpan_name Data-Stag
|
|
Summary: Structured Tags datastructures
|
|
License: Artistic-1.0 or GPL-1.0+
|
|
Group: Development/Libraries/Perl
|
|
Url: http://search.cpan.org/dist/Data-Stag/
|
|
Source0: http://www.cpan.org/authors/id/C/CM/CMUNGALL/%{cpan_name}-%{version}.tar.gz
|
|
Source1: cpanspec.yml
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|
BuildRequires: perl
|
|
BuildRequires: perl-macros
|
|
BuildRequires: perl(IO::String)
|
|
Requires: perl(IO::String)
|
|
%{perl_requires}
|
|
|
|
%description
|
|
This module is for manipulating data as hierarchical tag/value pairs
|
|
(Structured TAGs or Simple Tree AGgreggates). These datastructures can be
|
|
represented as nested arrays, which have the advantage of being native to
|
|
perl. A simple example is shown below:
|
|
|
|
[ person=> [ [ family_name => $family_name ],
|
|
[ given_name => $given_name ],
|
|
[ phone_no => $phone_no ] ] ],
|
|
|
|
the Data::Stag manpage uses a subset of XML for import and export. This
|
|
means the module can also be used as a general XML parser/writer (with
|
|
certain caveats).
|
|
|
|
The above set of structured tags can be represented in XML as
|
|
|
|
<person>
|
|
<family_name>...</family_name>
|
|
<given_name>...</given_name>
|
|
<phone_no>...</phone_no>
|
|
</person>
|
|
|
|
This datastructure can be examined, manipulated and exported using Stag
|
|
functions or methods:
|
|
|
|
$document = Data::Stag->parse($file);
|
|
@persons = $document->find('person');
|
|
foreach my $person (@person) {
|
|
$person->set('full_name',
|
|
$person->sget('given_name') . ' ' .
|
|
$person->sget('family_name'));
|
|
}
|
|
|
|
Advanced querying is performed by passing functions, for example:
|
|
|
|
# get all people in dataset with name starting 'A'
|
|
@persons =
|
|
$document->where('person',
|
|
sub {shift->sget('family_name') =~ /^A/});
|
|
|
|
One of the things that marks this module out against other XML modules is
|
|
this emphasis on a *functional* approach as an obect-oriented or procedural
|
|
approach.
|
|
|
|
For full information on the stag project, see the
|
|
http://stag.sourceforge.net manpage
|
|
|
|
%prep
|
|
%setup -q -n %{cpan_name}-%{version}
|
|
|
|
%build
|
|
%{__perl} Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}"
|
|
%{__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
|