r34791 - in /trunk/libclass-accessor-perl: ./ debian/ examples/ lib/Class/ lib/Class/Accessor/ t/

eloy at users.alioth.debian.org eloy at users.alioth.debian.org
Tue May 5 08:16:21 UTC 2009


Author: eloy
Date: Tue May  5 08:16:16 2009
New Revision: 34791

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=34791
Log:
new upstream version

Added:
    trunk/libclass-accessor-perl/t/caller.t
      - copied unchanged from r34790, branches/upstream/libclass-accessor-perl/current/t/caller.t
Modified:
    trunk/libclass-accessor-perl/Changes
    trunk/libclass-accessor-perl/MANIFEST
    trunk/libclass-accessor-perl/META.yml
    trunk/libclass-accessor-perl/Makefile.PL
    trunk/libclass-accessor-perl/README
    trunk/libclass-accessor-perl/debian/changelog
    trunk/libclass-accessor-perl/debian/compat
    trunk/libclass-accessor-perl/debian/control
    trunk/libclass-accessor-perl/debian/copyright
    trunk/libclass-accessor-perl/debian/rules
    trunk/libclass-accessor-perl/examples/benchmark
    trunk/libclass-accessor-perl/lib/Class/Accessor.pm
    trunk/libclass-accessor-perl/lib/Class/Accessor/Fast.pm
    trunk/libclass-accessor-perl/lib/Class/Accessor/Faster.pm

Modified: trunk/libclass-accessor-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclass-accessor-perl/Changes?rev=34791&op=diff
==============================================================================
--- trunk/libclass-accessor-perl/Changes (original)
+++ trunk/libclass-accessor-perl/Changes Tue May  5 08:16:16 2009
@@ -1,3 +1,9 @@
+0.33 Tue May  5 00:15:09 JST 2009
+    - small cleanups to fix RT#45592 and RT#43493
+
+0.32 Tue Jun 10 10:31:06 JST 2008
+    - use Sub::Name to give names to anon subs to fix RT#17856
+
 0.31 Wed Jul 11 23:03:47 JST 2007
     - applied performance patch from RUZ
 

Modified: trunk/libclass-accessor-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclass-accessor-perl/MANIFEST?rev=34791&op=diff
==============================================================================
--- trunk/libclass-accessor-perl/MANIFEST (original)
+++ trunk/libclass-accessor-perl/MANIFEST Tue May  5 08:16:16 2009
@@ -13,3 +13,4 @@
 t/bestpractice.t
 t/croak.t
 t/getset.t
+t/caller.t

Modified: trunk/libclass-accessor-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclass-accessor-perl/META.yml?rev=34791&op=diff
==============================================================================
--- trunk/libclass-accessor-perl/META.yml (original)
+++ trunk/libclass-accessor-perl/META.yml Tue May  5 08:16:16 2009
@@ -1,11 +1,14 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
-name:         Class-Accessor
-version:      0.31
-version_from: lib/Class/Accessor.pm
-installdirs:  site
-requires:
+--- #YAML:1.0
+name:                Class-Accessor
+version:             0.33
+abstract:            ~
+license:             perl
+author:              
+    - Marty Pauley <marty+perl at kasei.com>
+generated_by:        ExtUtils::MakeMaker version 6.42
+distribution_type:   module
+requires:     
     base:                          1.01
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.30_01
+meta-spec:
+    url:     http://module-build.sourceforge.net/META-spec-v1.3.html
+    version: 1.3

Modified: trunk/libclass-accessor-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclass-accessor-perl/Makefile.PL?rev=34791&op=diff
==============================================================================
--- trunk/libclass-accessor-perl/Makefile.PL (original)
+++ trunk/libclass-accessor-perl/Makefile.PL Tue May  5 08:16:16 2009
@@ -6,5 +6,6 @@
     NAME                => 'Class::Accessor',
     VERSION_FROM        => 'lib/Class/Accessor.pm',
     AUTHOR              => 'Marty Pauley <marty+perl at kasei.com>',
+    LICENSE             => 'perl',
     PREREQ_PM           => { base => $] == 5.006 ? 1.02 : 1.01, },
 );

Modified: trunk/libclass-accessor-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclass-accessor-perl/README?rev=34791&op=diff
==============================================================================
--- trunk/libclass-accessor-perl/README (original)
+++ trunk/libclass-accessor-perl/README Tue May  5 08:16:16 2009
@@ -8,35 +8,14 @@
     This module automagically generates accessors/mutators for your class.
 
     Most of the time, writing accessors is an exercise in cutting and
