Bio-Genex

 view release on metacpan or  search on metacpan

ExperimentFactors/ExperimentFactors.pm  view on Meta::CPAN


  use Bio::Genex::ExperimentFactors;

  # instantiating an instance
  my $ExperimentFactors = Bio::Genex::ExperimentFactors->new(id=>47);

  # retrieve data from the DB for all columns
  $ExperimentFactors->fetch();

  # creating an instance, without pre-fetching all columns
  my $ExperimentFactors = new Bio::Genex::ExperimentFactors(id=>47);

  # creating an instance with pre-fetched data
  my $ExperimentFactors = new Bio::Genex::ExperimentFactors(id=>47, 'fetch_all'=>1);

  # retrieving multiple instances via primary keys
  my @objects = Bio::Genex::ExperimentFactors->get_objects(23,57,98)


  # retrieving all instances from a table
  my @objects = Bio::Genex::ExperimentFactors->get_all_objects();

  # retrieving the primary key for an object, generically
  my $primary_key = $ExperimentFactors->id();

  # or specifically
  my $ef_pk_val = $ExperimentFactors->ef_pk();

  # retreving other DB column attributes
  my $es_fk_val = $ExperimentFactors->es_fk();
  $ExperimentFactors->es_fk($value);

  my $factor_name_val = $ExperimentFactors->factor_name();
  $ExperimentFactors->factor_name($value);

  my $factor_units_val = $ExperimentFactors->factor_units();
  $ExperimentFactors->factor_units($value);

  my $major_category_val = $ExperimentFactors->major_category();
  $ExperimentFactors->major_category($value);

  my $minor_category_val = $ExperimentFactors->minor_category();
  $ExperimentFactors->minor_category($value);


=head1 DESCRIPTION

Each Genex class has a one to one correspondence with a GeneX DB table
of the same name (I<i.e.> the corresponding table for Bio::Genex::ExperimentFactors is
ExperimentFactors).


Most applications will first create an instance of Bio::Genex::ExperimentFactors
and then fetch the data for the object from the DB by invoking
C<fetch()>. However, in cases where you may only be accessing a single
value from an object the built-in L<delayed fetch|/DELAYED_FETCH>
mechanism can be used. All objects are created without pre-fetching
any data from the DB. Whenever an attribute of the object is accessed
via a getter method, the data for that attribute will be fetched from
the DB if it has not already been. Delayed fetching happens
transparently without the user needing to enable or disable any
features. 

Since data is not be fetched from the DB I<until> it is accessed by
the calling application, it could presumably save a lot of access time
for large complicated objects when only a few attribute values are
needed.

=head1 ATTRIBUTES

There are three different types of attributes which instances of
Bio::Genex::ExperimentFactors can access: I<raw> foreign key attributes,
Obect-Oriented foreign key attributes, and simple column attributes.

=over 4 

=item Raw Foreign Keys Attributes

=item Object Oriented Foreign Key Attributes

This mode presents foreign key attributes in a special way, with all
non-foreign key attributes presented normally. Foreign keys are first
retrieved from the DB, and then objects of the appropriate classes are
created and stored in slots. This mode is useful for applications that
want to process information from the DB because it automates looking
up information.

Specifying the 'C<recursive_fetch>' parameter when calling C<new()>,
modifies the behavior of this mode. The value given specifies the
number of levels deep that fetch will be invoked on sub-objects
created.

=item Simple Column Attributes

=back



=head1 CLASS VARIABLES

Class Bio::Genex::ExperimentFactors defines the following utility variables for assisting
programmers to access the ExperimentFactors table.

=over 4

=item $Bio::Genex::ExperimentFactors::LIMIT

If defined, $LIMIT will set a limit on any select statements that can
return multiple instances of this class (for example C<get_objects()>
or any call to a C<ONE_TO_MANY> or C<LOOKUP_TABLE> foreign key
accessor method).


=item $Bio::Genex::ExperimentFactors::USE_CACHE

This variable controls whether the class will cache any objects
created in calls to C<new()>. Objects are cached by primary key. The
caching is very simple, and no effort is made to track whether
different invocations of C<new()> are being made for an object with
the same primary key value, but with different options set. If you
desire to reinstantiate an object with a different set of parameters,



( run in 0.615 second using v1.01-cache-2.11-cpan-5837b0d9d2c )