Hello community,

here is the log from the commit of package perl-Sub-Override for 
openSUSE:Factory checked in at 2013-06-06 12:22:35
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Sub-Override (Old)
 and      /work/SRC/openSUSE:Factory/.perl-Sub-Override.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "perl-Sub-Override"

Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Sub-Override/perl-Sub-Override.changes      
2011-09-23 12:38:51.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.perl-Sub-Override.new/perl-Sub-Override.changes 
2013-06-06 12:22:37.000000000 +0200
@@ -1,0 +2,7 @@
+Tue Jun  4 17:18:39 UTC 2013 - co...@suse.com
+
+- updated to 0.09
+      Switch from Test::Exception to Test::Fatal.
+      Fix two typos on the POD. Patches from Ansgar Burchardt and david.skyba.
+
+-------------------------------------------------------------------

Old:
----
  Sub-Override-0.08.tar.gz

New:
----
  Sub-Override-0.09.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ perl-Sub-Override.spec ++++++
--- /var/tmp/diff_new_pack.LShVSD/_old  2013-06-06 12:22:38.000000000 +0200
+++ /var/tmp/diff_new_pack.LShVSD/_new  2013-06-06 12:22:38.000000000 +0200
@@ -1,7 +1,7 @@
 #
-# spec file for package perl-Sub-Override (Version 0.08)
+# spec file for package perl-Sub-Override
 #
-# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2013 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
@@ -15,43 +15,26 @@
 # Please submit bugfixes or comments via http://bugs.opensuse.org/
 #
 
-# norootforbuild
-
-%bcond_with pod
 
 Name:           perl-Sub-Override
+Version:        0.09
+Release:        0
 %define cpan_name Sub-Override
 Summary:        Perl extension for easily overriding subroutines
-Version:        0.08
-Release:        2
 License:        GPL-1.0+ or Artistic-1.0
 Group:          Development/Libraries/Perl
 Url:            http://search.cpan.org/dist/Sub-Override/
-Source:         
http://www.cpan.org/modules/by-module/Sub/Sub-Override-%{version}.tar.gz
+Source:         
http://www.cpan.org/authors/id/O/OV/OVID/%{cpan_name}-%{version}.tar.gz
 BuildArch:      noarch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-%{perl_requires}
 BuildRequires:  perl
 BuildRequires:  perl-macros
-%if %{with pod}
-BuildRequires:  perl(Test::Pod) >= 1.14
-BuildRequires:  perl(Test::Pod::Coverage) >= 1.04
-%endif
-BuildRequires:  perl(Sub::Uplevel)
-BuildRequires:  perl(Test::Exception) >= 0.21
-#
-Requires:       perl(Sub::Uplevel)
-Requires:       perl(Test::Exception) >= 0.21
+BuildRequires:  perl(Test::Fatal) >= 0.010
+Requires:       perl(Test::Fatal) >= 0.010
+%{perl_requires}
 
 %description
-Sometimes subroutines need to be overridden. In fact, your author does
-this constantly for tests. Particularly when testing, using a
-Mock Object can be overkill when all you want to do is override
-one tiny, little function.
-
-Authors:
---------
-    Curtis "Ovid" Poe, <eop_divo_sit...@yahoo.com>
+Perl extension for easily overriding subroutines
 
 %prep
 %setup -q -n %{cpan_name}-%{version}
@@ -65,18 +48,11 @@
 
 %install
 %perl_make_install
-# do not perl_process_packlist (noarch)
-# remove .packlist file
-%{__rm} -rf $RPM_BUILD_ROOT%perl_vendorarch
-# remove perllocal.pod file
-%{__rm} -rf $RPM_BUILD_ROOT%perl_archlib
+%perl_process_packlist
 %perl_gen_filelist
 
-%clean
-%{__rm} -rf $RPM_BUILD_ROOT
-
 %files -f %{name}.files
-%defattr(-,root,root,-)
-%doc Changes README
+%defattr(-,root,root,755)
+%doc Changes README README.md
 
 %changelog

