The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
MANIFEST 01
MANIFEST.bak 022
META.json 44
META.yml 1111
README 88
lib/Mock/Quick/Class.pm 37
lib/Mock/Quick/Object.pm 11
lib/Mock/Quick.pm 1010
t/Class.t 09
9 files changed (This is a version diff) 3773
@@ -7,6 +7,7 @@ lib/Mock/Quick/Object/Control.pm
 lib/Mock/Quick/Util.pm
 lib/Object/Quick.pm
 MANIFEST			This list of files
+MANIFEST.bak
 MANIFEST.SKIP
 META.json
 META.yml
@@ -0,0 +1,22 @@
+Build.PL
+lib/Mock/Quick.pm
+lib/Mock/Quick/Class.pm
+lib/Mock/Quick/Method.pm
+lib/Mock/Quick/Object.pm
+lib/Mock/Quick/Object/Control.pm
+lib/Mock/Quick/Util.pm
+lib/Object/Quick.pm
+MANIFEST			This list of files
+MANIFEST.SKIP
+README
+t/Class.t
+t/intercept.t
+t/Method.t
+t/metrics.t
+t/Mock-Quick.t
+t/Object-Quick.t
+t/Object.t
+t/object_control.t
+t/Util.t
+META.yml
+META.json
@@ -4,7 +4,7 @@
       "Chad Granum <exodist7@gmail.com>"
    ],
    "dynamic_config" : 1,
-   "generated_by" : "Module::Build version 0.4003, CPAN::Meta::Converter version 2.131560",
+   "generated_by" : "Module::Build version 0.4208",
    "license" : [
       "perl_5"
    ],
@@ -23,7 +23,7 @@
       },
       "configure" : {
          "requires" : {
-            "Module::Build" : "0.40"
+            "Module::Build" : "0.42"
          }
       },
       "runtime" : {
@@ -37,7 +37,7 @@
    "provides" : {
       "Mock::Quick" : {
          "file" : "lib/Mock/Quick.pm",
-         "version" : "1.107"
+         "version" : "1.108"
       },
       "Mock::Quick::Class" : {
          "file" : "lib/Mock/Quick/Class.pm"
@@ -70,5 +70,5 @@
          "url" : "http://github.com/exodist/Mock-Quick"
       }
    },
-   "version" : "1.107"
+   "version" : "1.108"
 }
@@ -3,22 +3,22 @@ abstract: 'Quickly mock objects and classes, even temporarily replace them,'
 author:
   - 'Chad Granum <exodist7@gmail.com>'
 build_requires:
-  Fennec::Lite: 0.004
-  Test::Exception: 0.29
-  Test::Simple: 0.88
+  Fennec::Lite: '0.004'
+  Test::Exception: '0.29'
+  Test::Simple: '0.88'
 configure_requires:
-  Module::Build: 0.40
+  Module::Build: '0.42'
 dynamic_config: 1
-generated_by: 'Module::Build version 0.4003, CPAN::Meta::Converter version 2.131560'
+generated_by: 'Module::Build version 0.4208, CPAN::Meta::Converter version 2.140640'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
-  version: 1.4
+  version: '1.4'
 name: Mock-Quick
 provides:
   Mock::Quick:
     file: lib/Mock/Quick.pm
-    version: 1.107
+    version: '1.108'
   Mock::Quick::Class:
     file: lib/Mock/Quick/Class.pm
   Mock::Quick::Method:
@@ -32,11 +32,11 @@ provides:
   Object::Quick:
     file: lib/Object/Quick.pm
 requires:
-  Carp: 0
-  Exporter::Declare: 0.103
-  Scalar::Util: 0
+  Carp: '0'
+  Exporter::Declare: '0.103'
+  Scalar::Util: '0'
 resources:
   bugtracker: http://github.com/exodist/Mock-Quick/issues
   license: http://dev.perl.org/licenses/
   repository: http://github.com/exodist/Mock-Quick
