X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FAccessorGroup.pm;h=79db5191fc3b60f3eee00e557597598f98cc8838;hb=701da8c4d6f0b78ffc015085aa410a6cacfcdb40;hp=a7e85be061135179abe0d0adb9056d533100dca8;hpb=c687b87e860c97257542dda2b14c0137f6fbc583;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/AccessorGroup.pm b/lib/DBIx/Class/AccessorGroup.pm index a7e85be..79db519 100644 --- a/lib/DBIx/Class/AccessorGroup.pm +++ b/lib/DBIx/Class/AccessorGroup.pm @@ -3,7 +3,22 @@ package DBIx::Class::AccessorGroup; use strict; use warnings; -use NEXT; +use Carp::Clan qw/^DBIx::Class/; + +=head1 NAME + +DBIx::Class::AccessorGroup - Lets you build groups of accessors + +=head1 SYNOPSIS + +=head1 DESCRIPTION + +This class lets you build groups of accessors that will call different +getters and setters. + +=head1 METHODS + +=cut sub mk_group_accessors { my($self, $group, @fields) = @_; @@ -25,8 +40,7 @@ sub mk_group_accessors { foreach my $field (@fields) { if( $field eq 'DESTROY' ) { - require Carp; - &Carp::carp("Having a data accessor named DESTROY in ". + carp("Having a data accessor named DESTROY in ". "'$class' is unwise."); } @@ -89,8 +103,7 @@ sub make_group_ro_accessor { if(@_) { my $caller = caller; - require Carp; - Carp::croak("'$caller' cannot alter the value of '$field' on ". + croak("'$caller' cannot alter the value of '$field' on ". "objects of class '$class'"); } else { @@ -110,7 +123,7 @@ sub make_group_wo_accessor { unless (@_) { my $caller = caller; require Carp; - Carp::croak("'$caller' cannot access the value of '$field' on ". + croak("'$caller' cannot access the value of '$field' on ". "objects of class '$class'"); } else { @@ -119,4 +132,25 @@ sub make_group_wo_accessor { }; } +sub get_simple { + my ($self, $get) = @_; + return $self->{$get}; +} + +sub set_simple { + my ($self, $set, $val) = @_; + return $self->{$set} = $val; +} + 1; + +=head1 AUTHORS + +Matt S. Trout + +=head1 LICENSE + +You may distribute this code under the same terms as Perl itself. + +=cut +