Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: HTML::TokeParser::Smart

by Amoe (Friar)
on Apr 09, 2002 at 10:22 UTC ( [id://157689]=note: print w/replies, xml ) Need Help??


in reply to HTML::TokeParser::Smart

Aww, I was hoping it would automagically figure out which bits of HTML I wanted... ;)

Couple of points to make about this, though:

  • Saying use base 'HTML::TokeParser' is IMHO a lot cleaner than that BEGIN mess.
  • If your class user provides a URL with angle brackets in and forgets to URI-escape them, you'll pass it as HTML, which probably won't dwim. Perhaps there's a module you could use to check if a file's HTML?
  • Using LWP::Simple makes saying that middle bit a lot easier, and since you're not using any of the extra featues of UserAgent its use is redundant here.

Actually, you could solve that middle problem quite neatly by just switching the order of the tests so that it went (file - url - html) rather than (file - html - url), since all URLs acceptable by LWP will have a protocol, and URIs in HTML must be wrapped in a tag.

--
amoe

Replies are listed 'Best First'.
Re: Re: HTML::TokeParser::Smart
by lshatzer (Friar) on Apr 09, 2002 at 13:15 UTC
    Thanks for your input, I also recived some suggestons from crazyinsomiac to take a look at URI::URL, since I knew my url checking was not the best, and I had planned on changing it.

    Your last bullet point, see my use.perl journal, it has some info from Sean Burke. Any other suggestions would be welcome.

    Also, a better name would be good, another comment from crazyinsomniac says the Smart part dosn't indicate what the module does, but does not have any suggestions...

    Some other ideas I had was HTML::TokeParser::URL, but it will also do files or html.

    On an unrelated note, this is my 42nd post, not a 'major' milestone, but I think it's cool.
      lshatzer, I am very interested to use this package since I desparately need to URL in conjunction with HTML::TokeParser.
      I am new to LWP stuff.
      Would you please give some pointer as to how I can use this package? Thank you

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-19 02:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found