summaryrefslogtreecommitdiff
path: root/lib/base
diff options
context:
space:
mode:
authornothingmuch@woobling.org <nothingmuch@woobling.org>2004-01-18 15:15:46 +0000
committerDave Mitchell <davem@fdisolutions.com>2004-01-24 16:13:17 +0000
commit8731c5d9eb453a5b2d087dabd7a5f51b576b8048 (patch)
tree2e9f87e2d418447d00a68eeef07b666ff7383796 /lib/base
parent6eb87ff8bf4b0fb28bd1498a03b1502cf11429d2 (diff)
downloadperl-8731c5d9eb453a5b2d087dabd7a5f51b576b8048.tar.gz
[perl #24942] fields::inherit doesn't bless derived
package's \%FIELDS, results in phash deprecation errors. From: "nothingmuch@woobling.org (via RT)" <perlbug-followup@perl.org> Message-Id: <rt-3.0.8-24942-70144.16.7177902690315@perl.org> p4raw-id: //depot/perl@22208
Diffstat (limited to 'lib/base')
-rw-r--r--lib/base/t/fields-base.t26
1 files changed, 25 insertions, 1 deletions
diff --git a/lib/base/t/fields-base.t b/lib/base/t/fields-base.t
index b5ab54f7cb..f4a17f5032 100644
--- a/lib/base/t/fields-base.t
+++ b/lib/base/t/fields-base.t
@@ -20,7 +20,7 @@ BEGIN {
}
use strict;
-use Test::More tests => 25;
+use Test::More tests => 26;
BEGIN { use_ok('base'); }
@@ -194,3 +194,27 @@ eval {
::like( $@, qr/Can't multiply inherit %FIELDS/i, 'Again, no multi inherit' );
+# Test that a package with no fields can inherit from a package with
+# fields, and that pseudohash messages don't show up
+
+package B9;
+use fields qw(b1);
+
+sub _mk_obj { fields::new($_[0])->{'b1'} };
+
+package D9;
+use base qw(B9);
+
+package main;
+
+{
+ my $w = 0;
+ local $SIG{__WARN__} = sub { $w++ };
+
+ B9->_mk_obj();
+ # used tp emit a warning that pseudohashes are deprecated, because
+ # %FIELDS wasn't blessed.
+ D9->_mk_obj();
+
+ is ($w, 0, "pseudohash warnings in derived class with no fields of it's own");
+}