merlyn is an
LWP expert, but appears not be around.
I am not so good with it, but since no-one is piping up here
is what I have to say:
i think your $realm should be 'basic' unless
you are doing 'admin' realm auth.
$netloc is the page you are requesting
which requires authentication before allowing you to access
it.
You might join the LWP mailing list for more help
You might try to get Clinton Wong's "Web Client
Programming with Perl" I understand the full text is
online at O'Reilly.