Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Application using the class

  • This is the application that uses the class
package MySalary;
use strict;
use warnings;

use BaseSalary;

sub new {
    my ($class, $name) = @_;
    my $self = bless {}, $class;

    $self->{base} = BaseSalary->new;
    $self->{base}->name($name);

    return $self;
}


sub get_name {
    my ($self) = @_;
    $self->{base}->name;
}


sub get_salary {
    my ($self) = @_;

    my $bonus = 100;

    my $base_salary = $self->{base}->get_base_salary();

    return $base_salary + $bonus;
}

1;


  • How can we test that our application will report a correct error message if the 3rd party application breaks (instead of raising an exception)?