Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
devel:languages:perl:CPAN-D
perl-Data-Transfigure
perl-Data-Transfigure.spec
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File perl-Data-Transfigure.spec of Package perl-Data-Transfigure
# # spec file for package perl-Data-Transfigure # # 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-Transfigure Name: perl-Data-Transfigure Version: 1.03 Release: 0 License: MIT Summary: Performs rule-based data transfigurations of arbitrary structures URL: https://metacpan.org/release/%{cpan_name} Source0: https://cpan.metacpan.org/authors/id/T/TY/TYRRMINAL/%{cpan_name}-%{version}.tar.gz BuildArch: noarch BuildRequires: perl BuildRequires: perl-macros BuildRequires: perl(DBIx::Class) BuildRequires: perl(DBIx::Class::InflateColumn::Time) >= v0.0.1 BuildRequires: perl(DBIx::Class::Relationship::Predicate) >= 0.07 BuildRequires: perl(Data::Compare) >= 1.29 BuildRequires: perl(DateTime) BuildRequires: perl(DateTime::Duration) BuildRequires: perl(DateTime::Format::Duration::ISO8601) >= 0.008 BuildRequires: perl(JSON::Validator) >= v5.1.4 BuildRequires: perl(Module::Util) >= 1.09 BuildRequires: perl(Object::Pad) >= 0.802 BuildRequires: perl(Readonly) >= 2.05 BuildRequires: perl(String::CamelSnakeKebab) >= 0.06 BuildRequires: perl(Test2::Suite) >= 0.000155 Requires: perl(Data::Compare) >= 1.29 Requires: perl(DateTime::Format::Duration::ISO8601) >= 0.008 Requires: perl(Module::Util) >= 1.09 Requires: perl(Object::Pad) >= 0.802 Requires: perl(Readonly) >= 2.05 Requires: perl(String::CamelSnakeKebab) >= 0.06 %{perl_requires} %description 'Data::Transfigure' allows you to write reusable rules ('transfigurators') to modify parts (or all) of a data structure. There are many possible applications of this, but it was primarily written to handle converting object graphs of ORM objects into a structure that could be converted to JSON and delivered as an API endpoint response. One of the challenges of such a system is being able to reuse code because many different controllers could need to convert the an object type to the same structure, but then other controllers might need to convert that same type to a different structure. A number of transfigurator roles and classes are included with this distribution: * * Data::Transfigure::Node the root role which all transfigurators must implement * * Data::Transfigure::Default a low priority transfigurator that only applies when no other transfigurators do * * Data::Transfigure::Default::ToString a transfigurator that stringifies any value that is not otherwise transfigured * * Data::Transfigure::Type a transfigurator that matches against one or more data types * * Data::Transfigure::Type::DateTime transfigures DateTime objects to at https://en.wikipedia.org/wiki/ISO_8601 format. * * Data::Transfigure::Type::DateTime::Duration transfigures DateTime::Duration objects to at https://en.wikipedia.org/wiki/ISO_8601#Durations (duration!) format * * Data::Transfigure::Type::DBIx transfigures DBIx::Class::Row instances into hashrefs of colname->value pairs. Does not recurse across relationships * * Data::Transfigure::Type::DBIx::Recursive transfigures DBIx::Class::Row instances into hashrefs of colname->value pairs, recursing down to_one-type relationships * * Data::Transfigure::Value a transfigurator that matches against data values (exactly, by regex, or by coderef callback) * * Data::Transfigure::Position a compound transfigurator that specifies one or more locations within the data structure to apply to, in addition to whatever other criteria its transfigurator specifies * * Data::Transfigure::Tree a transfigurator that is applied to the entire data structure after all node transfigurations have been completed * * Data::Transfigure::HashKeys::CamelCase a transfigurator that converts all hash keys in the data structure to lowerCamelCase * * Data::Transfigure::HashKeys::SnakeCase a transfigurator that converts all hash keys in the data structure to snake_case * * Data::Transfigure::HashKeys::CapitalizedIDSuffix a transfigurator that converts "Id" at the end of hash keys (as results from lowerCamelCase conversion) to "ID" * * Data::Transfigure::HashFilter::Undef a transfigurator that removes key/value pairs where the value is undefined and the key matches a certain pattern * * Data::Transfigure::Tree::Merge a transfigurator that expands marked hash keys' HashRef values into the enclosing hash, overwriting common keys %prep %autosetup -n %{cpan_name}-%{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 doc README README.md %license LICENSE %changelog
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor