From a790b77886848c349fd0240206d2fa6e697510e8 Mon Sep 17 00:00:00 2001 From: Jared Camins-Esakov Date: Tue, 7 Aug 2012 10:25:38 -0400 Subject: [PATCH] Bug 7417 follow-up: use Moose-like syntax for accessors Content-Type: text/plain; charset="UTF-8" In order to make the Koha codebase more consistent, this patch switches the RecordProcessor and Koha::DataObject::Authority code to use the Moose-like syntax supported by Class::Accessor. --- Koha/DataObject/Authority.pm | 8 +++++--- Koha/RecordProcessor.pm | 8 +++++--- Koha/RecordProcessor/Base.pm | 10 +++++----- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Koha/DataObject/Authority.pm b/Koha/DataObject/Authority.pm index 2287644..119da67 100644 --- a/Koha/DataObject/Authority.pm +++ b/Koha/DataObject/Authority.pm @@ -36,10 +36,12 @@ use C4::Context; use MARC::Record; use MARC::File::XML; use C4::Charset; +use Class::Accessor "antlers"; -use base qw(Class::Accessor); - -__PACKAGE__->mk_accessors(qw( authid authtype record marcflavour )); +has authid => ( is => 'rw' ); +has authtype => ( is => 'rw' ); +has record => ( is => 'rw' ); +has marcflavour => ( is => 'rw' ); =head2 new diff --git a/Koha/RecordProcessor.pm b/Koha/RecordProcessor.pm index 96ade9a..dcee39c 100644 --- a/Koha/RecordProcessor.pm +++ b/Koha/RecordProcessor.pm @@ -58,12 +58,14 @@ clone it I to passing it off to the RecordProcessor. =cut use Modern::Perl; +use Class::Accessor "antlers"; use Module::Load::Conditional qw(can_load); use Module::Pluggable::Object; -use base qw(Class::Accessor); - -__PACKAGE__->mk_accessors(qw( schema filters options record )); +has schema => ( is => "rw" ); +has filters => ( is => "rw" ); +has options => ( is => "rw" ); +has record => ( is => "rw" ); =head2 new diff --git a/Koha/RecordProcessor/Base.pm b/Koha/RecordProcessor/Base.pm index e051b74..52a541b 100644 --- a/Koha/RecordProcessor/Base.pm +++ b/Koha/RecordProcessor/Base.pm @@ -59,11 +59,12 @@ clone it I to passing it off to the RecordProcessor. =cut use Modern::Perl; +use Class::Accessor "antlers"; -use base qw(Class::Accessor); +has name => ( is => "ro" ); +has version => ( is => "ro" ); +has params => ( is => "rw" ); -__PACKAGE__->mk_ro_accessors(qw( name version )); -__PACKAGE__->mk_accessors(qw( params )); our $NAME = 'Base'; our $VERSION = '1.0'; @@ -78,8 +79,7 @@ Create a new filter; sub new { my $class = shift; - my $self = $class->SUPER::new( { });#name => $class->NAME, - #version => $class->VERSION }); + my $self = $class->SUPER::new( { }); bless $self, $class; return $self; -- 1.7.2.5