#!/usr/bin/perl # ############################################################################ # # This is just some code to demonstrate how to submit a cookie along with # a form via perl. Useful when you want to automate form subission # but need to be logged in to do so... # # http://rasterweb.net/raster/ # ############################################################################ use HTTP::Request::Common qw/POST/; use HTTP::Headers; use LWP::UserAgent; my $cookie_data = 'FOO=bar; BAR=foo; path=/; domain=example.com; expires=Thu, 31-Dec-2037'; my $ua = LWP::UserAgent->new; my $headers = HTTP::Headers->new(); my $req = POST 'http://example.com/foo.cgi', Content => [ status => 'my status' short_desc => 'my desc', comment => 'my comment' ], Cookie => $cookie_data; my $res = $ua->request($req); if ($res->is_success) { $page_title = $title_submitted; $page_body = $body_submitted; }