119 lines
3.6 KiB
RPMSpec
119 lines
3.6 KiB
RPMSpec
#
|
|
# spec file for package perl-Data-Dumper-Perltidy
|
|
#
|
|
# Copyright (c) 2024 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 Data-Dumper-Perltidy
|
|
Name: perl-Data-Dumper-Perltidy
|
|
Version: 0.30.0
|
|
Release: 0
|
|
# 0.03 -> normalize -> 0.30.0
|
|
%define cpan_version 0.03
|
|
License: Artistic-1.0 OR GPL-1.0-or-later
|
|
Summary: Dump and pretty print Perl data structures
|
|
URL: https://metacpan.org/release/%{cpan_name}
|
|
Source0: https://cpan.metacpan.org/authors/id/J/JM/JMCNAMARA/%{cpan_name}-%{cpan_version}.tar.gz
|
|
Source100: README.md
|
|
BuildArch: noarch
|
|
BuildRequires: perl
|
|
BuildRequires: perl-macros
|
|
BuildRequires: perl(Perl::Tidy)
|
|
Requires: perl(Perl::Tidy)
|
|
Provides: perl(Data::Dumper::Perltidy) = %{version}
|
|
%undefine __perllib_provides
|
|
%{perl_requires}
|
|
|
|
%description
|
|
'Data::Dumper::Perltidy' encapsulates both 'Data::Dumper' and 'Perl::Tidy'
|
|
to provide a function that stringifies a Perl data structure in a pretty
|
|
printed format. See the documentation for Data::Dumper and Perl::Tidy for
|
|
further information.
|
|
|
|
Data::Dumper can be used for, among other things, stringifying complex Perl
|
|
data structures into a format that is suitable for printing and debugging.
|
|
|
|
Perl::Tidy can be used to pretty print Perl code in a consistent and
|
|
configurable manner.
|
|
|
|
Data::Dumper also provides a certain level of pretty printing via the
|
|
'$Data::Dumper::Indent' variable but it isn't quite as nice as the
|
|
Perl::Tidy output.
|
|
|
|
Let's look at an example to see how this module can be used. Say you have a
|
|
complex data structure that you wish to inspect. You can use the
|
|
'Data::Dumper::Perltidy::Dumper()' function as follows (note that the
|
|
syntax is the same as Data::Dumper):
|
|
|
|
#!/usr/bin/perl -w
|
|
|
|
use strict;
|
|
use Data::Dumper::Perltidy;
|
|
|
|
my $data = [{ title => 'This is a test header' },{ data_range =>
|
|
[ 0, 0, 3, 9 ] },{ format => 'bold' }];
|
|
|
|
print Dumper $data;
|
|
|
|
This would print out:
|
|
|
|
$VAR1 = [
|
|
{ 'title' => 'This is a test header' },
|
|
{ 'data_range' => [ 0, 0, 3, 9 ] },
|
|
{ 'format' => 'bold' }
|
|
];
|
|
|
|
By comparison the standard 'Data::Dumper::Dumper()' output would be:
|
|
|
|
$VAR1 = [
|
|
{
|
|
'title' => 'This is a test header'
|
|
},
|
|
{
|
|
'data_range' => [
|
|
0,
|
|
0,
|
|
3,
|
|
9
|
|
]
|
|
},
|
|
{
|
|
'format' => 'bold'
|
|
}
|
|
];
|
|
|
|
Which isn't too bad but if you are used to Perl::Tidy and the perltidy
|
|
utility you may prefer the 'Data::Dumper::Perltidy::Dumper()' output.
|
|
|
|
%prep
|
|
%autosetup -n %{cpan_name}-%{cpan_version}
|
|
|
|
%build
|
|
perl Makefile.PL INSTALLDIRS=vendor
|
|
%make_build
|
|
|
|
%check
|
|
make test
|
|
|
|
%install
|
|
%perl_make_install
|
|
%perl_process_packlist
|
|
%perl_gen_filelist
|
|
|
|
%files -f %{name}.files
|
|
%doc Changes README
|
|
|
|
%changelog
|