#! perl\bin\perl
use strict;
use warnings;
use Data::Dumper;
use WWW::Mechanize;
my $text ='My new article...';
my $text2 = 'My second article...';
my $text3 = 'My third article...';
my $start;
my $mech1 = WWW::Mechanize->new(
agent => 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)',
cookie_jar => {});
$mech1->get("http://www.example.com");
$mech1->form(1);
$mech1->field('username',"username");
$mech1->field('password',"password");
$mech1->click("login");
if ($mech1->success){ print "successfully logged on \n";} else{print !$;}
$mech1->follow_link( text_regex => qr/Articles/i );
####
if( $mech1->success){print "success \n";} else{print !$;}
$mech1->click("Edit article");
if( $mech1->success){print "Editing article \n";} else{print !$;}
$mech1->field('text',"$text");
####
$mech1->click("submit");
if ($mech1->success){ print "article successfully submitted \n";} else{print
!$;}
}