in reply to trying to test login via lwp

'$username', '$password'
Variables are not interpolated in single quoted strings, so you are literally using the username '$' followed by 'username'.

Use double quoted strings when you want to interpolate variables, but in this case there's no need for a string at all. Just pass $username, $password.