-    pasting. You usually wind up with a series of methods like this:
-
-        sub name {
-            my $self = shift;
-            if(@_) {
-                $self->{name} = $_[0];
-            }
-            return $self->{name};
-        }
-
-        sub salary {
-            my $self = shift;
-            if(@_) {
-                $self->{salary} = $_[0];
-            }
-            return $self->{salary};
-        }
-
-      # etc...
-
-    One for each piece of data in your object. While some will be unique,
+    pasting. You usually wind up with a series of almost identical methods,
+    one for each piece of data in your object. While some will be unique,
     doing value checks and special storage tricks, most will simply be
-    exercises in repetition. Not only is it Bad Style to have a bunch of
-    repetitious code, but its also simply not lazy, which is the real
-    tragedy.
+    exercises in repetition.
 
     If you make your module a subclass of Class::Accessor and declare your
     accessor fields with mk_accessors() then you'll find yourself with a set
-    of automatically generated accessors which can even be customized!
+    of automatically generated accessors, which can even be customized!
 
     The basic set up is very simple:
 
@@ -49,24 +28,22 @@
 BENCHMARKS
 
     accessors:
-                 Rate   Basic Average    Fast  Faster  Direct
-    Basic    189150/s      --    -42%    -51%    -55%    -89%
-    Average  327679/s     73%      --    -16%    -22%    -82%
-    Fast     389212/s    106%     19%      --     -8%    -78%
-    Faster   421646/s    123%     29%      8%      --    -76%
-    Direct  1771243/s    836%    441%    355%    320%      --
+              Rate  Basic   Fast Faster Direct
+    Basic   367589/s     --   -51%   -55%   -89%
+    Fast    747964/s   103%     --    -9%   -77%
+    Faster  819199/s   123%    10%     --   -75%
+    Direct 3245887/s   783%   334%   296%     --
 
     mutators:
-                 Rate   Basic Average    Fast  Faster  Direct
-    Basic    173769/s      --    -34%    -53%    -59%    -90%
-    Average  263046/s     51%      --    -29%    -38%    -85%
-    Fast     371158/s    114%     41%      --    -13%    -78%
-    Faster   425821/s    145%     62%     15%      --    -75%
-    Direct  1699081/s    878%    546%    358%    299%      --
+              Rate    Acc   Fast Faster Direct
+    Acc     265564/s     --   -54%   -63%   -91%
+    Fast    573439/s   116%     --   -21%   -80%
+    Faster  724710/s   173%    26%     --   -75%
+    Direct 2860979/s   977%   399%   295%     --
 
 AUTHORS
 
-    Copyright 2007 Marty Pauley <marty+perl at kasei.com>
+    Copyright 2009 Marty Pauley <marty+perl at kasei.com>
 
     This program is free software; you can redistribute it and/or modify it
     under the same terms as Perl itself. That means either (a) the GNU

Modified: trunk/libclass-accessor-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclass-accessor-perl/debian/changelog?rev=34791&op=diff
==============================================================================
--- trunk/libclass-accessor-perl/debian/changelog (original)
+++ trunk/libclass-accessor-perl/debian/changelog Tue May  5 08:16:16 2009
@@ -1,3 +1,13 @@
+libclass-accessor-perl (0.33-1) UNRELEASED; urgency=low
+
+  * New upstream release
+  * Migrate package to debhelper7, update debian/compat, debian/control 
+    and debian/rules
+  * debian/control: Update Standards-Version to 3.8.1, Add libsub-name-perl to
+    dependencies
+
+ -- Krzysztof Krzyżaniak (eloy) <eloy at debian.org>  Tue, 05 May 2009 09:49:02 +0200
+
 libclass-accessor-perl (0.31-3) UNRELEASED; urgency=low
 
   * debian/control: Added: Vcs-Svn field (source stanza); Vcs-Browser

Modified: trunk/libclass-accessor-perl/debian/compat
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclass-accessor-perl/debian/compat?rev=34791&op=diff
==============================================================================
--- trunk/libclass-accessor-perl/debian/compat (original)
+++ trunk/libclass-accessor-perl/debian/compat Tue May  5 08:16:16 2009
@@ -1,1 +1,1 @@
-5
+7

