Hi,
I'd recommend using
WWW::Mechanize::Shell. It is a shell that you can use almost like a browser. It will allow you to check HTTP return values, check where you surfed to etc.
But the cool thing is that After you've done what you want to do by using it, you can call the script() method to display your current session history as a Perl script using WWW::Mechanize. This code can then be saved.
With that you can then start adjusting to your needs
perl -MWWW::Mechanize::Shell -eshell will get you going.
Regards,
svenXY