Bug#674625: libtest-mockmodule-perl: unmock() on an inherited method does not behave properly

Frédéric Brière fbriere at fbriere.net
Sat May 26 02:12:35 UTC 2012


Package: libtest-mockmodule-perl
Version: 0.05-2
Severity: normal
Tags: upstream
Forwarded: https://rt.cpan.org/Ticket/Display.html?id=77439

When unmocking a method that was not originally defined in the mocked
module, but rather inherited from a parent class, unmock() will install
a copy of the inherited method in the child class. This will subtly
break if the parent method ever changes, such as illustrated in the
attached example.

I think that mock() should not bother with can() if &{$sub_name} does
not exist, and merely store undef. (OTOH, it may be argued that
original() should returned the inherited method. Hmm.) 


-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (x86_64)

Kernel: Linux 3.2.0-2-amd64 (SMP w/3 CPU cores)
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages libtest-mockmodule-perl depends on:
ii  perl  5.14.2-10

libtest-mockmodule-perl recommends no packages.

libtest-mockmodule-perl suggests no packages.

-- no debconf information
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mock.pl
Type: text/x-perl
Size: 471 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-perl-maintainers/attachments/20120525/62d8188f/attachment.pl>


More information about the pkg-perl-maintainers mailing list