in reply to Passing other variables to start handler in HTML::Parser
update: Ah, I see. Are you going to be handling forms? I still say go with HTML::TokeParser::Simple, or possibly my HTML::LinkExtractor ;)
update: Look, this is interesting ;)
use JavaScript::SpiderMonkey; my $jS = JavaScript::SpiderMonkey->new(); # Initialize Runtime/Context $jS->init(); # create a new object, and set a method my $document = $jS->object_by_path("document"); $jS->function_set("write", \&Write , $document); $jS->function_set("writeln", \&WriteLn , $document); $jS->property_by_path("document.location.href"); # Execute some code my $rc = $jS->eval(q[ document.location.href = append("http://", "www.perlmonks.org"); document.write("URL is ", document.location.href); document.writeln("\nURL is ", document.location.href); function append(first, second) { return first + second; } ]); # Get the value of a property set in JS my $url = $jS->property_get("document.location.href"); print "the $url is\n"; $jS->destroy(); sub Write { print for @_; } sub WriteLn { print for @_; print "\n"; } __END__ URL is http://www.perlmonks.org URL is http://www.perlmonks.org the http://www.perlmonks.org is
____________________________________________________
** The Third rule of perl club is a statement of fact: pod is sexy.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Passing other variables to start handler in HTML::Parser
by gnangia (Scribe) on Nov 15, 2002 at 18:36 UTC | |
by pg (Canon) on Nov 15, 2002 at 18:49 UTC |