M
Mike Starkie
I have a script which tries to verify the existence of a BugID by
making a http::get request to a bug tracking url.
http://tracking.edgetrade.com/default.asp?pg=pgEditBug&command=view&ixBug=9999
typing it in manually returns the expected page (of course) but when i
do it in perl i get the default page only
(http://tracking.edgetrade.com)
what am i doing wrong?
#!/usr/bin/perl
use LWP;
print "verifying BugID...\n";
$logFile = shift @ARGV;
open(LOGFILE, $logFile) or die "Can't verify BugID in CVS commit log
file: $logFile: $!\n";
while ($line = <LOGFILE>) {
print "line: $line\n";
if ($line =~ /\s*Bug[zs]*\s*IDs*\s*[#:; ]+((\d+[ ,:;#]*)+)/i)
{
$bugIDstring .= " " . $1;
}
}
print "BugID's: $bugIDstring\n";
@bugIDlist = split("[ ,:;#]+", $bugIDstring);
$ixBug = 0;
foreach (@bugIDlist)
{
if (/\d+/)
{
$ixBug = int($_);
print "Attempting to verify bug info for Bug ID #$ixBug...\n";
$ua = LWP::UserAgent->new();
$url =
"http://tracking.edgetrade.com/default.asp?pg=pgEditBug&command=view&ixBug=$ixBug";
$webdoc = $ua->request(HTTP::Request->new(GET => $url));
$content = $webdoc->content;
print "$content\n";
if ($content =~ /Case #$ixBug does not exist or has been
deleted./)
{
die "BugID: $ixBug does not exist in FogBugz\n";
}
}
}
making a http::get request to a bug tracking url.
http://tracking.edgetrade.com/default.asp?pg=pgEditBug&command=view&ixBug=9999
typing it in manually returns the expected page (of course) but when i
do it in perl i get the default page only
(http://tracking.edgetrade.com)
what am i doing wrong?
#!/usr/bin/perl
use LWP;
print "verifying BugID...\n";
$logFile = shift @ARGV;
open(LOGFILE, $logFile) or die "Can't verify BugID in CVS commit log
file: $logFile: $!\n";
while ($line = <LOGFILE>) {
print "line: $line\n";
if ($line =~ /\s*Bug[zs]*\s*IDs*\s*[#:; ]+((\d+[ ,:;#]*)+)/i)
{
$bugIDstring .= " " . $1;
}
}
print "BugID's: $bugIDstring\n";
@bugIDlist = split("[ ,:;#]+", $bugIDstring);
$ixBug = 0;
foreach (@bugIDlist)
{
if (/\d+/)
{
$ixBug = int($_);
print "Attempting to verify bug info for Bug ID #$ixBug...\n";
$ua = LWP::UserAgent->new();
$url =
"http://tracking.edgetrade.com/default.asp?pg=pgEditBug&command=view&ixBug=$ixBug";
$webdoc = $ua->request(HTTP::Request->new(GET => $url));
$content = $webdoc->content;
print "$content\n";
if ($content =~ /Case #$ixBug does not exist or has been
deleted./)
{
die "BugID: $ixBug does not exist in FogBugz\n";
}
}
}