$agent->credentials( 'www.routerlogin.com', 'WGR614v4',
'user', 'password' );
That's a weird realm (the second parameter).
The "realm" is the info text that appears in the dialog box when you try to log in with a browser. I don't know how exact a fit the text you enter must be. I sincerely doubt that the text would ever be "WGR614v4".
update: Even with the proper values filled in, it doesn't work for me. And yes, judging by the looks of examining the $agent with Data::Dumper, setting the credentials must have worked.
update: Got it! You need a port number for the $netloc. Append a ":80" to the domain name, the first parameter, and authentication works. You still appear to need an exact realm, though. Leaving it blank, or otherwise filling in a partly matching string, just doesn't work.
$agent->credentials( 'www.routerlogin.com:80', 'WGR614v4',
'user', 'password' );