Hello community,
here is the log from the commit of package perl-Scope-Guard for openSUSE:Factory
checked in at Tue Jan 18 01:04:16 CET 2011.
--------
--- perl-Scope-Guard/perl-Scope-Guard.changes 2010-12-01 10:46:06.000000000 +0100
+++ perl-Scope-Guard/perl-Scope-Guard.changes 2011-01-17 19:20:37.000000000 +0100
@@ -1,0 +2,10 @@
+Mon Jan 17 18:16:45 UTC 2011 - coolo@novell.com
+
+- update to 0.20:
+ - raise exception if guards are created anonymously (void context)
+ (thanks Tim Bunce and Graham Knop)
+ - fix link in README (thanks Franck Joncourt)
+ - doc tweak
+ - add guard() and scope_guard() (thanks Tim Bunce)
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
Scope-Guard-0.03.tar.gz
New:
----
Scope-Guard-0.20.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Scope-Guard.spec ++++++
--- /var/tmp/diff_new_pack.dRKmwM/_old 2011-01-18 00:56:53.000000000 +0100
+++ /var/tmp/diff_new_pack.dRKmwM/_new 2011-01-18 00:56:53.000000000 +0100
@@ -1,7 +1,7 @@
#
-# spec file for package perl-Scope-Guard (Version 0.03)
+# spec file for package perl-Scope-Guard
#
-# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -19,8 +19,8 @@
%define cpan_name Scope-Guard
Name: perl-%cpan_name
-Version: 0.03
-Release: 2
+Version: 0.20
+Release: 1
Provides: %cpan_name
Group: Development/Libraries/Perl
License: Artistic
++++++ Scope-Guard-0.03.tar.gz -> Scope-Guard-0.20.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Scope-Guard-0.03/Changes new/Scope-Guard-0.20/Changes
--- old/Scope-Guard-0.03/Changes 2007-01-07 20:19:43.000000000 +0100
+++ new/Scope-Guard-0.20/Changes 2010-05-16 09:54:51.000000000 +0200
@@ -1,5 +1,18 @@
Revision history for Perl extension Scope::Guard.
+0.20 Sun May 16 08:50:59 2010
+ - raise exception if guards are created anonymously (void context)
+ (thanks Tim Bunce and Graham Knop)
+
+0.12 Fri Mar 26 19:12:11 2010
+ - fix link in README (thanks Franck Joncourt)
+
+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)
- added test suite
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Scope-Guard-0.03/MANIFEST new/Scope-Guard-0.20/MANIFEST
--- old/Scope-Guard-0.03/MANIFEST 2007-01-07 20:17:47.000000000 +0100
+++ new/Scope-Guard-0.20/MANIFEST 2010-05-16 09:41:56.000000000 +0200
@@ -1,9 +1,9 @@
Changes
-MANIFEST
-META.yml
+lib/Scope/Guard.pm
Makefile.PL
+MANIFEST This list of files
+META.yml
README
-lib/Scope/Guard.pm
-t/Scope-Guard.t
-t/pod.t
-t/pod_coverage.t
+t/guard.t
+t/new.t
+t/scope_guard.t
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Scope-Guard-0.03/META.yml new/Scope-Guard-0.20/META.yml
--- old/Scope-Guard-0.03/META.yml 2007-01-07 20:20:57.000000000 +0100
+++ new/Scope-Guard-0.20/META.yml 2010-05-16 10:05:33.000000000 +0200
@@ -1,11 +1,22 @@
-# 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.20
+abstract: lexically-scoped resource management
+author:
+ - chocolateboy
+license: perl
+distribution_type: module
+configure_requires:
+ ExtUtils::MakeMaker: 0
+build_requires:
+ Test::More: 0
requires:
- Test::More: 0
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.17
+ perl: 5.006001
+no_index:
+ directory:
+ - t
+ - inc
+generated_by: ExtUtils::MakeMaker version 6.56
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Scope-Guard-0.03/Makefile.PL new/Scope-Guard-0.20/Makefile.PL
--- old/Scope-Guard-0.03/Makefile.PL 2007-01-07 20:17:47.000000000 +0100
+++ new/Scope-Guard-0.20/Makefile.PL 2010-04-03 02:17:20.000000000 +0200
@@ -1,14 +1,37 @@
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
- ($] >= 5.005 ? ## Add these new keywords supported since 5.005
- (ABSTRACT_FROM => 'lib/Scope/Guard.pm', # retrieve abstract from module
- AUTHOR => 'chocolateboy ') : ()),
+
+WriteMakefile1(
+ MIN_PERL_VERSION => '5.006001',
+ BUILD_REQUIRES => {
+ 'Test::More' => 0,
+ },
+ NAME => 'Scope::Guard',
+ VERSION_FROM => 'lib/Scope/Guard.pm',
+ ABSTRACT_FROM => 'lib/Scope/Guard.pm',
+ AUTHOR => 'chocolateboy ',
+ LICENSE => 'perl'
);
+
+sub WriteMakefile1 { # Written by Alexandr Ciornii, version 0.21. Added by eumm-upgrade.
+ my %params = @_;
+ my $eumm_version = $ExtUtils::MakeMaker::VERSION;
+ $eumm_version = eval $eumm_version;
+ die "EXTRA_META is deprecated" if exists $params{EXTRA_META};
+ die "License not specified" if not exists $params{LICENSE};
+ if ($params{BUILD_REQUIRES} and $eumm_version < 6.5503) {
+ # EUMM 6.5502 has problems with BUILD_REQUIRES
+ $params{PREREQ_PM} = { %{ $params{PREREQ_PM} || {} }, %{ $params{BUILD_REQUIRES} } };
+ delete $params{BUILD_REQUIRES};
+ }
+ delete $params{MIN_PERL_VERSION} if $eumm_version < 6.48;
+ delete $params{LICENSE} if $eumm_version < 6.31;
+ delete $params{AUTHOR} if $] < 5.005;
+ delete $params{ABSTRACT_FROM} if $] < 5.005;
+
+ WriteMakefile(%params);
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Scope-Guard-0.03/README new/Scope-Guard-0.20/README
--- old/Scope-Guard-0.03/README 2007-01-07 20:17:47.000000000 +0100
+++ new/Scope-Guard-0.20/README 2010-05-16 09:50:40.000000000 +0200
@@ -1,4 +1,4 @@
-Scope-Guard version 0.03
+Scope-Guard version 0.20
========================
This module provides a convenient way to perform cleanup or other forms of resource
@@ -8,7 +8,7 @@
lexically-scoped "promises" to be made that are automatically honoured by perl's garbage
collector.
-For more information, see: http://www.cuj.com/documents/s=8000/cujcexp1812alexandr/
+For more information, see: http://www.drdobbs.com/cpp/184403758
INSTALLATION
@@ -21,7 +21,7 @@
COPYRIGHT AND LICENCE
-Copyright (c) 2005-2007 by chocolateboy
+Copyright (c) 2005-2010 by chocolateboy
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,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Scope-Guard-0.03/lib/Scope/Guard.pm new/Scope-Guard-0.20/lib/Scope/Guard.pm
--- old/Scope-Guard-0.03/lib/Scope/Guard.pm 2007-01-07 20:17:47.000000000 +0100
+++ new/Scope-Guard-0.20/lib/Scope/Guard.pm 2010-05-16 10:04:07.000000000 +0200
@@ -3,17 +3,22 @@
use strict;
use warnings;
-use vars qw($VERSION);
+use Carp qw(confess);
+use Exporter ();
-$VERSION = '0.03';
+our @ISA = qw(Exporter);
+our @EXPORT_OK = qw(guard scope_guard);
+our $VERSION = '0.20';
sub new {
+ confess "Can't create a Scope::Guard in void context" unless (defined wantarray);
+
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'"
- unless (UNIVERSAL::isa($handler, 'CODE'));
+ unless (UNIVERSAL::isa($handler, 'CODE'));
bless [ 0, $handler ], ref $class || $class;
}
@@ -25,6 +30,9 @@
$self->[0] = $dismiss;
}
+sub guard(&) { __PACKAGE__->new(shift) }
+sub scope_guard($) { __PACKAGE__->new(shift) }
+
sub DESTROY {
my $self = shift;
my ($dismiss, $handler) = @$self;
@@ -40,88 +48,134 @@
=head1 NAME
-Scope::Guard - lexically scoped resource management
+Scope::Guard - lexically-scoped resource management
=head1 SYNOPSIS
- my $sg = Scope::Guard->new(sub { ... });
+ my $guard = guard { ... };
+
+ # or
+
+ my $guard = scope_guard \&handler;
- # or
+ # or
- my $sg = Scope::Guard->new(\&handler);
+ my $guard = Scope::Guard->new(sub { ... });
- $sg->dismiss(); # disable the 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 CScope::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: Lhttp://www.cuj.com/documents/s=8000/cujcexp1812alexandr/
+For more information, see: Lhttp://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);
+The C<new> method creates a new CScope::Guard object which calls the supplied handler when its C<DESTROY> method is
+called, typically at the end of the scope.
-=head3 description
+=head2 dismiss
-Create a new Scope::Guard object which calls the supplied handler when its C<DESTROY> method is
-called, typically when it goes out of scope.
+ $guard->dismiss();
-=head2 dismiss
+ # or
-=head3 usage
+ $guard->dismiss(1);
- $sg->dismiss();
+C<dismiss> detaches the handler from the CScope::Guard object. This revokes the "promise" to call the
+handler when the object is destroyed.
- # or
+The handler can be re-enabled by calling:
- $sg->dismiss(1);
+ $guard->dismiss(0);
-=head3 description
+=head1 EXPORTS
-Detach the handler from the Scope::Guard object. This revokes the "promise" to call the
-handler when the object is destroyed.
+=head2 guard
-The handler can be re-enabled by calling:
+C<guard> takes a block and returns a new CScope::Guard object. It can be used
+as a shorthand for:
+
+ Scope::Guard->new(...)
+
+e.g.
+
+ my $guard = guard { ... };
+
+Note: calling C<guard> anonymously, i.e. in void context, will raise an exception.
+This is because anonymous guards are destroyed B<immediately>
+(rather than at the end of the scope), which is unlikely to be the desired behaviour.
+
+=head2 scope_guard
- $sg->dismiss(0);
+C is the same as C<guard>, but it takes 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;
+
+As with C<guard>, calling C in void context will raise an exception.
=head1 VERSION
-0.03
+0.20
=head1 SEE ALSO
=over
-=item * LHook::LexWrap|Hook::LexWrap
+=item * L
+
+=item * L
+
+=item * L
=item * LHook::Scope|Hook::Scope
+=item * LObject::Destroyer|Object::Destroyer
+
+=item * LPerl::AtEndOfScope|Perl::AtEndOfScope
+
+=item * L
+
+=item * LScope::local_OnExit|Scope::local_OnExit
+
+=item * LScope::OnExit|Scope::OnExit
+
=item * LSub::ScopeFinalizer|Sub::ScopeFinalizer
-=item * LObject::Destroyer|Object::Destroyer
+=item * LValue::Canary|Value::Canary
=back
=head1 AUTHOR
-chocolateboy:
+chocolateboy
=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.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Scope-Guard-0.03/t/Scope-Guard.t new/Scope-Guard-0.20/t/Scope-Guard.t
--- old/Scope-Guard-0.03/t/Scope-Guard.t 2007-01-07 20:17:47.000000000 +0100
+++ new/Scope-Guard-0.20/t/Scope-Guard.t 1970-01-01 01:00:00.000000000 +0100
@@ -1,49 +0,0 @@
-# Before `make install' is performed this script should be runnable with
-# `make test'. After `make install' it should work as `perl Scope-Guard.t'
-
-use blib;
-use strict;
-use warnings;
-
-use Test::More tests => 8;
-
-BEGIN { use_ok('Scope::Guard') };
-
-my $i = 1;
-
-{
- my $sg = Scope::Guard->new(sub { ok($i++ == 1, 'handler invoked at scope end') });
-}
-
-sub {
- my $sg = Scope::Guard->new(sub { ok($i++ == 2, 'handler invoked on return') });
- return;
-}->();
-
-eval {
- my $sg = Scope::Guard->new(sub { ok($i++ == 3, 'handler invoked on exception') });
- my $j = 0;
- my $k = $j / $j;
-};
-
-like($@, qr{^Illegal division by zero}, 'exception was raised');
-
-{
- my $sg = Scope::Guard->new(sub { ++$i });
- $sg->dismiss();
-}
-
-ok($i++ == 4, 'dismiss() disables handler');
-
-{
- my $sg = Scope::Guard->new(sub { ++$i });
- $sg->dismiss(1);
-}
-
-ok($i++ == 5, 'dismiss(1) disables handler');
-
-{
- my $sg = Scope::Guard->new(sub { ok($i++ == 6, 'dismiss(0) enables handler') });
- $sg->dismiss();
- $sg->dismiss(0);
-}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Scope-Guard-0.03/t/guard.t new/Scope-Guard-0.20/t/guard.t
--- old/Scope-Guard-0.03/t/guard.t 1970-01-01 01:00:00.000000000 +0100
+++ new/Scope-Guard-0.20/t/guard.t 2010-05-16 09:31:15.000000000 +0200
@@ -0,0 +1,116 @@
+#!/usr/bin/env perl
+
+# XXX Test::Exception...
+
+use strict;
+use warnings;
+
+use Test::More tests => 18;
+
+BEGIN { use_ok('Scope::Guard', 'guard') };
+
+my $test_0 = 'test_0';
+my $test_1 = 'test_1';
+my $test_2 = 'test_2';
+
+eval {
+ $test_0 = 'modified test_0';
+ guard { $test_1 = 'modified test_1' }; # void context: blow up
+ $test_2 = 'modified test_2'; # not reached
+};
+
+like $@, qr{Can't create a Scope::Guard in void context};
+is $test_0, 'modified test_0';
+is $test_1, 'test_1';
+is $test_2, 'test_2';
+
+####################################################
+
+my $test_3 = 'test_3';
+my $test_4 = 'test_4';
+
+sub {
+ my $guard = guard { $test_3 = 'modified test_3' };
+ return;
+ $test_4 = 'modified test 4';
+}->();
+
+is $test_3, 'modified test_3';
+is $test_4, 'test_4';
+
+####################################################
+
+my $test_5 = 'test_5';
+my $test_6 = 'test_6';
+
+eval {
+ my $guard = guard { $test_5 = 'modified test_5' };
+
+ my $numerator = 42;
+ my $denominator = 0;
+ my $exception = $numerator / $denominator;
+
+ $test_6 = 'modified test 3'; # not reached
+};
+
+like $@, qr{^Illegal division by zero};
+is $test_5, 'modified test_5';
+is $test_6, 'test_6';
+
+####################################################
+
+my $test_7 = 'test_7';
+my $test_8 = 'test_8';
+
+{
+ my $guard = guard { $test_7 = 'modified test_7' }; # not called (due to dismiss())
+ $guard->dismiss(); # defaults to true
+ $test_8 = 'modified test_8'; # reached!
+}
+
+is $test_7, 'test_7'; # unmodified
+is $test_8, 'modified test_8'; # the guard was dismissed, so this is reached
+
+####################################################
+
+my $test_9 = 'test_9';
+my $test_10 = 'test_10';
+
+{
+ my $guard = guard { $test_9 = 'modified test_9' }; # not called (due to dismiss())
+ $guard->dismiss(1);
+ $test_10 = 'modified test_10'; # reached!
+}
+
+is $test_9, 'test_9';
+is $test_10, 'modified test_10';
+
+####################################################
+
+my $test_11 = 'test_11';
+my $test_12 = 'test_12';
+
+{
+ my $guard = guard { $test_11 = 'modified test_11' };
+ $guard->dismiss(); # dismiss: default argument (1)
+ $guard->dismiss(0); # un-dismiss!
+ $test_12 = 'modified test_12';
+}
+
+is $test_11, 'modified test_11';
+is $test_12, 'modified test_12';
+
+####################################################
+
+my $test_13 = 'test_13';
+my $test_14 = 'test_14';
+
+{
+ my $guard = guard { $test_13 = 'modified test_13' };
+ $guard->dismiss(1); # dismiss: explicit argument (1)
+ $guard->dismiss(0); # un-dismiss!
+ $test_14 = 'modified test_14';
+}
+
+is $test_13, 'modified test_13';
+is $test_14, 'modified test_14';
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Scope-Guard-0.03/t/new.t new/Scope-Guard-0.20/t/new.t
--- old/Scope-Guard-0.03/t/new.t 1970-01-01 01:00:00.000000000 +0100
+++ new/Scope-Guard-0.20/t/new.t 2010-05-16 09:40:37.000000000 +0200
@@ -0,0 +1,116 @@
+#!/usr/bin/env perl
+
+# XXX Test::Exception...
+
+use strict;
+use warnings;
+
+use Test::More tests => 18;
+
+BEGIN { use_ok('Scope::Guard', 'scope_guard') };
+
+my $test_0 = 'test_0';
+my $test_1 = 'test_1';
+my $test_2 = 'test_2';
+
+eval {
+ $test_0 = 'modified test_0';
+ Scope::Guard->new(sub { $test_1 = 'modified test_1' }); # void context: blow up
+ $test_2 = 'modified test_2'; # not reached
+};
+
+like $@, qr{Can't create a Scope::Guard in void context};
+is $test_0, 'modified test_0';
+is $test_1, 'test_1';
+is $test_2, 'test_2';
+
+####################################################
+
+my $test_3 = 'test_3';
+my $test_4 = 'test_4';
+
+sub {
+ my $guard = Scope::Guard->new(sub { $test_3 = 'modified test_3' });
+ return;
+ $test_4 = 'modified test 4';
+}->();
+
+is $test_3, 'modified test_3';
+is $test_4, 'test_4';
+
+####################################################
+
+my $test_5 = 'test_5';
+my $test_6 = 'test_6';
+
+eval {
+ my $guard = Scope::Guard->new(sub { $test_5 = 'modified test_5' });
+
+ my $numerator = 42;
+ my $denominator = 0;
+ my $exception = $numerator / $denominator;
+
+ $test_6 = 'modified test 3'; # not reached
+};
+
+like $@, qr{^Illegal division by zero};
+is $test_5, 'modified test_5';
+is $test_6, 'test_6';
+
+####################################################
+
+my $test_7 = 'test_7';
+my $test_8 = 'test_8';
+
+{
+ my $guard = Scope::Guard->new(sub { $test_7 = 'modified test_7' }); # not called (due to dismiss())
+ $guard->dismiss(); # defaults to true
+ $test_8 = 'modified test_8'; # reached!
+}
+
+is $test_7, 'test_7'; # unmodified
+is $test_8, 'modified test_8'; # the guard was dismissed, so this is reached
+
+####################################################
+
+my $test_9 = 'test_9';
+my $test_10 = 'test_10';
+
+{
+ my $guard = Scope::Guard->new(sub { $test_9 = 'modified test_9' }); # not called (due to dismiss())
+ $guard->dismiss(1);
+ $test_10 = 'modified test_10'; # reached!
+}
+
+is $test_9, 'test_9';
+is $test_10, 'modified test_10';
+
+####################################################
+
+my $test_11 = 'test_11';
+my $test_12 = 'test_12';
+
+{
+ my $guard = Scope::Guard->new(sub { $test_11 = 'modified test_11' });
+ $guard->dismiss(); # dismiss: default argument (1)
+ $guard->dismiss(0); # un-dismiss!
+ $test_12 = 'modified test_12';
+}
+
+is $test_11, 'modified test_11';
+is $test_12, 'modified test_12';
+
+####################################################
+
+my $test_13 = 'test_13';
+my $test_14 = 'test_14';
+
+{
+ my $guard = Scope::Guard->new(sub { $test_13 = 'modified test_13' });
+ $guard->dismiss(1); # dismiss: explicit argument (1)
+ $guard->dismiss(0); # un-dismiss!
+ $test_14 = 'modified test_14';
+}
+
+is $test_13, 'modified test_13';
+is $test_14, 'modified test_14';
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Scope-Guard-0.03/t/pod.t new/Scope-Guard-0.20/t/pod.t
--- old/Scope-Guard-0.03/t/pod.t 2007-01-07 20:17:47.000000000 +0100
+++ new/Scope-Guard-0.20/t/pod.t 1970-01-01 01:00:00.000000000 +0100
@@ -1,9 +0,0 @@
-eval "use Test::Pod";
-if ($@) {
- print "1..0 # Skip Test::Pod not installed\n";
- exit;
-}
-
- my @PODS = qw#../blib#;
-
-all_pod_files_ok( all_pod_files(@PODS) );
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Scope-Guard-0.03/t/pod_coverage.t new/Scope-Guard-0.20/t/pod_coverage.t
--- old/Scope-Guard-0.03/t/pod_coverage.t 2007-01-07 20:17:47.000000000 +0100
+++ new/Scope-Guard-0.20/t/pod_coverage.t 1970-01-01 01:00:00.000000000 +0100
@@ -1,13 +0,0 @@
-eval "use Test::Pod::Coverage";
-
-if ($@) {
- print "1..0 # Skip Test::Pod::Coverage not installed", $/;
- exit;
-}
-
-my $ARGS = {
- also_private => [],
- trustme => [],
-};
-
-all_pod_coverage_ok($ARGS);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Scope-Guard-0.03/t/scope_guard.t new/Scope-Guard-0.20/t/scope_guard.t
--- old/Scope-Guard-0.03/t/scope_guard.t 1970-01-01 01:00:00.000000000 +0100
+++ new/Scope-Guard-0.20/t/scope_guard.t 2010-05-16 09:34:37.000000000 +0200
@@ -0,0 +1,116 @@
+#!/usr/bin/env perl
+
+# XXX Test::Exception...
+
+use strict;
+use warnings;
+
+use Test::More tests => 18;
+
+BEGIN { use_ok('Scope::Guard', 'scope_guard') };
+
+my $test_0 = 'test_0';
+my $test_1 = 'test_1';
+my $test_2 = 'test_2';
+
+eval {
+ $test_0 = 'modified test_0';
+ scope_guard sub { $test_1 = 'modified test_1' }; # void context: blow up
+ $test_2 = 'modified test_2'; # not reached
+};
+
+like $@, qr{Can't create a Scope::Guard in void context};
+is $test_0, 'modified test_0';
+is $test_1, 'test_1';
+is $test_2, 'test_2';
+
+####################################################
+
+my $test_3 = 'test_3';
+my $test_4 = 'test_4';
+
+sub {
+ my $guard = scope_guard sub { $test_3 = 'modified test_3' };
+ return;
+ $test_4 = 'modified test 4';
+}->();
+
+is $test_3, 'modified test_3';
+is $test_4, 'test_4';
+
+####################################################
+
+my $test_5 = 'test_5';
+my $test_6 = 'test_6';
+
+eval {
+ my $guard = scope_guard sub { $test_5 = 'modified test_5' };
+
+ my $numerator = 42;
+ my $denominator = 0;
+ my $exception = $numerator / $denominator;
+
+ $test_6 = 'modified test 3'; # not reached
+};
+
+like $@, qr{^Illegal division by zero};
+is $test_5, 'modified test_5';
+is $test_6, 'test_6';
+
+####################################################
+
+my $test_7 = 'test_7';
+my $test_8 = 'test_8';
+
+{
+ my $guard = scope_guard sub { $test_7 = 'modified test_7' }; # not called (due to dismiss())
+ $guard->dismiss(); # defaults to true
+ $test_8 = 'modified test_8'; # reached!
+}
+
+is $test_7, 'test_7'; # unmodified
+is $test_8, 'modified test_8'; # the guard was dismissed, so this is reached
+
+####################################################
+
+my $test_9 = 'test_9';
+my $test_10 = 'test_10';
+
+{
+ my $guard = scope_guard sub { $test_9 = 'modified test_9' }; # not called (due to dismiss())
+ $guard->dismiss(1);
+ $test_10 = 'modified test_10'; # reached!
+}
+
+is $test_9, 'test_9';
+is $test_10, 'modified test_10';
+
+####################################################
+
+my $test_11 = 'test_11';
+my $test_12 = 'test_12';
+
+{
+ my $guard = scope_guard sub { $test_11 = 'modified test_11' };
+ $guard->dismiss(); # dismiss: default argument (1)
+ $guard->dismiss(0); # un-dismiss!
+ $test_12 = 'modified test_12';
+}
+
+is $test_11, 'modified test_11';
+is $test_12, 'modified test_12';
+
+####################################################
+
+my $test_13 = 'test_13';
+my $test_14 = 'test_14';
+
+{
+ my $guard = scope_guard sub { $test_13 = 'modified test_13' };
+ $guard->dismiss(1); # dismiss: explicit argument (1)
+ $guard->dismiss(0); # un-dismiss!
+ $test_14 = 'modified test_14';
+}
+
+is $test_13, 'modified test_13';
+is $test_14, 'modified test_14';
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org