[libclass-virtual-perl] 07/11: Anything imported into Class::Virtual or Class::Virtually::Abstract's namespace gets inherited. So we import as little as possible. rt.cpan.org 6298

dom at earth.li dom at earth.li
Wed Aug 23 14:00:17 UTC 2017


This is an automated email from the git hooks/post-receive script.

dom pushed a commit to tag v0.06
in repository libclass-virtual-perl.

commit 9faba1ad351693745127e2d3fe01cdd3ec430fe3
Author: Michael G. Schwern <schwern at pobox.com>
Date:   Fri Dec 31 06:30:16 2004 +0000

    Anything imported into Class::Virtual or Class::Virtually::Abstract's
    namespace gets inherited.  So we import as little as possible.
    rt.cpan.org 6298
    
    git-svn-id: file:///Users/schwern/tmp/svn/CPAN/Class-Virtual/trunk@2286 8151f2b9-fde8-0310-94fd-f048d12aab9e
---
 Changes                         |  4 +++-
 MANIFEST                        |  5 +++--
 lib/Class/Virtual.pm            | 11 +++++------
 lib/Class/Virtually/Abstract.pm |  3 +--
 t/assert.t                      | 12 ++++++++++++
 5 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/Changes b/Changes
index 4cba633..2ab0713 100644
--- a/Changes
+++ b/Changes
@@ -1,7 +1,9 @@
 Change log for Perl module Class::Virtual
 
 0.05
-    - Added a license.  [rt.cpan.org 8229]
+    - Added a license and copyright.  [rt.cpan.org 8229]
+    - Fixed it so assert and affirm don't leak out from internal use of
+      Carp::Assert [rt.cpan.org 6298]
 
 0.04  Sun Oct 19 22:18:59 PDT 2003
     * Class::Virtually::Abstract was missing a $VERSION
diff --git a/MANIFEST b/MANIFEST
index 7bdbfc4..5cd0a5f 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,7 +1,8 @@
 Changes
-MANIFEST
-Makefile.PL
 lib/Class/Virtual.pm
 lib/Class/Virtually/Abstract.pm
+Makefile.PL
+MANIFEST
 t/Abstract.t
+t/assert.t
 t/Virtual.t
diff --git a/lib/Class/Virtual.pm b/lib/Class/Virtual.pm
index 9c8c9fc..3ca11f4 100644
--- a/lib/Class/Virtual.pm
+++ b/lib/Class/Virtual.pm
@@ -4,10 +4,9 @@ use strict;
 use vars qw($VERSION @ISA);
 $VERSION = '0.05';
 
-use Carp::Assert;
+use Carp::Assert qw(DEBUG);  # import only the tiny bit we need so it doesn't
+                             # get inherited.
 use Class::ISA;
-# Class::ISA doesn't export?!
-*self_and_super_path = \&Class::ISA::self_and_super_path;
 
 use Class::Data::Inheritable;
 @ISA = qw(Class::Data::Inheritable);
@@ -160,7 +159,7 @@ sub missing_methods {
     my($class) = shift;
 
     my @vmeths = $class->virtual_methods;
-    my @super_classes = self_and_super_path($class);
+    my @super_classes = Class::ISA::self_and_super_path($class);
     my $vclass = $class->__virtual_base_class;
 
     # Remove everything in the hierarchy beyond, and including,
@@ -168,7 +167,7 @@ sub missing_methods {
     my $sclass;
     do {
         $sclass = pop @super_classes;
-        assert( defined $sclass ) if DEBUG;
+        Carp::Assert::assert( defined $sclass ) if DEBUG;
     } until $sclass eq $vclass;
 
     my @missing = ();
@@ -204,7 +203,7 @@ Michael G Schwern E<lt>schwern at pobox.comE<gt>
 
 =head1 LEGAL
 
-Copyright Michael G Schwern
+Copyright 2000, 2001, 2003, 2004 Michael G Schwern
 
 This program is free software; you can redistribute it and/or 
 modify it under the same terms as Perl itself.
diff --git a/lib/Class/Virtually/Abstract.pm b/lib/Class/Virtually/Abstract.pm
index 1a5329c..cfbf1b7 100644
--- a/lib/Class/Virtually/Abstract.pm
+++ b/lib/Class/Virtually/Abstract.pm
@@ -4,10 +4,9 @@ require Class::Virtual;
 @ISA = qw(Class::Virtual);
 
 use strict;
-use Carp::Assert;
 
 use vars qw(%Registered $VERSION);
-$VERSION = '0.02';
+$VERSION = '0.03';
 
 {
     no strict 'refs';
diff --git a/t/assert.t b/t/assert.t
new file mode 100644
index 0000000..cd3d9d5
--- /dev/null
+++ b/t/assert.t
@@ -0,0 +1,12 @@
+#!/usr/bin/perl -w
+
+# rt.cpan.org 6298
+use Test::More tests => 1;
+
+package Foo;
+
+use base qw(Class::Virtually::Abstract);
+eval {
+    __PACKAGE__->virtual_methods(qw(assert affirm));
+};
+::is $@, '', 'assert and affirm do not leak';

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libclass-virtual-perl.git



More information about the Pkg-perl-cvs-commits mailing list