File perl-CBOR-XS.spec of Package perl-CBOR-XS
#
# spec file for package perl-CBOR-XS
#
# Copyright (c) 2021 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 https://bugs.opensuse.org/
#
%define cpan_name CBOR-XS
Name: perl-CBOR-XS
Version: 1.86
Release: 0
#Upstream: CHECK(Artistic-1.0 or GPL-1.0-or-later)
Summary: Concise Binary Object Representation (CBOR, RFC7049)
License: GPL-3.0-only
URL: https://metacpan.org/release/%{cpan_name}
Source0: https://cpan.metacpan.org/authors/id/M/ML/MLEHMANN/%{cpan_name}-%{version}.tar.gz
Source1: cpanspec.yml
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(Canary::Stability)
BuildRequires: perl(ExtUtils::MakeMaker) >= 6.52
BuildRequires: perl(Types::Serialiser)
BuildRequires: perl(common::sense)
Requires: perl(Types::Serialiser)
Requires: perl(common::sense)
%{perl_requires}
%description
This module converts Perl data structures to the Concise Binary Object
Representation (CBOR) and vice versa. CBOR is a fast binary serialisation
format that aims to use an (almost) superset of the JSON data model, i.e.
when you can represent something useful in JSON, you should be able to
represent it in CBOR.
In short, CBOR is a faster and quite compact binary alternative to JSON,
with the added ability of supporting serialisation of Perl objects. (JSON
often compresses better than CBOR though, so if you plan to compress the
data later and speed is less important you might want to compare both
formats first).
The primary goal of this module is to be _correct_ and the secondary goal
is to be _fast_. To reach the latter goal it was written in C.
To give you a general idea about speed, with texts in the megabyte range,
'CBOR::XS' usually encodes roughly twice as fast as Storable or JSON::XS
and decodes about 15%-30% faster than those. The shorter the data, the
worse Storable performs in comparison.
Regarding compactness, 'CBOR::XS'-encoded data structures are usually about
20% smaller than the same data encoded as (compact) JSON or Storable.
In addition to the core CBOR data format, this module implements a number
of extensions, to support cyclic and shared data structures (see
'allow_sharing' and 'allow_cycles'), string deduplication (see
'pack_strings') and scalar references (always enabled).
See MAPPING, below, on how CBOR::XS maps perl values to CBOR values and
vice versa.
%prep
%autosetup -n %{cpan_name}-%{version}
%build
perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}"
%make_build
%check
make test
%install
%perl_make_install
%perl_process_packlist
%perl_gen_filelist
%files -f %{name}.files
%doc Changes README
%license COPYING
%changelog