small aesthetic fix to Storage::DBI::Oracle
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / AccessorGroup.pm
index 1fcd2e0..4e42b27 100644 (file)
@@ -3,7 +3,7 @@ package DBIx::Class::AccessorGroup;
 use strict;
 use warnings;
 
-use NEXT;
+use Carp::Clan qw/^DBIx::Class/;
 
 =head1 NAME 
 
@@ -18,8 +18,6 @@ getters and setters.
 
 =head1 METHODS
 
-=over 4
-
 =cut
 
 sub mk_group_accessors {
@@ -42,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.");
             }
 
@@ -106,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 {
@@ -127,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 {
@@ -136,9 +132,38 @@ sub make_group_wo_accessor {
     };
 }
 
-1;
+sub get_simple {
+  my ($self, $get) = @_;
+  return $self->{$get};
+}
+
+sub set_simple {
+  my ($self, $set, $val) = @_;
+  return $self->{$set} = $val;
+}
 
-=back
+sub get_component_class {
+  my ($self, $get) = @_;
+  if (ref $self) {
+      return $self->{$get};
+  } else {
+      $get = "_$get";
+      return $self->can($get) ? $self->$get : undef;      
+  }
+}
+
+sub set_component_class {
+  my ($self, $set, $val) = @_;
+  eval "require $val";
+  if (ref $self) {
+      return $self->{$set} = $val;
+  } else {
+      $set = "_$set";
+      return $self->can($set) ? $self->$set($val) : $self->mk_classdata($set => $val);      
+  }  
+}
+
+1;
 
 =head1 AUTHORS