package PDI; use strict; use warnings; use English; sub new { my ($proto, %config) = @_; my $class = ref($proto) || $proto; my $self = bless \%config, $class; return $self; } sub executeProgram { my ($self) = @_; # Slew to PDI attitude if(!$self->{dbh}->do("firststatement")) { return 0; } # Calculate burn time if(!$self->{dbh}->do("secondstatement")) { return 0; } # do some more complex stuff, like reading data from the database and using that to # decide if we need to open the helium valves my $selsth = $self->{dbh}->prepare_cached("SELECT valvename, valvestate FROM descentstage") or return 0; if(!$selsth->execute) { return 0; } while((my $line = $selsth->fetchrow_hashref)) { # complex logic here } $selsth->finish; return 1; } 1;