http://www.perlmonks.org?node_id=1020498

kapila has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to integrate Bugzilla with ReviewBoard writing code in perl. I have tried to write a code. curl command which is working
curl -k -H "Authorization: Basic YWRtaW4=" -X POST -d "{\"repository_ +path\":":pserver:user:pwd@svn:/opt/cvsroot",\"username\":"admin",\"pa +ssword\":"admin",\"submit-as\":"admin"}" "http://codereview.xyz.com/a +pi/r/new/"
It is giving me full html page with js error
#!/usr/local/bin/perl use LWP::UserAgent; use MIME::Base64; $url="http://codereview.xyz.com/api/review-requests/"; $newurl="http://codereview.xyz.com/r/new/"; $user="admin"; $pwd="admin"; $text="$user:$pwd"; $text = encode_base64($text); #print "Encoded text: $text\n"; %param =( "repository_id" =>"cvsrepo", "repository_path" =>":pserver:user:pwd\@svn:/opt/cvsroot", "username" => "admin", "password" => "admin", "submit-as" => "username", ); my $ua = LWP::UserAgent->new; $ua->timeout(TIMEOUT); $ua->protocols_allowed(['http', 'https']); $ua->default_header('Basic' => $text); $ua->credentials($newurl,$user,$pwd); $resp = $ua->get($url); print($resp->status_line(), "\n"); print("Add handler:\n"); $ua->add_handler( response_header => sub { print "HANDLER\n"; +}, %param); print $ua->handlers('response_header', $resp)."\n"; push @{ $ua->requests_redirectable }, 'POST'; print $ua->show_progress."\n"; my $response = $ua->post($newurl,%param); if ($response->is_success) { print $response->decoded_content; } else { die $response->status_line; }
Error its not posting ..
<h1>JavaScript is turned off</h1> <p>Review Board requires JavaScript in order to function. Please turn it on in your browser preferences. <p>Firefox users: if you prefer to turn on JavaScript only for specific sites, we recommend the <a href="https://addons.mozilla.org/en-US/firefox/addon/722">NoSc +ript extension</a>.</p>