perl-Class-Accessor

Automated accessor generation

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}; } 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 it's also simply not lazy, which is the real tragedy. 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! The basic set up is very simple: package Foo; use base qw(Class::Accessor); 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 _best practice_ guidelines you can use: package Foo; use base qw(Class::Accessor); Foo->follow_best_practice; Foo->mk_accessors( qw(far bar car) ); *Note:* you must call 'follow_best_practice' before calling 'mk_accessors'.

There is no official package available for openSUSE Leap 15.3

Distributions

openSUSE Tumbleweed

openSUSE Leap 15.4

openSUSE Leap 15.3

openSUSE Leap 15.2

SUSE SLE-15-SP2

SUSE SLE-15-SP1

SUSE SLE-12-SP5

RedHat RHEL-7

RedHat RHEL-5

CentOS CentOS-7

Unsupported distributions

The following distributions are not officially supported. Use these packages at your own risk.

openSUSE:Leap:15.0

openSUSE:Leap:15.1

openSUSE:11.4

openSUSE:12.1

openSUSE:12.2

openSUSE:12.3

openSUSE:13.1

openSUSE:13.2

openSUSE:Leap:42.1

openSUSE:Leap:42.3

openSUSE:Leap:42.2

openSUSE:11.1

SUSE:SLE-12:SLE-Module-Adv-Systems-Management

SUSE:SLE-15:GA

DISCONTINUED:openSUSE:11.1

SUSE:SLE-11

SUSE:SLE-12:SLE-Module-Toolchain

SUSE:SLE-11:SP3

SUSE:SLE-11:SP1

SUSE:SLE-11:SP2

deleted

SUSE:SLE-10

CentOS:CentOS-5