X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Ffields.pm;h=be2a7aedab42c02fe4adeeaed087c85cff31b564;hb=8906a23eaf1b10abd420be0a2fffed84df224b05;hp=734cc0db1d20dfdd1744404ee59eb4a655b9ec4c;hpb=479ba38336aaacaf3a7e00a4662d83e2dc833197;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/fields.pm b/lib/fields.pm index 734cc0d..be2a7ae 100644 --- a/lib/fields.pm +++ b/lib/fields.pm @@ -57,7 +57,7 @@ class fields using this pragma, then the operation is turned into an array access at compile time. The related C pragma will combine fields from base classes and any -fields declared using the C pragma. This enables fields +fields declared using the C pragma. This enables field inheritance to work properly. Field names that start with an underscore character are made private to @@ -85,9 +85,9 @@ This makes it possible to write a constructor like this: sub new { my Critter::Sounds $self = shift; - $self = fields::new($class) unless ref $self; + $self = fields::new($self) unless ref $self; $self->{cat} = 'meow'; # scalar element - @$self->{'dog','bird'} = ('bark','tweet'); # slice + @$self{'dog','bird'} = ('bark','tweet'); # slice return $self; } @@ -127,12 +127,13 @@ L =cut -use 5.005_64; +use 5.006_001; use strict; no strict 'refs'; +use warnings::register; our(%attr, $VERSION); -$VERSION = "1.01"; +$VERSION = "1.02"; # some constants sub _PUBLIC () { 1 } @@ -171,7 +172,7 @@ sub import { if ($fno and $fno != $next) { require Carp; if ($fno < $fattr->[0]) { - Carp::carp("Hides field '$f' in base class") if $^W; + warnings::warnif("Hides field '$f' in base class") ; } else { Carp::croak("Field name '$f' already in use"); }