Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^3: Syntax error for WWW::Mechanize

by GrandFather (Saint)
on Jul 30, 2005 at 13:27 UTC ( [id://479604]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Syntax error for WWW::Mechanize
in thread Syntax error for WWW::Mechanize

The following code may do something like what you are trying to achieve:

use warnings; use strict; use WWW::Mechanize; use HTML::TreeBuilder; my $webcrawler = WWW::Mechanize->new(); my $page = $webcrawler->get ('http://perlmonks.org/?node_id=479598'); my $tree = HTML::TreeBuilder->new_from_content ($page->as_string ()); print $tree->as_text ();
Syntax error for WWW::MechanizeHTTP/1.1 200 OK Connection: close Date: + Sat, 30 Jul 2005 13:24:01 GMT Server: Apache/1.3.27 Content-Type: te +xt/html; charset=ISO-8859-1 Client-Date: Sat, 30 Jul 2005 13:24:02 GM +T Client-Peer: 66.39.54.27:80 Client-Response-Num: 1 Client-Transfer- +Encoding: chunked Link: ; /="/"; rel="stylesheet"; type="text/css" Li +nk: ; /="/"; rel="stylesheet"; type="text/css" Link: ; /="/"; rel="ic +on" Title: Syntax error for WWW::Mechanize P is for Practica +l Perl Monks Syntax error for WWW::Mechanize by lampros21_7 | Log +in | Create a new user | The Monastery Gates | Super Search | | Seek +ers of Perl Wisdom | Meditations | PerlMonks Discussion | Snippets | + | Obfuscation | Reviews | Cool Uses For Perl | Perl News | Q&A | Tut +orials | | Code | Poetry | Recently Active Threads | Newest Nodes | +Offering Plate | on Jul 30, 2005 at 11:42 UTC ( #479598=perlquestion: + print w/ replies, xml )Need Help?? lampros21_7 has asked for the wis +dom of the Perl Monks concerning the following question: Hi, i have +asked about another error message before but now i get a syntax error + message about the last line of my code. It says "syntax error at Web +Crawler.pl near $webcrawler(". It says in the documentation for WWW:: +Mechanize that i need the HTML::TreeBuilder but i have installed that + so thats not the problem. The $stripped_html[$x] = $webcrawler( form +at => "text"); line is part of the module WWW::Mechanize.pmThanks our + $webcrawler = WWW::Mechanize->new(); #Grab the contents of the URL given by the user our $webcrawler = get($url_name); # Put the links that exist in the HTML of the URL given by the user i +n an array our @website_links = $webcrawler->links($url_name); # The HTML is stripped off the contents and the text is stored in an +array of strings our $x = 0; my @stripped_html; $stripped_html[$x] = $webcrawler( format => "text"); comment on Syntax error for WWW::MechanizeSelect Code to DownloadDownl +oad CodeRe: Syntax error for WWW::Mechanize by GrandFather on Jul 30, + 2005 at 11:56 UTCThere looks to be a subroutine name missing there.P +erl is Huffman encoded by design. [reply]Re^2: Syntax error for WWW: +:Mechanize by lampros21_7 on Jul 30, 2005 at 12:58 UTCWhat subroutine + is missing? I am basically trying to save as a string the non-HTML c +ontent of a website using that part od the WWW::Mechanize code. [repl +y] Back to Seekers of Perl Wisdom Login:Passwordremember mepassword r +eminderCreate A New User Node Status node historyNode Type: perlquest +ion [id://479598]Approved by GrandFatherhelp Chatterbox <herveus> ht +tp://www.nasa. gov/images/ content/123677main _8M2C2673_hires. jpg: c +ool picture of space shuttleHow do I use this? | Other CB clients Oth +er Users Others riffling the monastery: (16)theorbtwo rinceWind atcro +ft castaway wfsp jhourcle Not_a_Number Arunbear GrandFather jk2addict + bpphillips cazz cyclist38 siracusa prlmnks.org Bud Man As of 2005-07 +-30 13:21 GMT Sections The Monastery GatesSeekers of Perl WisdomMedit +ationsPerlMonks DiscussionCategorized Q&AObfuscated CodePerl PoetryCo +ol Uses for PerlSnippets SectionCode CatacombsPerl News Information P +erlMonks FAQGuide to the MonasteryVoting/Experience SystemTutorialsRe +viewsLibraryPerl FAQsOutside Links Find Nodes Nodes You WroteSuper Se +archPerl Monks User SearchNewest NodesRecently Active ThreadsSelected + Best NodesBest NodesWorst NodesSaints in our Book Leftovers The St. +Larry Wall ShrineOffering PlateAwardsCraftQuestsEditor RequestsBuy Pe +rlMonks GearPerl Monks MerchandiseRandom Node Voting Booth Most pol +l options are...Too broad Not broad enough Too obscure Not obscure en +ough Gratuitously funny Not funny enough Missing my favourite foo Jus +t right In English [results][172 votes] [past polls] This page brough +t to you by the kind folks at The Everything Development Company and + maintained by Tim Vroom. Perl Monks was recently assimilated by The +Perl Foundation. Beefy Boxes and Bandwidth Generously Provided by pa +ir Networks

Perl is Huffman encoded by design.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://479604]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-24 12:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found