Accepting request 1242276 from home:tinita:branches:devel:languages:perl:CPAN-S

Module for trying out future perl features

OBS-URL: https://build.opensuse.org/request/show/1242276
OBS-URL: https://build.opensuse.org/package/show/devel:languages:perl/perl-Syntax-Keyword-Defer?expand=0&rev=1
This commit is contained in:
2025-02-02 23:05:46 +00:00
committed by Git OBS Bridge
commit 1edcf77031
6 changed files with 162 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.osc

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b1f6b0be347efb355968abca961643f8e11144a9f301e81df5432795d9d63751
size 29161

35
cpanspec.yml Normal file
View File

@@ -0,0 +1,35 @@
---
#description_paragraphs: 3
#description: |-
# override description from CPAN
#summary: override summary from CPAN
#no_testing: broken upstream
#sources:
# - source1
# - source2
#patches:
# foo.patch: -p1
# bar.patch:
# baz.patch: PATCH-FIX-OPENSUSE
#preamble: |-
# BuildRequires: gcc-c++
#post_prep: |-
# hunspell=`pkg-config --libs hunspell | sed -e 's,-l,,; s, *,,g'`
# sed -i -e "s,hunspell-X,$hunspell," t/00-prereq.t Makefile.PL
#post_build: |-
# rm unused.files
#post_install: |-
# sed on %{name}.files
#license: SUSE-NonFree
#skip_noarch: 1
#custom_build: |-
#./Build build flags=%{?_smp_mflags} --myflag
#custom_test: |-
#startserver && make test
#ignore_requires: Bizarre::Module
#skip_doc: regexp_to_skip_for_doc.*
#add_doc: files to add to docs
#misc: |-
#anything else to be added to spec file
#follows directly after %files section, so it can contain new blocks or also
#changes to %files section

View File

@@ -0,0 +1,4 @@
-------------------------------------------------------------------
Sun Feb 2 22:59:49 UTC 2025 - Tina Müller <tina.mueller@suse.com>
- Initial import

View File

@@ -0,0 +1,96 @@
#
# spec file for package perl-Syntax-Keyword-Defer
#
# Copyright (c) 2025 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 Syntax-Keyword-Defer
Name: perl-Syntax-Keyword-Defer
Version: 0.110.0
Release: 0
# 0.11 -> normalize -> 0.110.0
%define cpan_version 0.11
License: Artistic-1.0 OR GPL-1.0-or-later
Summary: Execute code when leaving a block
URL: https://metacpan.org/release/%{cpan_name}
Source0: https://cpan.metacpan.org/authors/id/P/PE/PEVANS/%{cpan_name}-%{cpan_version}.tar.gz
Source1: cpanspec.yml
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(ExtUtils::CBuilder)
BuildRequires: perl(Module::Build) >= 0.4004
BuildRequires: perl(Test2::V0)
BuildRequires: perl(XS::Parse::Keyword) >= 0.13
BuildRequires: perl(XS::Parse::Keyword::Builder) >= 0.13
Requires: perl(XS::Parse::Keyword) >= 0.13
Provides: perl(Syntax::Keyword::Defer) = %{version}
%undefine __perllib_provides
%{perl_requires}
%description
This module provides a syntax plugin that implements a block which executes
when the containing scope has finished.
It similar to features provided by other languages; Swift, Zig, Jai, Nim
and Odin all provide this. Note that while Go also provides a 'defer'
keyword, the semantics here are not the same. Go's version defers until the
end of the entire function, rather than the closest enclosing scope as is
common to most other languages, and this module.
The operation can be considered a little similar to an 'END' block, but
with the following key differences:
* A 'defer' block runs at the time that execution leaves the block it is
declared inside, whereas an 'END' block runs at the end time of the entire
program regardless of its location.
* A 'defer' block is invoked at the time its containing scope has finished,
which means it might run again if the block is entered again later in the
program. An 'END' block will only ever run once.
* A 'defer' block will only take effect if execution reaches the line it is
declared on; if the line is not reached then nothing happens. An 'END'
block will always be invoked once declared, regardless of the dynamic
extent of execution at runtime.
'defer' blocks are primarily intended for cases such as resource
finalisation tasks that may be conditionally required.
For example in the synopsis code, after normal execution the statement
handle will be finished using the '$sth->finish' method, then the database
will be disconnected with '$dbh->disconnect'. If instead the prepare method
failed then the database will still be disconnected, but there is no need
to finish with the statement handle as the second 'defer' block was never
encountered.
%prep
%autosetup -n %{cpan_name}-%{cpan_version} -p1
%build
perl Build.PL --installdirs=vendor optimize="%{optflags}"
./Build build --flags=%{?_smp_mflags}
%check
./Build test
%install
./Build install --destdir=%{buildroot} --create_packlist=0
%perl_gen_filelist
%files -f %{name}.files
%doc Changes README
%license LICENSE
%changelog