++++++ Sub-Override-0.08.tar.gz -> Sub-Override-0.09.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Sub-Override-0.08/Changes 
new/Sub-Override-0.09/Changes
--- old/Sub-Override-0.08/Changes       2005-09-21 20:06:22.000000000 +0200
+++ new/Sub-Override-0.09/Changes       2013-01-16 19:57:01.000000000 +0100
@@ -1,5 +1,9 @@
 Revision history for Perl extension Sub::Override.
 
+0.09  Wed Jan 16 2013
+      Switch from Test::Exception to Test::Fatal.
+      Fix two typos on the POD. Patches from Ansgar Burchardt and david.skyba.
+
 0.08  Wed Sep 21 2005
       Remembered to update Changes file.  Grr.  I really need a
       "lint" script which can check to see if I've forgotten
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Sub-Override-0.08/MANIFEST 
new/Sub-Override-0.09/MANIFEST
--- old/Sub-Override-0.08/MANIFEST      2005-09-21 19:57:22.000000000 +0200
+++ new/Sub-Override-0.09/MANIFEST      2013-01-16 20:01:30.000000000 +0100
@@ -4,6 +4,8 @@
 MANIFEST
 META.yml                       Module meta-data (added by MakeMaker)
 README
-t/10override.t
-t/pod-coverage.t
-t/pod.t
+README.md
+t/override.t
+xt/pod-coverage.t
+xt/pod.t
+META.json                                Module JSON meta-data (added by 
MakeMaker)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Sub-Override-0.08/META.json 
new/Sub-Override-0.09/META.json
--- old/Sub-Override-0.08/META.json     1970-01-01 01:00:00.000000000 +0100
+++ new/Sub-Override-0.09/META.json     2013-01-16 20:01:30.000000000 +0100
@@ -0,0 +1,47 @@
+{
+   "abstract" : "Perl extension for easily overriding subroutines",
+   "author" : [
+      "Curtis Poe <o...@cpan.org>"
+   ],
+   "dynamic_config" : 1,
+   "generated_by" : "ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter 
version 2.120630",
+   "license" : [
+      "unknown"
+   ],
+   "meta-spec" : {
+      "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec";,
+      "version" : "2"
+   },
+   "name" : "Sub-Override",
+   "no_index" : {
+      "directory" : [
+         "t",
+         "inc"
+      ]
+   },
+   "prereqs" : {
+      "build" : {
+         "requires" : {
+            "ExtUtils::MakeMaker" : "0"
+         }
+      },
+      "configure" : {
+         "requires" : {
+            "ExtUtils::MakeMaker" : "0"
+         }
+      },
+      "runtime" : {
+         "requires" : {
+            "Test::Fatal" : "0.010",
+            "Test::More" : "0.47"
+         }
+      }
+   },
+   "release_status" : "stable",
+   "resources" : {
+      "repository" : {
+         "url" : "https://github.com/Ovid/sub-override";
+      }
+   },
+   "version" : "0.09"
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Sub-Override-0.08/META.yml 
new/Sub-Override-0.09/META.yml
--- old/Sub-Override-0.08/META.yml      2005-09-21 20:08:10.000000000 +0200
+++ new/Sub-Override-0.09/META.yml      2013-01-16 20:01:30.000000000 +0100
@@ -1,13 +1,25 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
-name:         Sub-Override
-version:      0.08
-version_from: lib/Sub/Override.pm
-installdirs:  site
+---
+abstract: 'Perl extension for easily overriding subroutines'
+author:
+  - 'Curtis Poe <o...@cpan.org>'
+build_requires:
+  ExtUtils::MakeMaker: 0
+configure_requires:
+  ExtUtils::MakeMaker: 0
+dynamic_config: 1
+generated_by: 'ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 
2.120630'
+license: unknown
+meta-spec:
+  url: http://module-build.sourceforge.net/META-spec-v1.4.html
+  version: 1.4
+name: Sub-Override
+no_index:
+  directory:
+    - t
+    - inc
 requires:
-    Sub::Uplevel:                  0
-    Test::Exception:               0.21
-    Test::More:                    0.47
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.17
+  Test::Fatal: 0.010
+  Test::More: 0.47
+resources:
+  repository: https://github.com/Ovid/sub-override
+version: 0.09
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Sub-Override-0.08/Makefile.PL 
new/Sub-Override-0.09/Makefile.PL
--- old/Sub-Override-0.08/Makefile.PL   2005-09-21 19:42:51.000000000 +0200
+++ new/Sub-Override-0.09/Makefile.PL   2013-01-16 19:52:30.000000000 +0100
@@ -1,18 +1,26 @@
 use 5.006;
 use ExtUtils::MakeMaker;
+
 # See lib/ExtUtils/MakeMaker.pm for details of how to influence
 # the contents of the Makefile that is written.
 WriteMakefile(
-    NAME              => 'Sub::Override',
-    VERSION_FROM      => 'lib/Sub/Override.pm', # finds $VERSION
-    PREREQ_PM         => {
-        'Test::More'      => .47,
-        'Test::Exception' => .21,
-        'Sub::Uplevel'    => 0, # because I'm sick of bogus test failures
+    NAME         => 'Sub::Override',
+    VERSION_FROM => 'lib/Sub/Override.pm',    # finds $VERSION
+    PREREQ_PM    => {
+        'Test::More'  => .47,
+        'Test::Fatal' => '0.010',
+    },
+    (   $] >= 5.005
+        ? ( ABSTRACT_FROM => 'lib/Sub/Override.pm',
+            AUTHOR        => 'Curtis Poe <o...@cpan.org>'
+          )
+        : ()
+    ),
+    META_MERGE => {
+        resources => {
+            repository => 'https://github.com/Ovid/sub-override',
+        },
     },
-    ($] >= 5.005 ?
-      (ABSTRACT_FROM  => 'lib/Sub/Override.pm',
-       AUTHOR         => 'Curtis Poe <eop_divo_sit...@yahoo.com>') : ()),
 );
 
 # reverse the email name to get my email address
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Sub-Override-0.08/README.md 
new/Sub-Override-0.09/README.md
--- old/Sub-Override-0.08/README.md     1970-01-01 01:00:00.000000000 +0100
+++ new/Sub-Override-0.09/README.md     2013-01-16 19:55:34.000000000 +0100
@@ -0,0 +1,192 @@
+# NAME
+
+Sub::Override - Perl extension for easily overriding subroutines
+
+# VERSION
+
+0.09
+
+# SYNOPSIS
+
+    use Sub::Override;
+
+    sub foo { 'original sub' };
+    print foo(); # prints 'original sub'
+
+    my $override = Sub::Override->new( foo => sub { 'overridden sub' } );
+    print foo(); # prints 'overridden sub'
+    $override->restore;
+    print foo(); # prints 'original sub'
+
+# DESCRIPTION
+
+## The Problem
+
+Sometimes subroutines need to be overridden.  In fact, your author does this
+constantly for tests.  Particularly when testing, using a Mock Object can be
+overkill when all you want to do is override one tiny, little function.
+
+Overriding a subroutine is often done with syntax similar to the following.
+
+    {
+      local *Some::sub = sub {'some behavior'};
+      # do something
+    }
+    # original subroutine behavior restored
+
+This has a few problems.
+
+    {
+      local *Get::some_feild = { 'some behavior' };
+      # do something
+    }
+
+In the above example, not only have we probably misspelled the subroutine name,
+but even if their had been a subroutine with that name, we haven't overridden
+it.  These two bugs can be subtle to detect.
+
+Further, if we're attempting to localize the effect by placing this code in a
+block, the entire construct is cumbersome.
+
+Hook::LexWrap also allows us to override sub behavior, but I can never remember
+the exact syntax.
+
+## An easier way to replace subroutines
+
+Instead, `Sub::Override` allows the programmer to simply name the sub to
+replace and to supply a sub to replace it with.
+
+    my $override = Sub::Override->new('Some::sub', sub {'new data'});
+
+    # which is equivalent to:
+    my $override = Sub::Override->new;
+    $override->replace('Some::sub', sub { 'new data' });
+
+You can replace multiple subroutines, if needed:
+
+    $override->replace('Some::sub1', sub { 'new data1' });
+    $override->replace('Some::sub2', sub { 'new data2' });
+    $override->replace('Some::sub3', sub { 'new data3' });
+
+If replacing the subroutine succeeds, the object is returned.  This allows the
+programmer to chain the calls, if this style of programming is preferred:
+
+    $override->replace('Some::sub1', sub { 'new data1' })
+             ->replace('Some::sub2', sub { 'new data2' })
+             ->replace('Some::sub3', sub { 'new data3' });
+
+If the subroutine has a prototype, the new subroutine should be declared with
+same prototype as original one:
+
+    $override->replace('Some::sub_with_proto', sub ($$) { ($_[0], $_ [1]) });
+
+A subroutine may be replaced as many times as desired.  This is most useful
+when testing how code behaves with multiple conditions.
+
+    $override->replace('Some::thing', sub { 0 });
+    is($object->foo, 'wibble', 'wibble is returned if Some::thing is false');
+
+    $override->replace('Some::thing', sub { 1 });
+    is($object->foo, 'puppies', 'puppies are returned if Some::thing is true');
+
+## Restoring subroutines
+
+If the object falls out of scope, the original subs are restored.  However, if
+you need to restore a subroutine early, just use the restore method:
+
+    my $override = Sub::Override->new('Some::sub', sub {'new data'});
+    # do stuff
+    $override->restore;
+
+Which is somewhat equivalent to:
+
+    {
+      my $override = Sub::Override->new('Some::sub', sub {'new data'});
+      # do stuff
+    }
+
+If you have override more than one subroutine with an override object, you
+will have to explicitly name the subroutine you wish to restore:
+
+    $override->restore('This::sub');
+
+Note `restore()` will always restore the original behavior of the subroutine
+no matter how many times you have overridden it.
+
+## Which package is the subroutine in?
+
+Ordinarily, you want to fully qualify the subroutine by including the package
+name.  However, failure to fully qualify the subroutine name will assume the
+current package.
+
+    package Foo;
+    use Sub::Override;
+    sub foo { 23 };
+    my $override = Sub::Override->new( foo => sub { 42 } ); # assumes Foo::foo
+    print foo(); # prints 42
+    $override->restore;
+    print foo(); # prints 23
+
+# METHODS
+
+## new
+
+    my $sub = Sub::Override->new;
+    my $sub = Sub::Override->new($sub_name, $sub_ref);
+
+Creates a new `Sub::Override` instance.  Optionally, you may override a 
+subroutine while creating a new object.
+
+## replace
+
+    $sub->replace($sub_name, $sub_body);
+
+Temporarily replaces a subroutine with another subroutine.  Returns the
+instance, so chaining the method is allowed:
+
+    $sub->replace($sub_name, $sub_body)
+        ->replace($another_sub, $another_body);
+
+This method will `croak` is the subroutine to be replaced does not exist.
+
+## override
+
+    my $sub = Sub::Override->new;
+    $sub->override($sub_name, $sub_body);
+
+`override` is an alternate name for `replace`.  They are the same method.
+
+## restore
+
+    $sub->restore($sub_name);
+
+Restores the previous behavior of the subroutine.  This will happen
+automatically if the `Sub::Override` object falls out of scope.
+
+# EXPORT
+
+None by default.
+
+# BUGS
+
+Probably.  Tell me about 'em.
+
+# SEE ALSO
+
+- Hook::LexWrap -- can also override subs, but with different capabilities
+- Test::MockObject -- use this if you need to alter an entire class
+
+# AUTHOR
+
+Curtis "Ovid" Poe, `<ovid [at] cpan [dot] org>`
+
+Reverse the name to email me.
+
+# COPYRIGHT AND LICENSE
+
+Copyright (C) 2004-2005 by Curtis "Ovid" Poe
+
+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.2 or,
+at your option, any later version of Perl 5 you may have available.
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Sub-Override-0.08/lib/Sub/Override.pm 
new/Sub-Override-0.09/lib/Sub/Override.pm
--- old/Sub-Override-0.08/lib/Sub/Override.pm   2005-09-21 20:08:01.000000000 
+0200
+++ new/Sub-Override-0.09/lib/Sub/Override.pm   2013-01-16 19:48:08.000000000 
+0100
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-our $VERSION = '0.08';
+our $VERSION = '0.09';
 
 my $_croak = sub {
     local *__ANON__ = '__ANON__croak';
@@ -108,6 +108,10 @@
 
 Sub::Override - Perl extension for easily overriding subroutines
 
+=head1 VERSION
+
+0.09
+
 =head1 SYNOPSIS
 
   use Sub::Override;
@@ -143,7 +147,7 @@
    # do something
  }
 
