[packages/perl-Context-Preserve] - new

baggins baggins at pld-linux.org
Sat Jan 25 19:22:08 CET 2014


commit b5f251d4702bdfdcf21c7a1eb54c098734b87b14
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Sat Jan 25 19:21:54 2014 +0100

    - new

 perl-Context-Preserve.spec | 73 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 73 insertions(+)
---
diff --git a/perl-Context-Preserve.spec b/perl-Context-Preserve.spec
new file mode 100644
index 0000000..877037e
--- /dev/null
+++ b/perl-Context-Preserve.spec
@@ -0,0 +1,73 @@
+#
+# Conditional build:
+%bcond_without	tests		# do not perform "make test"
+#
+%define		pdir	Context
+%define		pnam	Preserve
+%include	/usr/lib/rpm/macros.perl
+Summary:	Context::Preserve - run code after a subroutine call, preserving the context the subroutine would have seen if it were the last statement in the caller
+#Summary(pl.UTF-8):	
+Name:		perl-Context-Preserve
+Version:	0.01
+Release:	1
+# same as perl
+License:	GPL v1+ or Artistic
+Group:		Development/Languages/Perl
+Source0:	http://www.cpan.org/modules/by-authors/id/J/JR/JROCKWAY/Context-Preserve-0.01.tar.gz
+# Source0-md5:	e28c24d9e85d3f7de1c7b9a545ba991a
+URL:		http://search.cpan.org/dist/Context-Preserve/
+BuildRequires:	perl-devel >= 1:5.8.0
+BuildRequires:	rpm-perlprov >= 4.1-13
+%if %{with tests}
+BuildRequires:	perl-Test-Exception
+BuildRequires:	perl-Test-use-ok
+%endif
+BuildArch:	noarch
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+Sometimes you need to call a function, get the results, act on the
+results, then return the result of the function.  This is painful
+because of contexts; the original function can behave different if
+it's called in void, scalar, or list context.  You can ignore the
+various cases and just pick one, but that's fragile.  To do things
+right, you need to see which case you're being called in, and then
+call the function in that context.  This results in 3 code paths,
+which is a pain to type in (and maintain).
+
+This module automates the process.  You provide a coderef that is the
+"original function", and another coderef to run after the original
+runs.  You can modify the return value (aliased to @_) here, and do
+whatever else you need to do.  wantarray is correct inside both
+coderefs; in "after", though, the return value is ignored and the
+value wantarray returns is related to the context that the original
+function was called in.
+
+# %description -l pl.UTF-8
+# TODO
+
+%prep
+%setup -q -n %{pdir}-%{pnam}-%{version}
+
+%build
+%{__perl} Makefile.PL \
+	INSTALLDIRS=vendor
+%{__make}
+
+%{?with_tests:%{__make} test}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%{__make} pure_install \
+	DESTDIR=$RPM_BUILD_ROOT
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%doc Changes README
+%dir %{perl_vendorlib}/Context
+%{perl_vendorlib}/Context/Preserve.pm
+%{_mandir}/man3/*
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/perl-Context-Preserve.git/commitdiff/b5f251d4702bdfdcf21c7a1eb54c098734b87b14



More information about the pld-cvs-commit mailing list