Remember Data::Presenter?

When you use my Data::Presenter module, you actually invoke it from a subclass which inherits many methods, including its constructor, from Data::Presenter itself.

    use Data::Presenter;
    use Data::Presenter::SampleCensus;
    ...
    $dp1 = Data::Presenter::SampleCensus->new(
                $sourcefile, \@fields,\%parameters, $index);
    $data_count = $dp1->get_data_count();
    $dp1->print_data_count();
    $keysref = $dp1->get_keys();
    $dp1->print_to_screen();
    $dp1->print_to_file($outputfile);
    $dp1->print_with_delimiter($outputfile, $delimiter);
    $dp1->full_report($outputfile);

Due to inheritance, none of the code for these methods needs to be repeated inside Data::Presenter::SampleCensus or any other subclass which inherits from Data::Presenter.

Previous Back to start of show Next
Slide: 37 DP_inheritance © 2003 James E. Keenan