r54799 - in /trunk/libscope-guard-perl: ./ debian/ debian/source/ lib/Scope/ t/
ansgar-guest at users.alioth.debian.org
ansgar-guest at users.alioth.debian.org
Fri Mar 26 05:24:28 UTC 2010
Author: ansgar-guest
Date: Fri Mar 26 05:24:18 2010
New Revision: 54799
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=54799
Log:
* New upstream release.
* Use source format 3.0 (quilt).
* Convert debian/copyright to proposed machine-readable format.
* Refresh rules for debhelper 7.
* debian/control: Make build-dep on perl unversioned.
* Bump Standards-Version to 3.8.4.
* Add myself to Uploaders.
Added:
trunk/libscope-guard-perl/debian/source/
trunk/libscope-guard-perl/debian/source/format
trunk/libscope-guard-perl/t/guard.t
- copied unchanged from r54798, branches/upstream/libscope-guard-perl/current/t/guard.t
trunk/libscope-guard-perl/t/new.t
- copied unchanged from r54798, branches/upstream/libscope-guard-perl/current/t/new.t
trunk/libscope-guard-perl/t/scope_guard.t
- copied unchanged from r54798, branches/upstream/libscope-guard-perl/current/t/scope_guard.t
Removed:
trunk/libscope-guard-perl/t/Scope-Guard.t
Modified:
trunk/libscope-guard-perl/Changes
trunk/libscope-guard-perl/MANIFEST
trunk/libscope-guard-perl/META.yml
trunk/libscope-guard-perl/Makefile.PL
trunk/libscope-guard-perl/README
trunk/libscope-guard-perl/debian/changelog
trunk/libscope-guard-perl/debian/compat
trunk/libscope-guard-perl/debian/control
trunk/libscope-guard-perl/debian/copyright
trunk/libscope-guard-perl/debian/rules
trunk/libscope-guard-perl/lib/Scope/Guard.pm
Modified: trunk/libscope-guard-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libscope-guard-perl/Changes?rev=54799&op=diff
==============================================================================
--- trunk/libscope-guard-perl/Changes (original)
+++ trunk/libscope-guard-perl/Changes Fri Mar 26 05:24:18 2010
@@ -1,4 +1,10 @@
Revision history for Perl extension Scope::Guard.
+
+0.11 Thu Mar 25 22:08:05 2010
+ - doc tweak
+
+0.10 Thu Mar 25 20:14:25 2010
+ - add guard() and scope_guard() - thanks Tim Bunce
0.03 Sun Jan 7 19:19:17 2007
- POD fix (thanks Craig Manley)
Modified: trunk/libscope-guard-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libscope-guard-perl/MANIFEST?rev=54799&op=diff
==============================================================================
--- trunk/libscope-guard-perl/MANIFEST (original)
+++ trunk/libscope-guard-perl/MANIFEST Fri Mar 26 05:24:18 2010
@@ -1,9 +1,11 @@
Changes
-MANIFEST
+lib/Scope/Guard.pm
+Makefile.PL
+MANIFEST This list of files
META.yml
-Makefile.PL
README
-lib/Scope/Guard.pm
-t/Scope-Guard.t
+t/guard.t
+t/new.t
t/pod.t
t/pod_coverage.t
+t/scope_guard.t
Modified: trunk/libscope-guard-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libscope-guard-perl/META.yml?rev=54799&op=diff
==============================================================================
--- trunk/libscope-guard-perl/META.yml (original)
+++ trunk/libscope-guard-perl/META.yml Fri Mar 26 05:24:18 2010
@@ -1,11 +1,20 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
-name: Scope-Guard
-version: 0.03
-version_from: lib/Scope/Guard.pm
-installdirs: site
+--- #YAML:1.0
+name: Scope-Guard
+version: 0.11
+abstract: lexically scoped resource management
+author:
+ - chocolateboy <chocolate at cpan.org>
+license: unknown
+distribution_type: module
+configure_requires:
+ ExtUtils::MakeMaker: 0
requires:
- Test::More: 0
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.17
+ Test::More: 0
+no_index:
+ directory:
+ - t
+ - inc
+generated_by: ExtUtils::MakeMaker version 6.48
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
Modified: trunk/libscope-guard-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libscope-guard-perl/Makefile.PL?rev=54799&op=diff
==============================================================================
--- trunk/libscope-guard-perl/Makefile.PL (original)
+++ trunk/libscope-guard-perl/Makefile.PL Fri Mar 26 05:24:18 2010
@@ -1,14 +1,17 @@
use 5.006001;
+
+use strict;
+use warnings;
+
use ExtUtils::MakeMaker;
-# See lib/ExtUtils/MakeMaker.pm for details of how to influence
-# the contents of the Makefile that is written.
+
WriteMakefile(
NAME => 'Scope::Guard',
VERSION_FROM => 'lib/Scope/Guard.pm', # finds $VERSION
PREREQ_PM => {
- 'Test::More' => 0,
- }, # e.g., Module::Name => 1.1
+ 'Test::More' => 0,
+ },
($] >= 5.005 ? ## Add these new keywords supported since 5.005
(ABSTRACT_FROM => 'lib/Scope/Guard.pm', # retrieve abstract from module
- AUTHOR => 'chocolateboy <chocolate.boy at email.com>') : ()),
+ AUTHOR => 'chocolateboy <chocolate at cpan.org>') : ()),
);
Modified: trunk/libscope-guard-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libscope-guard-perl/README?rev=54799&op=diff
==============================================================================
--- trunk/libscope-guard-perl/README (original)
+++ trunk/libscope-guard-perl/README Fri Mar 26 05:24:18 2010
@@ -1,4 +1,4 @@
-Scope-Guard version 0.03
+Scope-Guard version 0.11
========================
This module provides a convenient way to perform cleanup or other forms of resource
@@ -21,7 +21,7 @@
COPYRIGHT AND LICENCE
-Copyright (c) 2005-2007 by chocolateboy <chocolate.boy at email.com>
+Copyright (c) 2005-2010 by chocolateboy <chocolate at cpan.org>
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.6 or,
Modified: trunk/libscope-guard-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libscope-guard-perl/debian/changelog?rev=54799&op=diff
==============================================================================
--- trunk/libscope-guard-perl/debian/changelog (original)
+++ trunk/libscope-guard-perl/debian/changelog Fri Mar 26 05:24:18 2010
@@ -1,16 +1,23 @@
-libscope-guard-perl (0.03-3) UNRELEASED; urgency=low
+libscope-guard-perl (0.11-1) unstable; urgency=low
[ gregor herrmann ]
* debian/control: Changed: Switched Vcs-Browser field to ViewSVN
(source stanza).
+ * Change my email address.
[ Nathan Handler ]
* debian/watch: Update to ignore development releases.
- [ gregor herrmann ]
- * Change my email address.
+ [ Ansgar Burchardt ]
+ * New upstream release.
+ * Use source format 3.0 (quilt).
+ * Convert debian/copyright to proposed machine-readable format.
+ * Refresh rules for debhelper 7.
+ * debian/control: Make build-dep on perl unversioned.
+ * Bump Standards-Version to 3.8.4.
+ * Add myself to Uploaders.
- -- gregor herrmann <gregoa at debian.org> Sun, 16 Nov 2008 20:46:47 +0100
+ -- Ansgar Burchardt <ansgar at 43-1.org> Fri, 26 Mar 2010 14:22:13 +0900
libscope-guard-perl (0.03-2) unstable; urgency=low
Modified: trunk/libscope-guard-perl/debian/compat
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libscope-guard-perl/debian/compat?rev=54799&op=diff
==============================================================================
--- trunk/libscope-guard-perl/debian/compat (original)
+++ trunk/libscope-guard-perl/debian/compat Fri Mar 26 05:24:18 2010
@@ -1,1 +1,1 @@
-5
+7
Modified: trunk/libscope-guard-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libscope-guard-perl/debian/control?rev=54799&op=diff
==============================================================================
--- trunk/libscope-guard-perl/debian/control (original)
+++ trunk/libscope-guard-perl/debian/control Fri Mar 26 05:24:18 2010
@@ -1,13 +1,14 @@
Source: libscope-guard-perl
Section: perl
Priority: optional
-Build-Depends: debhelper (>= 5.0.0)
-Build-Depends-Indep: perl (>= 5.8.8-7), libtest-pod-perl,
+Build-Depends: debhelper (>= 7)
+Build-Depends-Indep: perl, libtest-pod-perl,
libtest-pod-coverage-perl
Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
Uploaders: Krzysztof Krzyzaniak (eloy) <eloy at debian.org>,
- gregor herrmann <gregoa at debian.org>
-Standards-Version: 3.7.3
+ gregor herrmann <gregoa at debian.org>,
+ Ansgar Burchardt <ansgar at 43-1.org>
+Standards-Version: 3.8.4
Homepage: http://search.cpan.org/dist/Scope-Guard/
Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libscope-guard-perl/
Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libscope-guard-perl/
@@ -15,7 +16,7 @@
Package: libscope-guard-perl
Architecture: all
Depends: ${perl:Depends}, ${misc:Depends},
-Description: lexically scoped resource management
+Description: lexically scoped resource management
Scope::Guear provides a convenient way to perform cleanup or other forms of
resource management at the end of a scope. It is particularly useful when
dealing with exceptions.
Modified: trunk/libscope-guard-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libscope-guard-perl/debian/copyright?rev=54799&op=diff
==============================================================================
--- trunk/libscope-guard-perl/debian/copyright (original)
+++ trunk/libscope-guard-perl/debian/copyright Fri Mar 26 05:24:18 2010
@@ -1,24 +1,28 @@
-This is the debian package for the Scope-Guard module.
-It was created by Krzysztof Krzyzaniak (eloy) <eloy at debian.org> using dh-make-perl.
+Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=135
+Maintainer: chocolateboy <chocolate at cpan.org>
+Source: http://search.cpan.org/dist/Scope-Guard/
+Name: Scope-Guard
-Upstream source location: http://search.cpan.org/dist/Scope-Guard/
+Copyright: © 2005-2010, chocolateboy <chocolate at cpan.org>
+License: Artistic or GPL-1+
-The upstream author is: chocolateboy, <chocolate.boy at email.com>.
+Files: debian/*
+Copyright:
+ © 2007, Krzysztof Krzyzaniak (eloy) <eloy at debian.org>
+ © 2008, gregor herrmann <gregoa at debian.org>
+ © 2010, Ansgar Burchardt <ansgar at 43-1.org>
+License: Artistic or GPL-1+
+License: Artistic
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the Artistic License, which comes with Perl.
+ On Debian GNU/Linux systems, the complete text of the Artistic License
+ can be found in `/usr/share/common-licenses/Artistic'
-Copyright (c) 2005-2007, chocolateboy.
-
-This program is free software, you can redistribute it and/or modify it under
-the same terms as Perl itself.
-
-Perl is distributed under licenses:
-
- a) the GNU General Public License as published by the Free Software
- Foundation; either version 1, or (at your option) any later
- version, or
-
- b) the "Artistic License" which comes with Perl.
-
+License: GPL-1+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 1, or (at your option)
+ any later version.
On Debian GNU/Linux systems, the complete text of the GNU General
- Public License can be found in /usr/share/common-licenses/GPL' and
- the Artistic Licence in /usr/share/common-licenses/Artistic'.
+ Public License can be found in `/usr/share/common-licenses/GPL'
Modified: trunk/libscope-guard-perl/debian/rules
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libscope-guard-perl/debian/rules?rev=54799&op=diff
==============================================================================
--- trunk/libscope-guard-perl/debian/rules (original)
+++ trunk/libscope-guard-perl/debian/rules Fri Mar 26 05:24:18 2010
@@ -1,71 +1,3 @@
#!/usr/bin/make -f
-# This debian/rules file is provided as a template for normal perl
-# packages. It was created by Marc Brockschmidt <marc at dch-faq.de> for
-# the Debian Perl Group (http://pkg-perl.alioth.debian.org/) but may
-# be used freely wherever it is useful.
-
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
-
-# If set to a true value then MakeMaker's prompt function will
-# always return the default without waiting for user input.
-export PERL_MM_USE_DEFAULT=1
-
-PACKAGE=$(shell dh_listpackages)
-
-ifndef PERL
-PERL = /usr/bin/perl
-endif
-
-TMP =$(CURDIR)/debian/$(PACKAGE)
-
-build: build-stamp
-build-stamp:
- dh_testdir
-
- $(PERL) Makefile.PL INSTALLDIRS=vendor
- $(MAKE)
- $(MAKE) test
-
- touch $@
-
-clean:
- dh_testdir
- dh_testroot
-
- dh_clean build-stamp install-stamp
- # Add commands to clean up after the build process here
- [ ! -f Makefile ] || $(MAKE) realclean
-
-install: install-stamp
-install-stamp: build-stamp
- dh_testdir
- dh_testroot
- dh_clean -k
-
- $(MAKE) install DESTDIR=$(TMP) PREFIX=/usr
- [ ! -d $(TMP)/usr/lib/perl5 ] || rmdir --ignore-fail-on-non-empty --parents --verbose $(TMP)/usr/lib/perl5
-
- touch $@
-
-binary-arch:
-# We have nothing to do here for an architecture-independent package
-
-binary-indep: build install
- dh_testdir
- dh_testroot
- dh_installdocs
- dh_installchangelogs Changes
- dh_perl
- dh_compress
- dh_fixperms
- dh_installdeb
- dh_gencontrol
- dh_md5sums
- dh_builddeb
-
-source diff:
- @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary
+%:
+ dh $@
Added: trunk/libscope-guard-perl/debian/source/format
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libscope-guard-perl/debian/source/format?rev=54799&op=file
==============================================================================
--- trunk/libscope-guard-perl/debian/source/format (added)
+++ trunk/libscope-guard-perl/debian/source/format Fri Mar 26 05:24:18 2010
@@ -1,0 +1,1 @@
+3.0 (quilt)
Modified: trunk/libscope-guard-perl/lib/Scope/Guard.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libscope-guard-perl/lib/Scope/Guard.pm?rev=54799&op=diff
==============================================================================
--- trunk/libscope-guard-perl/lib/Scope/Guard.pm (original)
+++ trunk/libscope-guard-perl/lib/Scope/Guard.pm Fri Mar 26 05:24:18 2010
@@ -3,13 +3,15 @@
use strict;
use warnings;
-use vars qw($VERSION);
+use Exporter ();
-$VERSION = '0.03';
+our @ISA = qw(Exporter);
+our @EXPORT_OK = qw(guard scope_guard);
+our $VERSION = '0.11';
sub new {
my $class = shift;
- my $handler = shift() || die "Scope::Guard::new: no handler supplied";
+ my $handler = shift() || die 'Scope::Guard::new: no handler supplied';
my $ref = ref $handler || '';
die "Scope::Guard::new: invalid handler - expected CODE ref, got: '$ref'"
@@ -24,6 +26,9 @@
$self->[0] = $dismiss;
}
+
+sub guard(&) { __PACKAGE__->new(shift) }
+sub scope_guard($) { __PACKAGE__->new(shift) }
sub DESTROY {
my $self = shift;
@@ -44,84 +49,136 @@
=head1 SYNOPSIS
- my $sg = Scope::Guard->new(sub { ... });
+ my $guard = guard { ... };
- # or
+ # or
- my $sg = Scope::Guard->new(\&handler);
+ my $guard = scope_guard \&handler;
- $sg->dismiss(); # disable the handler
+ # or
+
+ my $guard = Scope::Guard->new(\&handler);
+
+ $guard->dismiss(); # disable the handler
=head1 DESCRIPTION
This module provides a convenient way to perform cleanup or other forms of resource
management at the end of a scope. It is particularly useful when dealing with exceptions:
-the Scope::Guard constructor takes a reference to a subroutine that is guaranteed to
+the C<Scope::Guard> constructor takes a reference to a subroutine that is guaranteed to
be called even if the thread of execution is aborted prematurely. This effectively allows
lexically-scoped "promises" to be made that are automatically honoured by perl's garbage
collector.
-For more information, see: L<http://www.cuj.com/documents/s=8000/cujcexp1812alexandr/>
+For more information, see: L<http://www.drdobbs.com/cpp/184403758>
+
+=head1 METHODS
=head2 new
-=head3 usage
+ my $guard = Scope::Guard->new(sub { ... });
- my $sg = Scope::Guard->new(sub { ... });
+ # or
- # or
+ my $guard = Scope::Guard->new(\&handler);
- my $sg = Scope::Guard->new(\&handler);
-
-=head3 description
-
-Create a new Scope::Guard object which calls the supplied handler when its C<DESTROY> method is
+The C<new> method creates a new C<Scope::Guard> object which calls the supplied handler when its C<DESTROY> method is
called, typically when it goes out of scope.
=head2 dismiss
-=head3 usage
+ $guard->dismiss();
- $sg->dismiss();
+ # or
- # or
+ $guard->dismiss(1);
- $sg->dismiss(1);
-
-=head3 description
-
-Detach the handler from the Scope::Guard object. This revokes the "promise" to call the
+C<dismiss> detaches the handler from the C<Scope::Guard> object. This revokes the "promise" to call the
handler when the object is destroyed.
The handler can be re-enabled by calling:
- $sg->dismiss(0);
+ $guard->dismiss(0);
+
+=head1 EXPORTS
+
+=head2 guard
+
+C<guard> takes a block and returns a new C<Scope::Guard> object. It can be used
+as a shorthand for:
+
+ Scope::Guard->new(...)
+
+e.g.
+
+ my $guard = guard { ... };
+
+- or it can be called in void context to create a guard for the current scope e.g.
+
+ guard { ... };
+
+Because there is no way to dismiss the guard in the latter case, it is assumed that
+the block knows how to deal with situations in which the resource has already been
+managed e.g.
+
+ guard {
+ unless ($resource->disposed) {
+ $resource->dispose;
+ }
+ };
+
+=head2 scope_guard
+
+C<scope_guard> is the same as C<guard>, but it takes a scalar (e.g. a code ref) rather than a block.
+e.g.
+
+ my $guard = scope_guard \&handler;
+
+or:
+
+ my $guard = scope_guard sub { ... };
+
+or:
+
+ my $guard = scope_guard $handler;
+
+Like C<guard>, it can be called in void context to install an anonymous guard in the current scope.
=head1 VERSION
-0.03
+0.11
=head1 SEE ALSO
=over
-=item * L<Hook::LexWrap|Hook::LexWrap>
+=item * L<B::Hooks::EndOfScope|B::Hooks::EndOfScope>
+
+=item * L<End|End>
+
+=item * L<Guard|Guard>
=item * L<Hook::Scope|Hook::Scope>
+=item * L<Object::Destroyer|Object::Destroyer>
+
+=item * L<Perl::AtEndOfScope|Perl::AtEndOfScope>
+
+=item * L<ReleaseAction|ReleaseAction>
+
+=item * L<Scope::OnExit|Scope::OnExit>
+
=item * L<Sub::ScopeFinalizer|Sub::ScopeFinalizer>
-
-=item * L<Object::Destroyer|Object::Destroyer>
=back
=head1 AUTHOR
-chocolateboy: <chocolate.boy at email.com>
+chocolateboy <chocolate at cpan.org>
=head1 COPYRIGHT
-Copyright (c) 2005-2007, chocolateboy.
+Copyright (c) 2005-2010, chocolateboy.
This module is free software. It may be used, redistributed and/or modified under the same terms
as Perl itself.
More information about the Pkg-perl-cvs-commits
mailing list