From: Marcin Raczkowski Date: 2008-02-04T09:51:22+09:00 Subject: Re: mechanize get methods returns both ::File and ::Page 7stud -- wrote: > Carl Bernardi wrote: >> The page is html. Below, I included the log. It shows the page's >> content type to be "text/html" for the first few attempts and then the >> last attempt to be "text/plain". > > I'm not sure how showing me the log files is evidence that even though > the page says it is 'text/plain' that it really contains html. > > >> All I need to know is how to get a >> page instead of a file either be extending Mechanize, creating a >> instance of WWW::Mechanize::Page with the body from the file object > > Page#new() takes a URI as an argument. So it seems like you could save > the file, and then provide a URI with the file:// scheme and create a > new Page. or - instead of doing that idiotic hack - you could use pluggable parasers - feature already built in into mechanize to force it to treat text/plain like html with simple one liner. Or use more complex solution that i posted - that forces pluggable paraser only if you clearly state it for that request using get_html, and after that it cleans up after itself