sub new{ my $class = shift; my %opts = @_; unless ( defined $opts{dumper} ){ require Data::Dumper; # + () to avoid Name "Data::Dumper::Dumper" used only once: possible typo at # full qualified name to avoid runtime error $opts{dumper} = sub{ print +Data::Dumper::Dumper(\$_[0]) } } return bless { %opts }, $class; } #### sub execute_command{ my $self = shift; my $wanted_command = shift; my @whole_data = @_; $self->{ $wanted_command }->( $self, @whole_data ); }