-version: 1.107
+version: '1.108'
@@ -9,14 +9,14 @@ DESCRIPTION
     problems with these libraries include verbose syntax, and most
     importantly side-effects. Some Mocking libraries expect you to mock a
     specific class, and will unload it then redefine it. This is
-    particularily a problem if you only want to override a class on a
-    lexical level.
+    particularly a problem if you only want to override a class on a lexical
+    level.
 
     Mock-Object provides a declarative mocking interface that results in a
-    very concise, but clear syntax. There are seperate facilities for
+    very concise, but clear syntax. There are separate facilities for
     mocking object instances, and classes. You can quickly create an
     instance of an object with custom attributes and methods. You can also
-    quickly create an anonymous class, optionally inhereting from another,
+    quickly create an anonymous class, optionally inheriting from another,
     with whatever methods you desire.
 
     Mock-Object also provides a tool that provides an OO interface to
@@ -113,7 +113,7 @@ SYNOPSIS
 
   MOCKING CLASSES
     Note: the control object returned here is of type Mock::Quick::Class,
-    wheras control objects for qobj style objects are of
+    whereas control objects for qobj style objects are of
     Mock::Quick::Object::Control.
 
    IMPLEMENT A CLASS
@@ -168,7 +168,7 @@ SYNOPSIS
    ANONYMOUS MOCKED CLASS
     This is if you just need to generate a class where the package name does
     not matter. This is done when the -takeover and -implement arguments are
-    both ommited.
+    both omitted.
 
         use Mock::Quick;
 
@@ -233,7 +233,7 @@ METRICS
     is deleted.
 
     Metrics only apply to mocked methods. When you takeover an already
-    loaded class metrics will only track overriden methods.
+    loaded class metrics will only track overridden methods.
 
 EXPORTS
     Mock-Quick uses Exporter::Declare. This allows for exports to be
@@ -252,7 +252,7 @@ EXPORTS
     $obj = qstrict( attribute => value, ... )
     ( $obj, $control ) = qstrictc( attribute => value, ... )
         Create a stricter object, get/set accessors will not autovivify into
-        existance for undefined attributes.
+        existence for undefined attributes.
 
     $control = qclass( -config => ..., name => $value || sub { ... }, ... )
         Define an anonymous package with the desired methods and
@@ -4,8 +4,9 @@ use warnings;
 
 use Mock::Quick::Util;
 use Scalar::Util qw/blessed weaken/;
-use Carp qw/croak confess/;
+use Carp qw/croak confess carp/;
 
+our @CARP_NOT = ('Mock::Quick', 'Mock::Quick::Object');
 our $ANON = 'AAAAAAAAAA';
 
 sub package      { shift->{'-package'}  }
