PrasadMS has asked for the wisdom of the Perl Monks concerning the following question:

Is there a way in PERL where i can pass a value to Jscript. To be precise, in this link http://metagenomics.anl.gov/metagenomics.cgi?page=MetagenomeOverview&metagenome=4447943.3 under the "Rank Abundance Plot", there is a dropdown, which is by default set to phylum and the corresponding data can be downloaded in the given link. This data i am able to download via PERL code. But is there a way to download the data for species via PERL code. Is there a way we can get those images? Thanks

Replies are listed 'Best First'.
Re: Passing value to Jscript
by kennethk (Abbot) on Jun 30, 2014 at 18:43 UTC
    It's unclear what you mean by 'data for species', but chances are that if Javascript is involved, then it's just an AJAX call. Use a tool like Firebug to watch the net transactions and learn the appropriate URLs. And while you are at it, review the site terms of service and check for a robots.txt file to make sure you are scraping resepctfully.

    #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

Re: Passing value to Jscript
by LanX (Saint) on Jun 30, 2014 at 18:31 UTC
    Sounds (?) like a job for WWW::Mechanize::Firefox

    Search the archives for examples ...

    Cheers Rolf

    (addicted to the Perl Programming Language)

Re: Passing value to Jscript
by wrog (Friar) on Jul 01, 2014 at 00:03 UTC
    Or you could just do a view-source on that page to see where that dropdown comes from and what URL gets sent when you click on the link

    There's only one <select> box where one of the options is "species".
    The select box has the id "tax_level" which is referenced only once,
    where the value gets assigned to "new_level"
    which is likewise assigned only once,
    which then gets you to a single "execute_ajax()" call,
    which looks to be a fairly generic routine that builds a URL.

    My guess is if you look through the .js files you'll find where execute_ajax() is defined to see just how it builds the URL.

    Note, by the way, that unless you're running something like greasemonkey, you're never actually getting to pass anything to J[ava]script yourself.

Re: Passing value to Jscript
by Anonymous Monk on Jun 30, 2014 at 18:12 UTC
    "Is there a way we can get those images? " We?

    How much is your employer paying you to implement this? If the amount is more than zero, give me 20% and I will help out. :)