Test2::Util::HashBase(3p) Perl Programmers Reference Guide
Test2::Util::HashBase(3p) Perl Programmers Reference Guide # Test2::Util::HashBase(3p) Perl Programmers Reference Guide NNAAMMEE # Test2::Util::HashBase - Build hash based classes. SSYYNNOOPPSSIISS # A class: package My::Class; use strict; use warnings; # Generate 3 accessors use Test2::Util::HashBase qw/foo -bar ^baz <bat >ban +boo/; # Chance to initialize defaults sub init { my $self = shift; # No other args $self->{+FOO} ||= "foo"; $self->{+BAR} ||= "bar"; $self->{+BAZ} ||= "baz"; $self->{+BAT} ||= "bat"; $self->{+BAN} ||= "ban"; $self->{+BOO} ||= "boo"; } sub print { print join ", " => map { $self->{$_} } FOO, BAR, BAZ, BAT, BAN, BOO; } Subclass it package My::Subclass; use strict; use warnings; # Note, you should subclass before loading HashBase. ...