@@ -180,6 +181,9 @@ sub override {
     for my $name ( keys %pairs ) {
         my $orig_value = $pairs{$name};
 
+        carp "Overriding non-existent method '$name'"
+            if $self->is_takeover && !$package->can($name);
+
         my $real_value = _is_sub_ref( $orig_value )
             ? sub { $metrics->{$name}++; return $orig_value->(@_) }
             : sub { $metrics->{$name}++; return $orig_value };
@@ -330,7 +334,7 @@ You can also use the 'implement' method instead of new:
 
 This is if you just need to generate a class where the package name does not
 matter. This is done when the -takeover and -implement arguments are both
-ommited.
+omitted.
 
     use Mock::Quick::Class;
 
@@ -393,7 +397,7 @@ You can also do this through new()
 
 While the control object exists, it can be accessed via
 C<YOUR::PACKAGE->MQ_CONTROL()>. It is important to note that this method will
-dissapear whenever the control object you track falls out of scope.
+disappear whenever the control object you track falls out of scope.
 
 Example (taken from Class.t):
 
@@ -54,7 +54,7 @@ alt_meth can => (
 );
 
 # http://perldoc.perl.org/perlobj.html#Default-UNIVERSAL-methods
-# DOES is equivilent to isa by default
+# DOES is equivalent to isa by default
 sub isa     { no warnings 'misc'; goto &UNIVERSAL::isa     }
 sub DOES    { goto &isa                                    }
 sub VERSION { no warnings 'misc'; goto &UNIVERSAL::VERSION }
@@ -9,7 +9,7 @@ use Mock::Quick::Method;
 use Mock::Quick::Util;
 use Carp qw/carp/;
 
-our $VERSION = '1.107';
+our $VERSION = '1.108';
 
 import_arguments qw/intercept/;
 
@@ -40,8 +40,8 @@ for my $operation ( keys %CLASS_RELATED ) {
             if defined wantarray;
 
         my $caller = caller;
-        return $caller->QINTERCEPT->( sub { Mock::Quick::Class->$meth(@args) } )
-            if $caller->can('QINTERCEPT');
+        return $caller->QINTERCEPT->(sub { Mock::Quick::Class->$meth(@args) })
+            if $caller->can( 'QINTERCEPT' );
 
         carp "Return value is ignored, your mock is destroyed as soon as it is created.";
     };
@@ -100,14 +100,14 @@ Mock-Quick is here to solve the current problems with Mocking libraries.
 There are a couple Mocking libraries available on CPAN. The primary problems
 with these libraries include verbose syntax, and most importantly side-effects.
 Some Mocking libraries expect you to mock a specific class, and will unload it
-then redefine it. This is particularily a problem if you only want to override
+then redefine it. This is particularly a problem if you only want to override
 a class on a lexical level.
 
 Mock-Object provides a declarative mocking interface that results in a very
-concise, but clear syntax. There are seperate facilities for mocking object
+concise, but clear syntax. There are separate facilities for mocking object
 instances, and classes. You can quickly create an instance of an object with
 custom attributes and methods. You can also quickly create an anonymous class,
-optionally inhereting from another, with whatever methods you desire.
+optionally inheriting from another, with whatever methods you desire.
 
 Mock-Object also provides a tool that provides an OO interface to overriding
 methods in existing classes. This tool also allows for the restoration of the
@@ -216,7 +216,7 @@ you use strict mocking, or choose not to import qmeth() and qclear().
 =head2 MOCKING CLASSES
 
 B<Note:> the control object returned here is of type L<Mock::Quick::Class>,
-wheras control objects for qobj style objects are of
+whereas control objects for qobj style objects are of
 L<Mock::Quick::Object::Control>.
 
 =head3 IMPLEMENT A CLASS
@@ -272,7 +272,7 @@ You can also use the qimplement() method instead of qclass:
 
 This is if you just need to generate a class where the package name does not
 matter. This is done when the -takeover and -implement arguments are both
-ommited.
+omitted.
 
     use Mock::Quick;
 
@@ -338,7 +338,7 @@ where keys are method names, and values are the number of times the method has
 been called. When a method is altered or removed the key is deleted.
 
 Metrics only apply to mocked methods. When you takeover an already loaded class
-metrics will only track overriden methods.
+metrics will only track overridden methods.
 
 =head1 EXPORTS
 
@@ -361,7 +361,7 @@ See L<Mock::Quick::Object> for more.
 
 =item ( $obj, $control ) = qstrictc( attribute => value, ... )
 
-Create a stricter object, get/set accessors will not autovivify into existance
+Create a stricter object, get/set accessors will not autovivify into existence
 for undefined attributes.
 
 =item $control = qclass( -config => ..., name => $value || sub { ... }, ... )
@@ -123,6 +123,15 @@ tests takeover => sub {
 
     is( Baz->foo, 'foo', 'original' );
     ok( !Baz->can('MQ_CONTROL'), "Removed control" );
+
+    $obj = $CLASS->takeover('Baz');
+    my @warnings;
+    {
+        local $SIG{__WARN__} = sub { push @warnings => @_ };
+        $obj->override('not_implemented', sub { 'xxx' });
+    }
+    is(@warnings, 1, "got a warnings");
+    like($warnings[0], qr/Overriding non-existent method 'not_implemented'/, "Warning is what we wanted");
 };
 
 tests implement => sub {