Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

WWW Scripter update_HTML not working

by Anonymous Monk
on Jan 08, 2014 at 20:21 UTC ( #1069860=perlquestion: print w/ replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks
I tried the WWW::Mechanize update_html and it worked perfectly. Needing to test some JavaScript enabled page processing I converted to WWW::Scripter and guess what? Update_html stopped working! Are there any work arounds for this

Comment on WWW Scripter update_HTML not working
Re: WWW Scripter update_HTML not working
by ww (Bishop) on Jan 08, 2014 at 21:12 UTC
    Someone may guess at an answer... but it would be much easier for those of us not gifted with psi powers if you were a bit more specific about (among other things):
    • what update.html?
    • Where (a naive search leads to nothing even vaguely plausible) did you find it?
    • How did you install(?) the "update" (if what you're asking about was alleged to be an update to WWW::Mechanize)?
    • What Perl?
    • What OS
    • How did you "tried" it? (Hint: showing the code is almost6 mandatory.)
    • How did it "stopped working"? Pick one: Error messages, warnings; incorrect output
    Come, let us reason together: Spirit of the Monastery
      OK. I'm using a Mac, OS 10.9.1. Perl 5 version 16.2.

      The following code works fine:
      use WWW::Mechanize qw(!update_html);

      $w = new WWW::Mechanize;
      $w->get("file:hello.txt");
      $html = $w->content;
      $html =~ s/Hello World/Goodbye Everyone/isg;
      $w->update_html( $html );
      print $w->content;

      it picks up a file containing the worlds "Hello World" and prints "Goodbye Everyone"

      If I change the WWW::Mechanize to WWW::Scripter, thus:
      use WWW::Scripter qw(!update_html);

      $w = new WWW::Scripter;
      $w->get("file:hello.txt");
      $html = $w->content;
      $html =~ s/Hello World/Goodbye Everyone/isg;
      $w->update_html( $html );
      print $w->content;

      The result is, "Hello World" is printed. Hence I'm assuming the update_html in WWW::Scripter doesn't function incorrectly.

      Thanks for your interest.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1069860]
Approved by kcott
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (18)
As of 2014-07-10 13:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (210 votes), past polls