Modified: trunk/libclass-accessor-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclass-accessor-perl/debian/control?rev=34791&op=diff
==============================================================================
--- trunk/libclass-accessor-perl/debian/control (original)
+++ trunk/libclass-accessor-perl/debian/control Tue May  5 08:16:16 2009
@@ -3,16 +3,16 @@
 Priority: optional
 Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
 Uploaders: Krzysztof Krzyzaniak (eloy) <eloy at debian.org>, gregor herrmann <gregor+debian at comodo.priv.at>
-Build-Depends: debhelper (>= 5), quilt
-Build-Depends-Indep: perl (>= 5.6.0-16)
-Standards-Version: 3.7.2
+Build-Depends: debhelper (>= 7), quilt
+Build-Depends-Indep: perl (>= 5.6.0-16), libsub-name-perl
+Standards-Version: 3.8.1
 Homepage: http://search.cpan.org/dist/Class-Accessor/
 Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libclass-accessor-perl/
 Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libclass-accessor-perl/
 
 Package: libclass-accessor-perl
 Architecture: all
-Depends: ${misc:Depends}, perl (>= 5.6.1-7)
+Depends: ${misc:Depends}, perl (>= 5.6.1-7), libsub-name-perl
 Description: Automated accessor generator
  The Class::Accessor module automagically generates accessor/mutators
  for your class.

Modified: trunk/libclass-accessor-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclass-accessor-perl/debian/copyright?rev=34791&op=diff
==============================================================================
--- trunk/libclass-accessor-perl/debian/copyright (original)
+++ trunk/libclass-accessor-perl/debian/copyright Tue May  5 08:16:16 2009
@@ -1,22 +1,34 @@
-This package was debianized by Stephen Quinney <sjq at debian.org> on
-Thu, 06 Mar 2003 12:07:07 +0000
+Format-Specification:
+    http://wiki.debian.org/Proposals/CopyrightFormat?action=recall&rev=196
+Upstream-Maintainer: Marty Pauley <marty+perl at kasei.com>
+Upstream-Source: http://search.cpan.org/dist/Class-Accessor/
+Upstream-Name: Class-Accessor
 
-It was downloaded from http://www.cpan.org/modules/by-module/Class/
+Files: *
+Copyright: 
+    © 1999-2006 Michael G Schwern <schwern at pobox.com>
+    © 2007-2009 Marty Pauley <marty+perl at kasei.com>
+License-Alias: Perl
+License: Artistic | GPL-1+
 
-Upstream Maintainer: Marty Pauley <marty at kasei.com>
-Author: Michael G Schwern <schwern at pobox.com>
 
