This is topic Can perl parse td /td tags? in forum Books, Films, Food and Culture at Hatrack River Forum.


To visit this topic, use this URL:
http://www.hatrack.com/ubb/main/ultimatebb.php?ubb=get_topic;f=2;t=054308

Posted by Blayne Bradley (Member # 8565) on :
 
can perl read whats between them?

http://linux2-cs.johnabbott.qc.ca/~cs506_F08_3/AdminSearch.html

take my site here for instances, in the generated result you'll notice that the email, username, etc fields are mostly just between the column tags can perl read that?
 
Posted by King of Men (Member # 6684) on :
 
Why don't you try it and see?
 
Posted by Blayne Bradley (Member # 8565) on :
 
Because I don't know even how to "try" to parse it? All I know is $var=$query->param("tag-name");

which means if the given td field doesn't have a unique name to fetch its not gonna work.
 
Posted by King of Men (Member # 6684) on :
 
Ah, so what you're saying is that you're not actually thinking very hard about the problem and aren't willing to just try things and see what happens.
 
Posted by Blayne Bradley (Member # 8565) on :
 
dude your asking me to "try" $var=$query->param("tag-name"); for something that doesn't have a tag name. <td> </td> has no name so trying to fetch its parameter wont work. Its like asking me to put a square peg into a round hole to try it out, when we can clearly see it won't fit.
 
Posted by Shigosei (Member # 3831) on :
 
How are you using Perl in this context? Why not just do a search with regular expressions?
 
Posted by fugu13 (Member # 2859) on :
 
Since you're interested in html, I suggest you do a search for something like "parse html" (without the quotation marks) on CPAN ( http://search.cpan.org/ ).

Also, your talking about "$query->param" shows you are very confused about what you are asking (edit: and about what it means to obtain a query parameter). Start by just writing very simple, high-level, but specific steps your program will need to take to accomplish its goal (from the beginning: for instance, does it need to run a query on that page first?)
 
Posted by TomDavidson (Member # 124) on :
 
Blayne, I honestly don't understand how you could possibly be in your third year of programming classes and still be asking this sort of question.
 
Posted by scifibum (Member # 7625) on :
 
It strikes me that "td" is the tag name, at least in the DOM. It doesn't have an ID or "name" attribute, but "td" is the tag name (tagName property of the element).

So I kind of understand how Blayne got confused - HTML has tag names, and whatever perl script he looked at has 'tag-name' as a placeholder for referring to the name of some name-value pair...eh.

Blayne, take the hint and either use the tools you know or start from the beginning if you need to understand perl.

Edit: don't take my first two paragraphs as a sign that you're on the right track. You're not.
 
Posted by Nighthawk (Member # 4176) on :
 
quote:
Originally posted by TomDavidson:
Blayne, I honestly don't understand how you could possibly be in your third year of programming classes and still be asking this sort of question.

I've had senior programmers with college degrees ask me similar questions. It's not as surprising as it should be.
 
Posted by scifibum (Member # 7625) on :
 
There are lots of programming languages and people can be competent and useful to an organization and still ask dumb questions about other areas of expertise...

but perhaps the concern is with asking this sort of question without the merest effort to investigate the capabilities of a scripting language, and taking an invitation to self-educate as an invitation to dumbly insert an arbitrary line of code.
 
Posted by manji (Member # 11600) on :
 
Yes, it can. Hm, that was an easy question.
 
Posted by Blayne Bradley (Member # 8565) on :
 
quote:
Originally posted by scifibum:
It strikes me that "td" is the tag name, at least in the DOM. It doesn't have an ID or "name" attribute, but "td" is the tag name (tagName property of the element).

So I kind of understand how Blayne got confused - HTML has tag names, and whatever perl script he looked at has 'tag-name' as a placeholder for referring to the name of some name-value pair...eh.

Blayne, take the hint and either use the tools you know or start from the beginning if you need to understand perl.

Edit: don't take my first two paragraphs as a sign that you're on the right track. You're not.

I'm not supposed to be using the DOM yet.
 
Posted by King of Men (Member # 6684) on :
 
quote:
Originally posted by Blayne Bradley:
dude your asking me to "try" $var=$query->param("tag-name"); for something that doesn't have a tag name. <td> </td> has no name so trying to fetch its parameter wont work.

No, I'm not, actually. I'm asking you to take two minutes to think. Or else five minutes to try different things and see what happens. And why are you using perl to parse HTML, anyway?
 
Posted by scifibum (Member # 7625) on :
 
"I'm not supposed to be using the DOM yet. "

Are you supposed to be using Perl? If so then you need to hit the books and learn it. The answer, as provided by manji, is yes, it can parse td tags (or any text*). Whether you should use Perl for that is another question. What you are trying to do is unclear. Why are you parsing the HTML on your search results page?

*I know this not because I'm conversant with Perl - I couldn't write a Perl program without significant googling - but because I've done some very minimal reading about Perl and learned that it does, indeed, handle text, just like every other general-purpose programming language.
 
Posted by Bokonon (Member # 480) on :
 
Dude, you are confused. Try submitting your search form and outputting the URL/query your code receives, maybe that will un-confuse you?

A hint in the form of a question: If you submit your form, do the td tags appear in you input to your code? What else is in the input?

-Bok
 
Posted by Orincoro (Member # 8854) on :
 
quote:
Originally posted by TomDavidson:
Blayne, I honestly don't understand how you could possibly be in your third year of programming classes and still be asking this sort of question.

In theory, it sounds crazy, but you're also talking to Blayne... I'm surprised you don't understand after three years of blayne posting.
 


Copyright © 2008 Hatrack River Enterprises Inc. All rights reserved.
Reproduction in whole or in part without permission is prohibited.


Powered by Infopop Corporation
UBB.classic™ 6.7.2