FacebookTwitter
Hatrack River Forum   
my profile login | search | faq | forum home

  next oldest topic   next newest topic
» Hatrack River Forum » Active Forums » Books, Films, Food and Culture » Can perl parse td /td tags?

   
Author Topic: Can perl parse td /td tags?
Blayne Bradley
unregistered


 - posted            Edit/Delete Post 
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?

IP: Logged | Report this post to a Moderator
King of Men
Member
Member # 6684

 - posted      Profile for King of Men   Email King of Men         Edit/Delete Post 
Why don't you try it and see?
Posts: 10645 | Registered: Jul 2004  |  IP: Logged | Report this post to a Moderator
Blayne Bradley
unregistered


 - posted            Edit/Delete Post 
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.

IP: Logged | Report this post to a Moderator
King of Men
Member
Member # 6684

 - posted      Profile for King of Men   Email King of Men         Edit/Delete Post 
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.
Posts: 10645 | Registered: Jul 2004  |  IP: Logged | Report this post to a Moderator
Blayne Bradley
unregistered


 - posted            Edit/Delete Post 
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.
IP: Logged | Report this post to a Moderator
Shigosei
Member
Member # 3831

 - posted      Profile for Shigosei   Email Shigosei         Edit/Delete Post 
How are you using Perl in this context? Why not just do a search with regular expressions?
Posts: 3546 | Registered: Jul 2002  |  IP: Logged | Report this post to a Moderator
fugu13
Member
Member # 2859

 - posted      Profile for fugu13   Email fugu13         Edit/Delete Post 
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?)

Posts: 15770 | Registered: Dec 2001  |  IP: Logged | Report this post to a Moderator
TomDavidson
Member
Member # 124

 - posted      Profile for TomDavidson   Email TomDavidson         Edit/Delete Post 
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.
Posts: 37449 | Registered: May 1999  |  IP: Logged | Report this post to a Moderator
scifibum
Member
Member # 7625

 - posted      Profile for scifibum   Email scifibum         Edit/Delete Post 
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.

Posts: 4287 | Registered: Mar 2005  |  IP: Logged | Report this post to a Moderator
Nighthawk
Member
Member # 4176

 - posted      Profile for Nighthawk   Email Nighthawk         Edit/Delete Post 
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.
Posts: 3486 | Registered: Sep 2002  |  IP: Logged | Report this post to a Moderator
scifibum
Member
Member # 7625

 - posted      Profile for scifibum   Email scifibum         Edit/Delete Post 
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.

Posts: 4287 | Registered: Mar 2005  |  IP: Logged | Report this post to a Moderator
manji
Member
Member # 11600

 - posted      Profile for manji           Edit/Delete Post 
Yes, it can. Hm, that was an easy question.
Posts: 339 | Registered: Apr 2008  |  IP: Logged | Report this post to a Moderator
Blayne Bradley
unregistered


 - posted            Edit/Delete Post 
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.
IP: Logged | Report this post to a Moderator
King of Men
Member
Member # 6684

 - posted      Profile for King of Men   Email King of Men         Edit/Delete Post 
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?
Posts: 10645 | Registered: Jul 2004  |  IP: Logged | Report this post to a Moderator
scifibum
Member
Member # 7625

 - posted      Profile for scifibum   Email scifibum         Edit/Delete Post 
"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.

Posts: 4287 | Registered: Mar 2005  |  IP: Logged | Report this post to a Moderator
Bokonon
Member
Member # 480

 - posted      Profile for Bokonon           Edit/Delete Post 
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

Posts: 7021 | Registered: Nov 1999  |  IP: Logged | Report this post to a Moderator
Orincoro
Member
Member # 8854

 - posted      Profile for Orincoro   Email Orincoro         Edit/Delete Post 
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.
Posts: 9912 | Registered: Nov 2005  |  IP: Logged | Report this post to a Moderator
   

   Close Topic   Feature Topic   Move Topic   Delete Topic next oldest topic   next newest topic
 - Printer-friendly view of this topic
Hop To:


Contact Us | Hatrack River Home Page

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