package Music; $VERSION = 1.00; use strict; use vars qw( $AUTOLOAD ); use Carp; { # Encapsulated class data my %_attr_data = # DEFAULT ACCESSIBILITY ( _name => [ '???', 'read'], _artist => [ '???', 'read'], _publisher => [ '???', 'read'], _ISBN => [ '???', 'read'], _tracks => [ '???', 'read'], _rating => [ -1, 'read/write'], _room => [ 'uncatalogued', 'read/write'], _shelf => [ "", 'read/write'], ); my $_count = 0; # Class methods, to operate on encapsulated class data # Is a specified object attribute accessible in a given mode sub _accessible { my ($self, $attr, $mode) = @_; $_attr_data{$attr}[1] =~ /$mode/ } # Classwide default value for a specified object attribute sub _default_for { my ($self, $attr) = @_; $_attr_data{$attr}[0]; } # List of names of all specified object attributes sub _standard_keys { keys %_attr_data; }