From: Chris W. <la...@us...> - 2005-02-13 20:20:14
|
Update of /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1797/lib/OpenInteract2 Modified Files: Setup.pm Log Message: add OpenInteract2::ParamContainer to ISA, remove old methods and modify docs to reflect Index: Setup.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Setup.pm,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** Setup.pm 8 Feb 2005 01:11:27 -0000 1.59 --- Setup.pm 13 Feb 2005 20:20:05 -0000 1.60 *************** *** 4,8 **** use strict; ! use base qw( Class::Factory ); use Algorithm::Dependency::Ordered; use Log::Log4perl qw( get_logger ); --- 4,8 ---- use strict; ! use base qw( Class::Factory OpenInteract2::ParamContainer ); use Algorithm::Dependency::Ordered; use Log::Log4perl qw( get_logger ); *************** *** 28,49 **** my ( $class, $setup_type, %params ) = @_; my $impl_class = $class->get_factory_class( $setup_type ); ! my $self = bless( ! { param => \%params }, $impl_class ! ); $self->init(); return $self; } - sub param { - my ( $self, $key, $value ) = @_; - unless ( $key ) { - return $self->{param}; - } - if ( defined $value ) { - $self->{param}{ $key } = $value; - } - return $self->{param}{ $key }; - } - # lifecycle to the outside world --- 28,37 ---- my ( $class, $setup_type, %params ) = @_; my $impl_class = $class->get_factory_class( $setup_type ); ! my $self = bless( {}, $impl_class ); ! $self->param_assign( \%params ); $self->init(); return $self; } # lifecycle to the outside world *************** *** 161,165 **** "with 'OpenInteract2::Context->create(...)'"; } ! my $actions = $DEP->schedule( $run_action ) || []; $log->info( "Asked to run setup for '$run_action', will execute ", "actions (including deps): ", join( ', ', @{ $actions } ) ); --- 149,154 ---- "with 'OpenInteract2::Context->create(...)'"; } ! my $actions = $DEP->dependent_on( $run_action ) || []; ! unshift @{ $actions }, $run_action; $log->info( "Asked to run setup for '$run_action', will execute ", "actions (including deps): ", join( ', ', @{ $actions } ) ); *************** *** 210,213 **** --- 199,220 ---- return \@good_items; } + + sub Algorithm::Dependency::dependent_on { + my $self = shift; + my $parent = shift; + + my $all_items = $self->schedule_all(); + my @deps = (); + + foreach my $item ( @{ $all_items } ) { + next if ( $item eq $parent ); + my $all_item_dep = $self->depends( $item ); + foreach my $item_dep ( @{ $all_item_dep } ) { + push @deps, $item if ( $item_dep eq $parent ); + } + } + return \@deps; + } + WITHOUT *************** *** 332,338 **** =head2 Common functionality ! B<new( $type, %params )> ! B<param( [ $key, [ $value ] ] )> B<run( $ctx )> --- 339,346 ---- =head2 Common functionality ! See also L<OpenInteract2::ParamContainer> for parameter manipulation ! methods. ! B<new( $type, %params )> B<run( $ctx )> |