Then, Design the Engine

I like to think of code shared between two subroutines or methods as the 'engine' that powers those functions.

Here's how _count_engine() powers the two previous methods.

    sub _count_engine {
        my $self = shift;
        my %data = %$self;
        my ($count);
        foreach (keys %data) {
            $count++ unless ($reserved{$_});
        }
        return $count;
    }

Previous Back to start of show Next
Slide: 14 design_engine © 2003 James E. Keenan