I have a class which has an ability to define a credentials.
$po = PoService->new()->set_basicauth("jack", "secret");
The thing is, in order to do that, it has to redefine a module subroutine. So, I did it this way:
sub set_basicauth {
my ($self, $creds_username, $creds_password) = @_;
sub SOAP::Transport::HTTP::Client::get_basic_credentials {
return $creds_username => $creds_password;
}
return $self;
}
But, when I run the code, it tells me a message:
Variable "$creds_username" will not stay shared at /opt/PoService.pm line 53.
Variable "$creds_password" will not stay shared at /opt/PoService.pm line 53.
What did I do wrong here?