Question
Hi, I'm trying to make my build-bot upload a twiki-formatted log of the build-process via WWW::Mechanize, however I cannot get the bot to authenticate correctly, it just always returns the Oops-register page. I'll upload the WWW::Mechanize script also...
I have uploaded the script which tries to upload here, the interesting lines are:
#
# at this point the following variables are set and contains the
# following data:
my $arg_twiki_username = "MikaelOlenfalk";
my $arg_twiki_password = "mypassword"; # << correct, have triple-checked
my $build_date_and_time = "2005-10-29 12:30:45";
my $arg_twiki_server = "stewie";
my $arg_twiki_web = "EyeTracking";
my $arg_twiki_project_title = "EyeTrackingCore";
my $build_project_failed = 0;
my $twiki_output = "THE COMPLETE TOPIC";
#
# upload topic
#
{
package MyMech;
our @ISA = qw(WWW::Mechanize);
sub get_basic_credentials
{
return ($arg_twiki_username, $arg_twiki_password);
}
}
my $agent = MyMech->new();
my $great_date = $build_date_and_time;
$great_date =~ s/[^0-9]//g;
my $twiki_url = "http://${arg_twiki_server}/cgi-bin/twiki/edit/${arg_twiki_web}/BuildLog${arg_twiki_project_title}${great_date}?templatetopic=BuildLogTemplate&topicparent=BuildLogs&Date=${build_date_and_time}&Project=${arg_twiki_project_title}&";
if ($build_project_failed > 0) {
$twiki_url .= "State=Failure (Need Investigation)";
} else {
$twiki_url .= "State=Success";
}
# get the empty page
$agent->get ($twiki_url)
or die "E: Could not get $twiki_url\n"; # <<<< this returns OOPS-REGISTER
$agent->form_name ("main")
or die "E: No formed named main\n";
$agent->field ("text", $twiki_output);
my $response = $agent->click_button (name => "action", value => "Save");
die "E: AAAAAAAAAAARRRGGGHHH" unless $response->is_success;
Environment
--
MikaelOlenfalk - 31 Oct 2005
Answer
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
Did you see
CPAN:WWW:Mechanize::TWiki
?
--
MartinCleaver - 31 Oct 2005
i.e.
http://search.cpan.org/author/WBNIV/WWW-Mechanize-TWiki-0.10/lib/WWW/Mechanize/TWiki.pm
--
MartinCleaver - 31 Oct 2005
Also see
WikiGateway
--
MartinCleaver - 31 Oct 2005
Sorry for my late answer I was unable to dedicate any time for the project which needs the upload capability. I had a look at booth
CPAN:WWW::Mechanize::TWiki
and
WikiGateway but as it seems,
CPAN:WWW::Mechanize::TWiki
doesn't work on Windows under
ActivePerl and
WikiGateway doesn't seem to have a TWiki backend yet...
--
MikaelOlenfalk - 09 Nov 2005
CPAN:WWW::Mechanize
doesn't work on windows? i wonder why not? can you provide more information (i don't have a windows box to test it on), but it should work as it's a pure perl subclass of
CPAN:WWW::Mechanize
(or does
CPAN:WWW::Mechanize
not work on windows?)
--
WillNorris - 09 Nov 2005
I use a simpler technique
wget http://twiki/bin/save/Someweb/ItemXXXXXXXXXX?text=whatever
will create a new topic with a unique topc name (in Dakar, for Cairo there is a patch) with a topic text of 'whatever'
--
SvenDowideit - 09 Nov 2005
WillNorris:
CPAN:WWW::Mechanize
does indeed work, its just that
CPAN:WWW::Mechanize::TWiki
isnt available for
ActivePerl because of some build problem and just copying WWW::Mechanize::TWiki from a linux box doesn't work.
--
MikaelOlenfalk - 21 Nov 2005