Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

WWW::Mechanize::Firefox Navigate Issue !

by Matt™ (Acolyte)
on Nov 03, 2012 at 12:52 UTC ( #1002101=perlquestion: print w/ replies, xml ) Need Help??
Matt™ has asked for the wisdom of the Perl Monks concerning the following question:

Dear Mons, I have a doubt regarding the below codes. Can you pls suggest a way?

Is there a provision to pass a string to it like below,

my $Pager = "submit"; my $find_button = $mech->xpath('//*[@id="$Pager"]', single => 1 ); $mech->click( $find_button );

Its not getting me through! Giving an error like 'NO elements found'

Thanks in advance.

Comment on WWW::Mechanize::Firefox Navigate Issue !
Download Code
Replies are listed 'Best First'.
Re: WWW::Mechanize::Firefox Navigate Issue !
by aitap (Deacon) on Nov 04, 2012 at 08:10 UTC
      *cough*  Possible unintended interpolation of @id in string at - line 1.
Re: WWW::Mechanize::Firefox Navigate Issue !
by hippo (Vicar) on Nov 03, 2012 at 14:45 UTC

    Using single quotes like you have in your example supresses variable substitution in Perl just like it does in bash. See what happens here:

    my $bcount = 5; print "I ate $bcount biscuits "; print 'I ate $bcount biscuits ';

    Use single quotes for literal strings, use double quotes for interpolation (including variable substitution.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (14)
As of 2015-07-31 12:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (277 votes), past polls