Subject: | unmodify gets also strings, not only objects |
I just set up HTTP::Recorder here (perl-5.8.7, with gcc-3.4.4, all
latest modules like HTTP::Proxy, WWW::Mechanize etc. as of Nov-21),
tried it on one of our internal websites and noticed a problem in
sub unmodify: the $content is sometimes a string, not an object.
I hacked the following lines in and it seems to work ok; however,
I could imagine that there is a smarter and cleaner solution; the
string appears when unmodify is called with $req->content, not
with $req->uri.
--- lib/HTTP/Recorder.pm 2005-08-19 05:05:54.000000000 +0200
+++ /opt/perl_5.8.7/lib/HTTP/Recorder.pm 2005-11-21
12:20:33.796981000 +0100
@@ -344,6 +344,12 @@
# get rid of the arguments we added
my $prefix = $self->{prefix};
+ # workaround: the content can be a simple string
+ unless(ref $content) {
+ $content =~ s/(?:^|(?<=\&))\Q$prefix\E-[^=]+=[^\&]*(\&|$)//g;
+ return $content;
+ }
+
for my $key ($content->query_param) {
if ($key =~ /^$prefix-/) {
$content->query_param_delete($key);
By the way: The web site uses Javascript, and there is this code in:
if (window.parent&&window.parent.content)
window.parent.content.location.href='/cqWEB/query/scrolledlist/viewbug_c
ontent.asp?ChangeState=T&newstate='+fasn[ix];
This code seems to merely open the given URL - any idea why this is not
caught by HTTP::Recorder when I execute it? This is not a showstopper
since I can manually add this link to the WWW::Mechanize script, but of
course it would be nice if the H::R would get it right itself.
Thanks for this great utility!
-Marek (one of the Munich.pm's)