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

Re: Passing complex html-tag input over command line to HTML TreeBuilder method look_down() properly

by Anonymous Monk
on Apr 18, 2019 at 01:33 UTC ( #1232739=note: print w/replies, xml ) Need Help??


in reply to Passing complex html-tag input over command line to HTML TreeBuilder method look_down() properly

You did not say how/what you had tried to pass the tags and what the program received (use Data::Dumper to print to show exactly). So ...

Use Getopt::Long module to receive "tags" option arguments as a list of strings. Then process the attribute ("class" in your example) and its value yourself (use split( '=' , $attr_value_pair , 2 )).

  • Comment on Re: Passing complex html-tag input over command line to HTML TreeBuilder method look_down() properly
  • Download Code

Replies are listed 'Best First'.
Re^2: Passing complex html-tag input over command line to HTML TreeBuilder method look_down() properly
by sadarax (Sexton) on Apr 18, 2019 at 18:58 UTC
    Was the first part demonstrating how I invoke the program not clear?
    bash $: perl ./download.pl --url 'http://www.gocomics.com/9chickweedlane/2019/04/17' --tags div --tags class="comic container js-comic-"

      I did see the invocation; missed the use both of Getopt::Long & split() when I did not see what input you were actually working with. Then I had answered the wrong, possibly nonquestion of passing the tags & the attributes & the values from the command line to your program based on title of OP.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (12)
As of 2019-12-05 14:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (151 votes). Check out past polls.

    Notices?