That method will only work with certain types of .htaccess restriction. If plain forms are used (with CGIs), the data is send in different ways...
Like noted before, there are loads of tutorials on using LWP to log into CGI-based forms.
Greetz
Beatnik
... Quidquid perl dictum sit, altum viditur.