On Tue, 2008-12-23 at 08:30 -0800, Collaborate wrote:
> I am wondering if there is a way to copy a webpage to a text file
> using Perl. All I need is to copy as unformatted text.
> 
> I would like to match certain strings on pages written in javascript
> and to my understanding, www::mechnize does not work for this
> application.
> 

WWW::Mechanize uses a number of other modules to help do its work.  One
of them, HTML::TreeBuilder contains another HTML::Element which has a
method as_text().  This can extract the unformatted text from any
element.  Use the methods in HTML::TreeBuilder to isolate the element
you're interested in and call as_text() on it.

See:
perldoc WWW::Mechanize
perldoc HTML::TreeBuilder
perldoc HTML::Element


-- 
Just my 0.00000002 million dollars worth,
  Shawn

Believe in the Gods but row away from the rocks.
  -- ancient Hindu proverb


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to