-Copyright:
+Files: debian/*
+Copyright: 
+    © 2003-2006, Stephen Quinney <sjq at debian.org>
+    © 2006-2009, Krzysztof Krzyżaniak (eloy) <eloy at debian.org>
+    © 2008-2009, gregor herrmann <gregoa at debian.org>
+License: Artistic | GPL-1+
 
+License: Artistic
     This program is free software; you can redistribute it and/or modify
-    it under the terms of either:
+    it under the terms of the Artistic License, which comes with Perl.
+    On Debian GNU/Linux systems, the complete text of the Artistic License
+    can be found in `/usr/share/common-licenses/Artistic'
 
-    a) the GNU General Public License as published by the Free Software
-       Foundation; either version 1, or (at your option) any later
-       version, or
-
-    b) the "Artistic License" which comes with Perl.
-
+License: GPL-1+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 1, or (at your option)
+    any later version.
     On Debian GNU/Linux systems, the complete text of the GNU General
-    Public License can be found in `/usr/share/common-licenses/GPL' and
-    the Artistic Licence in `/usr/share/common-licenses/Artistic'.
+    Public License can be found in `/usr/share/common-licenses/GPL'

Modified: trunk/libclass-accessor-perl/debian/rules
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclass-accessor-perl/debian/rules?rev=34791&op=diff
==============================================================================
--- trunk/libclass-accessor-perl/debian/rules (original)
+++ trunk/libclass-accessor-perl/debian/rules Tue May  5 08:16:16 2009
@@ -1,76 +1,23 @@
 #!/usr/bin/make -f
-# Sample debian/rules that uses debhelper.
-# GNU copyright 1997 to 1999 by Joey Hess.
 
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
+build: build-stamp
+build-stamp:
+	dh build
+	touch $@
 
-include /usr/share/quilt/quilt.make
+clean:
+	dh $@
 
-# Define the perl interpreter
+install: install-stamp
+install-stamp: build-stamp
+	dh install
+	touch $@
 
-PERL = /usr/bin/perl
+binary-arch:
 
-PACKAGE = $(shell dh_listpackages)
+binary-indep: install
+	dh $@
 
-TMP = $(CURDIR)/debian/$(PACKAGE)
+binary: binary-arch binary-indep
 
-configure: configure-stamp
-configure-stamp:
-	dh_testdir
-
-	perl Makefile.PL verbose INSTALLDIRS=vendor
-
-	touch configure-stamp
-
-
-build: patch build-stamp
-build-stamp: configure-stamp 
-	dh_testdir
-
-	$(MAKE)
-	$(MAKE) test
-	touch build-stamp
-
-clean: unpatch
-	dh_testdir
-	dh_testroot
-
-	[ ! -e Makefile ] || $(MAKE) distclean
-
-	dh_clean build-stamp configure-stamp
-
-install: build
-	dh_testdir
-	dh_testroot
-	dh_clean -k
-	dh_installdirs
-
-	$(MAKE) install PREFIX=$(TMP)/usr
-
-	# Remove any empty directories
-
-	[ ! -d $(CURDIR)/debian/$(shell dh_listpackages)/usr/lib/perl5 ] || rmdir --ignore-fail-on-non-empty --parents --verbose $(CURDIR)/debian/$(shell dh_listpackages)/usr/lib/perl5
-
-# Build architecture-independent files here.
-binary-arch: build install
-# We have nothing to do by default.
-
-# Build architecture-dependent files here.
-binary-indep: build install
-	dh_testdir
-	dh_testroot
-	dh_perl
-	dh_installdocs README
-	dh_installman
-	dh_installchangelogs Changes
-	dh_installexamples examples/*
-	dh_compress
-	dh_fixperms
-	dh_installdeb
-	dh_gencontrol
-	dh_md5sums
-	dh_builddeb
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install configure
+.PHONY: binary binary-arch binary-indep install clean build

Modified: trunk/libclass-accessor-perl/examples/benchmark
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclass-accessor-perl/examples/benchmark?rev=34791&op=diff
==============================================================================
--- trunk/libclass-accessor-perl/examples/benchmark (original)
+++ trunk/libclass-accessor-perl/examples/benchmark Tue May  5 08:16:16 2009
@@ -9,17 +9,6 @@
 
 package Bench::Direct;
 use base qw(Bench::Base);
-
-package Bench::ByHand;
-use base qw(Bench::Base);
-
-sub test {
-    my($self) = shift;
-    if( @_ ) {
-        $self->{test} = (@_ == 1 ? $_[0] : [@_]);
-    }
-    return $self->{test};
-}
 
 package Bench::Class::Accessor;
 use base qw(Class::Accessor);
@@ -39,7 +28,6 @@
 my $fast   = Bench::Class::Accessor::Fast->new(\%init);
 my $faster = Bench::Class::Accessor::Faster->new(\%init);
 my $direct = Bench::Direct->new;
-my $byhand = Bench::ByHand->new;
 
 my $foo;
 my $control = 42;
@@ -55,7 +43,6 @@
             'Basic' => sub { $foo = $ca->test; },
             'Fast' => sub { $foo = $fast->test; },
             'Faster' => sub { $foo = $faster->test; },
-            'Average' => sub { $foo = $byhand->test; },
             'Direct' => sub { $foo = $direct->{test}; }
            }
          );
@@ -66,7 +53,6 @@
             'Acc' => sub { $ca->test(42); },
             'Fast' => sub { $fast->test(42); },
             'Faster' => sub { $faster->test(42); },
-            'By hand' => sub { $byhand->test(42); },
             'Direct' => sub { $direct->{test} = 42; }
            }
          );

Modified: trunk/libclass-accessor-perl/lib/Class/Accessor.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclass-accessor-perl/lib/Class/Accessor.pm?rev=34791&op=diff
==============================================================================
--- trunk/libclass-accessor-perl/lib/Class/Accessor.pm (original)
+++ trunk/libclass-accessor-perl/lib/Class/Accessor.pm Tue May  5 08:16:16 2009
@@ -1,7 +1,7 @@
 package Class::Accessor;
 require 5.00502;
 use strict;
-$Class::Accessor::VERSION = '0.31';
+$Class::Accessor::VERSION = '0.33';
 
 =head1 NAME
 
@@ -9,16 +9,17 @@
 
 =head1 SYNOPSIS
 
-  package Employee;
+  package Foo;
   use base qw(Class::Accessor);
-  Employee->mk_accessors(qw(name role salary));
+  Foo->follow_best_practice;
+  Foo->mk_accessors(qw(name role salary));
 
   # Meanwhile, in a nearby piece of code!
   # Class::Accessor provides new().
   my $mp = Foo->new({ name => "Marty", role => "JAPH" });
 
   my $job = $mp->role;  # gets $mp->{role}
-  $mp->salary(400000);  # sets $mp->{salary} = 400000 (I wish)
+  $mp->salary(400000);  # sets $mp->{salary} = 400000 # I wish
   
   # like my @info = @{$mp}{qw(name role)}
   my @info = $mp->get(qw(name role));
@@ -55,7 +56,7 @@
 One for each piece of data in your object.  While some will be unique,
 doing value checks and special storage tricks, most will simply be
 exercises in repetition.  Not only is it Bad Style to have a bunch of
-repetitious code, but its also simply not lazy, which is the real
+repetitious code, but it's also simply not lazy, which is the real
 tragedy.
 
 If you make your module a subclass of Class::Accessor and declare your
@@ -65,12 +66,22 @@
 
 The basic set up is very simple:
 
-    package My::Class;
+    package Foo;
     use base qw(Class::Accessor);
-    My::Class->mk_accessors( qw(foo bar car) );
-
-Done.  My::Class now has simple foo(), bar() and car() accessors
+    Foo->mk_accessors( qw(far bar car) );
+
+Done.  Foo now has simple far(), bar() and car() accessors
 defined.
+
+Alternatively, if you want to follow Damian's I<best practice> guidelines 
+you can use:
+
+    package Foo;
+    use base qw(Class::Accessor);
+    Foo->follow_best_practice;
+    Foo->mk_accessors( qw(far bar car) );
+
+B<Note:> you must call C<follow_best_practice> before calling C<mk_accessors>.
 
 =head2 What Makes This Different?
 
@@ -86,10 +97,10 @@
 
 =head2 new
 
-    my $obj = Class->new;
+    my $obj = Foo->new;
     my $obj = $other_obj->new;
 
-    my $obj = Class->new(\%fields);
+    my $obj = Foo->new(\%fields);
     my $obj = $other_obj->new(\%fields);
 
 Class::Accessor provides a basic constructor.  It generates a
@@ -104,7 +115,7 @@
     use base qw(Class::Accessor);
     Foo->mk_accessors('foo');
 
-    my $obj = Class->new({ foo => 42 });
+    my $obj = Foo->new({ foo => 42 });
     print $obj->foo;    # 42
 
 however %fields can contain anything, new() will shove them all into
@@ -124,7 +135,7 @@
 
 =head2 mk_accessors
 
-    Class->mk_accessors(@fields);
+    __PACKAGE__->mk_accessors(@fields);
 
 This creates accessor/mutator methods for each named field given in
 @fields.  Foreach field in @fields it will generate two accessors.
@@ -132,7 +143,7 @@
 example:
 
     # Generates foo(), _foo_accessor(), bar() and _bar_accessor().
-    Class->mk_accessors(qw(foo bar));
+    __PACKAGE__->mk_accessors(qw(foo bar));
 
 See L<CAVEATS AND TRICKS/"Overriding autogenerated accessors">
 for details.
@@ -145,9 +156,19 @@
     $self->_mk_accessors('rw', @fields);
 }
 
+if (eval { require Sub::Name }) {
+    Sub::Name->import;
+}
 
 {
     no strict 'refs';
+
+    sub follow_best_practice {
+        my($self) = @_;
+        my $class = ref $self || $self;
+        *{"${class}::accessor_name_for"}  = \&best_practice_accessor_name_for;
+        *{"${class}::mutator_name_for"}  = \&best_practice_mutator_name_for;
+    }
 
     sub _mk_accessors {
         my($self, $access, @fields) = @_;
@@ -170,37 +191,43 @@
                 } else {
                     $accessor = $self->make_wo_accessor($field);
                 }
-                unless (defined &{"${class}::$accessor_name"}) {
-                    *{"${class}::$accessor_name"} = $accessor;
+                my $fullname = "${class}::$accessor_name";
+                my $subnamed = 0;
+                unless (defined &{$fullname}) {
+                    subname($fullname, $accessor) if defined &subname;
+                    $subnamed = 1;
+                    *{$fullname} = $accessor;
                 }
                 if ($accessor_name eq $field) {
                     # the old behaviour
-                    my $alias = "_${field}_accessor";
-                    *{"${class}::$alias"} = $accessor unless defined &{"${class}::$alias"};
+                    my $alias = "${class}::_${field}_accessor";
+                    subname($alias, $accessor) if defined &subname and not $subnamed;
+                    *{$alias} = $accessor unless defined &{$alias};
                 }
             } else {
-                if ($ra and not defined &{"${class}::$accessor_name"}) {
-                    *{"${class}::$accessor_name"} = $self->make_ro_accessor($field);
+                my $fullaccname = "${class}::$accessor_name";
+                my $fullmutname = "${class}::$mutator_name";
+                if ($ra and not defined &{$fullaccname}) {
+                    my $accessor = $self->make_ro_accessor($field);
+                    subname($fullaccname, $accessor) if defined &subname;
+                    *{$fullaccname} = $accessor;
                 }
-                if ($wa and not defined &{"${class}::$mutator_name"}) {
-                    *{"${class}::$mutator_name"} = $self->make_wo_accessor($field);
+                if ($wa and not defined &{$fullmutname}) {
+                    my $mutator = $self->make_wo_accessor($field);
+                    subname($fullmutname, $mutator) if defined &subname;
+                    *{$fullmutname} = $mutator;
                 }
             }
         }
     }
 
-    sub follow_best_practice {
-        my($self) = @_;
-        my $class = ref $self || $self;
-        *{"${class}::accessor_name_for"}  = \&best_practice_accessor_name_for;
-        *{"${class}::mutator_name_for"}  = \&best_practice_mutator_name_for;
-    }
-
-}
+}
+
+
 
 =head2 mk_ro_accessors
 
-  Class->mk_ro_accessors(@read_only_fields);
+  __PACKAGE__->mk_ro_accessors(@read_only_fields);
 
 Same as mk_accessors() except it will generate read-only accessors
 (ie. true accessors).  If you attempt to set a value with these
@@ -209,7 +236,7 @@
 
     package Foo;
     use base qw(Class::Accessor);
-    Class->mk_ro_accessors(qw(foo bar));
+    Foo->mk_ro_accessors(qw(foo bar));
 
     # Let's assume we have an object $foo of class Foo...
     print $foo->foo;  # ok, prints whatever the value of $foo->{foo} is
@@ -226,19 +253,19 @@
 
 =head2 mk_wo_accessors
 
-  Class->mk_wo_accessors(@write_only_fields);
+  __PACKAGE__->mk_wo_accessors(@write_only_fields);
 
 Same as mk_accessors() except it will generate write-only accessors
 (ie. mutators).  If you attempt to read a value with these accessors
 it will throw an exception.  It only uses set() and not get().
 
 B<NOTE> I'm not entirely sure why this is useful, but I'm sure someone
-will need it.  If you've found a use, let me know.  Right now its here
-for orthoginality and because its easy to implement.
+will need it.  If you've found a use, let me know.  Right now it's here
+for orthoginality and because it's easy to implement.
 
     package Foo;
     use base qw(Class::Accessor);
-    Class->mk_wo_accessors(qw(foo bar));
+    Foo->mk_wo_accessors(qw(foo bar));
 
     # Let's assume we have an object $foo of class Foo...
     $foo->foo(42);      # OK.  Sets $self->{foo} = 42
@@ -281,6 +308,8 @@
 
     __PACKAGE__->follow_best_practice
 
+B<before> you call mk_accessors.
+
 =head2 accessor_name_for / mutator_name_for
 
 You may have your own crazy ideas for the names of the accessors, so you can
@@ -369,7 +398,7 @@
 
 =head2 make_accessor
 
-    $accessor = Class->make_accessor($field);
+    $accessor = __PACKAGE__->make_accessor($field);
 
 Generates a subroutine reference which acts as an accessor for the given
 $field.  It calls get() and set().
@@ -397,7 +426,7 @@
 
 =head2 make_ro_accessor
 
-    $read_only_accessor = Class->make_ro_accessor($field);
+    $read_only_accessor = __PACKAGE__->make_ro_accessor($field);
 
 Generates a subroutine refrence which acts as a read-only accessor for
 the given $field.  It only calls get().
@@ -424,7 +453,7 @@
 
 =head2 make_wo_accessor
 
-    $read_only_accessor = Class->make_wo_accessor($field);
+    $read_only_accessor = __PACKAGE__->make_wo_accessor($field);
 
 Generates a subroutine refrence which acts as a write-only accessor
 (mutator) for the given $field.  It only calls set().
@@ -478,20 +507,18 @@
 ones you'd write yourself.
 
   accessors:
-               Rate   Basic Average    Fast  Faster  Direct
-  Basic    189150/s      --    -42%    -51%    -55%    -89%
-  Average  327679/s     73%      --    -16%    -22%    -82%
-  Fast     389212/s    106%     19%      --     -8%    -78%
-  Faster   421646/s    123%     29%      8%      --    -76%
-  Direct  1771243/s    836%    441%    355%    320%      --
+              Rate  Basic   Fast Faster Direct
+  Basic   367589/s     --   -51%   -55%   -89%
+  Fast    747964/s   103%     --    -9%   -77%
+  Faster  819199/s   123%    10%     --   -75%
+  Direct 3245887/s   783%   334%   296%     --
 
   mutators:
-               Rate   Basic Average    Fast  Faster  Direct
-  Basic    173769/s      --    -34%    -53%    -59%    -90%
-  Average  263046/s     51%      --    -29%    -38%    -85%
-  Fast     371158/s    114%     41%      --    -13%    -78%
-  Faster   425821/s    145%     62%     15%      --    -75%
-  Direct  1699081/s    878%    546%    358%    299%      --
+              Rate    Acc   Fast Faster Direct
+  Acc     265564/s     --   -54%   -63%   -91%
+  Fast    573439/s   116%     --   -21%   -80%
+  Faster  724710/s   173%    26%     --   -75%
+  Direct 2860979/s   977%   399%   295%     --
 
 Class::Accessor::Fast is faster than methods written by an average programmer
 (where "average" is based on Schwern's example code).
@@ -505,7 +532,7 @@
 Direct hash access is, of course, much faster than all of these, but it
 provides no encapsulation.
 
-Of course, its not as simple as saying "Class::Accessor is slower than
+Of course, it's not as simple as saying "Class::Accessor is slower than
 average".  These are benchmarks for a simple accessor.  If your accessors do
 any sort of complicated work (such as talking to a database or writing to a
 file) the time spent doing that work will quickly swamp the time spend just
@@ -549,7 +576,7 @@
 
     package Foo;
     use base qw(Class::Accessor);
-    Foo->mk_accessor(qw(this that up down));
+    Foo->mk_accessors(qw(this that up down));
 
     sub get {
         my $self = shift;
@@ -611,7 +638,7 @@
         return $self->SUPER::email(@_);
     }
 
-There's a subtle problem in the last example, and its in this line:
+There's a subtle problem in the last example, and it's in this line:
 
     return $self->SUPER::email(@_);
 

Modified: trunk/libclass-accessor-perl/lib/Class/Accessor/Fast.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclass-accessor-perl/lib/Class/Accessor/Fast.pm?rev=34791&op=diff
==============================================================================
--- trunk/libclass-accessor-perl/lib/Class/Accessor/Fast.pm (original)
+++ trunk/libclass-accessor-perl/lib/Class/Accessor/Fast.pm Tue May  5 08:16:16 2009
@@ -1,7 +1,7 @@
 package Class::Accessor::Fast;
 use base 'Class::Accessor';
 use strict;
-$Class::Accessor::Fast::VERSION = '0.31';
+$Class::Accessor::Fast::VERSION = '0.33';
 
 =head1 NAME
 

Modified: trunk/libclass-accessor-perl/lib/Class/Accessor/Faster.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libclass-accessor-perl/lib/Class/Accessor/Faster.pm?rev=34791&op=diff
==============================================================================
--- trunk/libclass-accessor-perl/lib/Class/Accessor/Faster.pm (original)
+++ trunk/libclass-accessor-perl/lib/Class/Accessor/Faster.pm Tue May  5 08:16:16 2009
@@ -1,7 +1,7 @@
 package Class::Accessor::Faster;
 use base 'Class::Accessor';
 use strict;
-$Class::Accessor::Faster::VERSION = '0.31';
+$Class::Accessor::Faster::VERSION = '0.33';
 
 =head1 NAME
 




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