-In the above example, not only have we probably mispelled the subroutine name,
+In the above example, not only have we probably misspelled the subroutine name,
 but even if their had been a subroutine with that name, we haven't overridden
 it.  These two bugs can be subtle to detect.
 
@@ -177,6 +181,11 @@
            ->replace('Some::sub2', sub { 'new data2' })
            ->replace('Some::sub3', sub { 'new data3' });
 
+If the subroutine has a prototype, the new subroutine should be declared with
+same prototype as original one:
+
+  $override->replace('Some::sub_with_proto', sub ($$) { ($_[0], $_ [1]) });
+
 A subroutine may be replaced as many times as desired.  This is most useful
 when testing how code behaves with multiple conditions.
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Sub-Override-0.08/t/10override.t 
new/Sub-Override-0.09/t/10override.t
--- old/Sub-Override-0.08/t/10override.t        2005-09-21 19:57:37.000000000 
+0200
+++ new/Sub-Override-0.09/t/10override.t        1970-01-01 01:00:00.000000000 
+0100
@@ -1,114 +0,0 @@
-#!/usr/local/bin/perl -w
-use strict;
-#use Test::More 'no_plan';
-use Test::More tests => 28;
-use Test::Exception;
-
-my $CLASS;
-
-{
-    package Foo;
-
-    sub bar {
-        return 'original value';
-    }
-
-    sub baz {
-        return 'original baz value';
-    }
-}
-
-BEGIN {
-    chdir 't' if -d 't';
-    use lib '../lib';
-    $CLASS = 'Sub::Override';
-    use_ok($CLASS) || die;
-}
-
-can_ok($CLASS, 'new'); 
-
-my $override = $CLASS->new;
-isa_ok($override, $CLASS, '... and the object it returns');
-
-can_ok($override, 'replace');
-
-throws_ok { $override->replace('No::Such::Sub', '') }
-    qr/^\QCannot replace non-existent sub (No::Such::Sub)\E/,
-    "... and we can't replace a sub which doesn't exist";
-
-throws_ok { $override->replace('Foo::bar', 'not a subref') }
-    qr/\(not a subref\) must be a code reference/,
-    '... and only a code reference may replace a subroutine';
-
-ok($override->replace('Foo::bar', sub { 'new subroutine' }), 
-    '... and replacing a subroutine should succeed');
-is(Foo::bar(), 'new subroutine', 
-    '... and the subroutine should exhibit the new behavior');
-
-ok($override->replace('Foo::bar' => sub { 'new subroutine 2' }),
-    '... and we should be able to replace a sub more than once');
-is(Foo::bar(), 'new subroutine 2', 
-    '... and still have the sub exhibit the new behavior');
-
-can_ok($override, 'override');
-ok($override->override('Foo::bar' => sub { 'new subroutine 3' }),
-    '... and it should also replace a subroutine');
-is(Foo::bar(), 'new subroutine 3', 
-    '... and act just like replace()');
-
-can_ok($override, 'restore');
-
-throws_ok { $override->restore('Did::Not::Override') }
-    qr/^\QCannot restore a sub that was not replaced (Did::Not::Override)/,
-    '... and it should fail if the subroutine had not been replaced';
-
-$override->restore('Foo::bar');
-is(Foo::bar(), 'original value', 
-    '... and the subroutine should exhibit the original behavior');
-
-throws_ok { $override->restore('Foo::bar') }
-    qr/^\QCannot restore a sub that was not replaced (Foo::bar)/,
-    '... but we should not be able to restore it twice';
-
-{
-    my $new_override = $CLASS->new;
-    ok($new_override->replace('Foo::bar', sub { 'lexical value' }),
-        'A new override object should be able to replace a subroutine');
-    
-    is(Foo::bar(), 'lexical value', 
-        '... and the subroutine should exhibit the new behavior');
-}
-is(Foo::bar(), 'original value', 
-    '... but should revert to the original behavior when the object falls out 
of scope');
-
-{
-    my $new_override = $CLASS->new('Foo::bar', sub { 'lexical value' });
-    ok($new_override, 'We should be able to override a sub from the 
constructor');
-    
-    is(Foo::bar(), 'lexical value', 
-        '... and the subroutine should exhibit the new behavior');
-    ok($new_override->restore, 
-        '... and we do not need an argument to restore if only one sub is 
overridden');
-    is(Foo::bar(), 'original value', 
-        '... and the subroutine should exhibit its original behavior');
-    $new_override->replace('Foo::bar', sub {});
-    $new_override->replace('Foo::baz', sub {});
-    throws_ok { $new_override->restore }
-        qr/You must provide the name of a sub to restore: \(Foo::bar, 
Foo::baz\)/,
-        '... but we must explicitly provide the sub name if more than one was 
replaced';
-}
-
-{
-    package Temp;
-    sub foo { 23 }
-    sub bar { 42 }
-
-    my $override = Sub::Override->new('foo', sub { 42 });
-    $override->replace('bar', sub { 'barbar' });
-    main::is(foo(), 42, 'Not fully qualifying a sub name will assume the 
current package');
-    $override->restore('foo');
-    main::is(foo(), 23, '... and we should be able to restore said sub');
-
-    $override->restore('Temp::bar');
-    main::is(bar(), 42, '... even if we use a full qualified sub name');
-}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Sub-Override-0.08/t/override.t 
new/Sub-Override-0.09/t/override.t
--- old/Sub-Override-0.08/t/override.t  1970-01-01 01:00:00.000000000 +0100
+++ new/Sub-Override-0.09/t/override.t  2013-01-16 19:54:23.000000000 +0100
@@ -0,0 +1,138 @@
+#!/usr/local/bin/perl -w
+use strict;
+
+#use Test::More 'no_plan';
+use Test::More tests => 28;
+use Test::Fatal;
+
+my $CLASS;
+
+{
+
+    package Foo;
+
+    sub bar {
+        return 'original value';
+    }
+
+    sub baz {
+        return 'original baz value';
+    }
+}
+
+BEGIN {
+    chdir 't' if -d 't';
+    use lib '../lib';
+    $CLASS = 'Sub::Override';
+    use_ok($CLASS) || die;
+}
+
+can_ok( $CLASS, 'new' );
+
+my $override = $CLASS->new;
+isa_ok( $override, $CLASS, '... and the object it returns' );
+
+can_ok( $override, 'replace' );
+
+like
+  exception { $override->replace( 'No::Such::Sub', '' ) },
+  qr/^\QCannot replace non-existent sub (No::Such::Sub)\E/,
+  "... and we can't replace a sub which doesn't exist";
+
+like
+  exception { $override->replace( 'Foo::bar', 'not a subref' ) },
+  qr/\(not a subref\) must be a code reference/,
+  '... and only a code reference may replace a subroutine';
+
+ok( $override->replace( 'Foo::bar', sub {'new subroutine'} ),
+    '... and replacing a subroutine should succeed'
+);
+is( Foo::bar(), 'new subroutine',
+    '... and the subroutine should exhibit the new behavior'
+);
+
+ok( $override->replace( 'Foo::bar' => sub {'new subroutine 2'} ),
+    '... and we should be able to replace a sub more than once'
+);
+is( Foo::bar(), 'new subroutine 2',
+    '... and still have the sub exhibit the new behavior'
+);
+
+can_ok( $override, 'override' );
+ok( $override->override( 'Foo::bar' => sub {'new subroutine 3'} ),
+    '... and it should also replace a subroutine'
+);
+is( Foo::bar(), 'new subroutine 3',
+    '... and act just like replace()'
+);
+
+can_ok( $override, 'restore' );
+
+like
+  exception { $override->restore('Did::Not::Override') },
+  qr/^\QCannot restore a sub that was not replaced (Did::Not::Override)/,
+  '... and it should fail if the subroutine had not been replaced';
+
+$override->restore('Foo::bar');
+is( Foo::bar(), 'original value',
+    '... and the subroutine should exhibit the original behavior'
+);
+
+like
+  exception { $override->restore('Foo::bar') },
+  qr/^\QCannot restore a sub that was not replaced (Foo::bar)/,
+  '... but we should not be able to restore it twice';
+
+{
+    my $new_override = $CLASS->new;
+    ok( $new_override->replace( 'Foo::bar', sub {'lexical value'} ),
+        'A new override object should be able to replace a subroutine'
+    );
+
+    is( Foo::bar(), 'lexical value',
+        '... and the subroutine should exhibit the new behavior'
+    );
+}
+is( Foo::bar(), 'original value',
+    '... but should revert to the original behavior when the object falls out 
of scope'
+);
+
+{
+    my $new_override = $CLASS->new( 'Foo::bar', sub {'lexical value'} );
+    ok( $new_override,
+        'We should be able to override a sub from the constructor' );
+
+    is( Foo::bar(), 'lexical value',
+        '... and the subroutine should exhibit the new behavior'
+    );
+    ok( $new_override->restore,
+        '... and we do not need an argument to restore if only one sub is 
overridden'
+    );
+    is( Foo::bar(), 'original value',
+        '... and the subroutine should exhibit its original behavior'
+    );
+    $new_override->replace( 'Foo::bar', sub { } );
+    $new_override->replace( 'Foo::baz', sub { } );
+
+    like
+      exception { $new_override->restore },
+      qr/You must provide the name of a sub to restore: \(Foo::bar, 
Foo::baz\)/,
+      '... but we must explicitly provide the sub name if more than one was 
replaced';
+}
+
+{
+
+    package Temp;
+    sub foo {23}
+    sub bar {42}
+
+    my $override = Sub::Override->new( 'foo', sub {42} );
+    $override->replace( 'bar', sub {'barbar'} );
+    main::is( foo(), 42,
+        'Not fully qualifying a sub name will assume the current package' );
+    $override->restore('foo');
+    main::is( foo(), 23, '... and we should be able to restore said sub' );
+
+    $override->restore('Temp::bar');
+    main::is( bar(), 42, '... even if we use a full qualified sub name' );
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Sub-Override-0.08/t/pod-coverage.t 
new/Sub-Override-0.09/t/pod-coverage.t
--- old/Sub-Override-0.08/t/pod-coverage.t      2005-09-21 19:44:36.000000000 
+0200
+++ new/Sub-Override-0.09/t/pod-coverage.t      1970-01-01 01:00:00.000000000 
+0100
@@ -1,7 +0,0 @@
-#!perl -T
-
-use Test::More;
-eval "use Test::Pod::Coverage 1.04";
-plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" 
if $@;
-all_pod_coverage_ok();
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Sub-Override-0.08/t/pod.t 
new/Sub-Override-0.09/t/pod.t
--- old/Sub-Override-0.08/t/pod.t       2005-09-21 19:44:41.000000000 +0200
+++ new/Sub-Override-0.09/t/pod.t       1970-01-01 01:00:00.000000000 +0100
@@ -1,6 +0,0 @@
-#!perl -T
-
-use Test::More;
-eval "use Test::Pod 1.14";
-plan skip_all => "Test::Pod 1.14 required for testing POD" if $@;
-all_pod_files_ok();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Sub-Override-0.08/xt/pod-coverage.t 
new/Sub-Override-0.09/xt/pod-coverage.t
--- old/Sub-Override-0.08/xt/pod-coverage.t     1970-01-01 01:00:00.000000000 
+0100
+++ new/Sub-Override-0.09/xt/pod-coverage.t     2013-01-16 19:54:43.000000000 
+0100
@@ -0,0 +1,7 @@
+#!perl -T
+
+use Test::More;
+eval "use Test::Pod::Coverage 1.04";
+plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" 
if $@;
+all_pod_coverage_ok();
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Sub-Override-0.08/xt/pod.t 
new/Sub-Override-0.09/xt/pod.t
--- old/Sub-Override-0.08/xt/pod.t      1970-01-01 01:00:00.000000000 +0100
+++ new/Sub-Override-0.09/xt/pod.t      2005-09-21 19:44:41.000000000 +0200
@@ -0,0 +1,6 @@
+#!perl -T
+
+use Test::More;
+eval "use Test::Pod 1.14";
+plan skip_all => "Test::Pod 1.14 required for testing POD" if $@;
+all_pod_files_ok();

-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to