| 
		
			
			
				
			
			
				 
			
			
				
			
		 | 
		
			
			
				 
			
				
			
		 | 
	||||
| 
				Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.  You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us.  | 
		
		 
		![]()  | 
	
		
			
  | 	
	
	
		
		|||||||
| Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. | 
| 
		 | 
	Thread Tools | 
| 
			
			 | 
		#1 | 
| 
			
			
			
			 (felis madjewicus) 
			
		
			
			
			Industry Role:  
				Join Date: Jul 2006 
				Location: In Mom & Dad's Basement 
				
				
					Posts: 20,368
				 
				
				
				
				 | 
	
	
	
	
		
			
			 Already dropped my question on a few Perl forums, and I've been detached from my regular Perl master for a few days. If you know your shit and have a moment I'd like to run a question passed you.  
		
	
		
		
		
		
		
	
	![]()  | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#3 | 
| 
			
			
			
			 (felis madjewicus) 
			
		
			
			
			Industry Role:  
				Join Date: Jul 2006 
				Location: In Mom & Dad's Basement 
				
				
					Posts: 20,368
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 what i'm trying to achieve is that i'd like to extract all the html contained within a specified table. i have targeted the table, and i attempted to clip out the required html using "get_trimmed_text" but it parses the html as text, so all the html tags are not saved using this method. is there an equivelant to using get_trimmed_text I could use within HTML::TokeParser or should I be looking into a different module. IS there a funtion for trimming down html in WWW::Mechanize? 
		
	
		
		
		
		
		
	
	Code: 
	!/usr/bin/perl
use strict;
use warnings;
use HTML::TokeParser;
use LWP::Simple;
# extract.pl
  print "Enter the page URL: ";
      chomp( my $domain = <STDIN> );
  print "Enter the output HTML filename: ";
      chomp( my $html_output = <STDIN> );
  my $content = get($domain) or die $!;
  my $stream = HTML::TokeParser->new( \$content ) or die $!;
  while ( my $tag = $stream->get_tag( "table" ) ) {
      if ( $tag->[1]{cellpadding} and  $tag->[1]{cellpadding} eq '8' ) {
      # what do i do here?
      }
  }
 | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#4 | 
| 
			
			
			
			 (felis madjewicus) 
			
		
			
			
			Industry Role:  
				Join Date: Jul 2006 
				Location: In Mom & Dad's Basement 
				
				
					Posts: 20,368
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 Shit I just found out there is an HTML::TableExtract module :D, gonna go Google now, peace... 
		
	
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#5 | 
| 
			
			
			
			 Too lazy to set a custom title 
			
		
			
			
			Join Date: Dec 2004 
				
				
				
					Posts: 17,513
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 peace fucker 
		
	
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#6 | 
| 
			
			
			
			 (felis madjewicus) 
			
		
			
			
			Industry Role:  
				Join Date: Jul 2006 
				Location: In Mom & Dad's Basement 
				
				
					Posts: 20,368
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 hrmmm, if i could trim all points before and after a set point in a text file somehow i could make this work. any ideas? 
		
	
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#7 | 
| 
			
			
			
			 Too lazy to set a custom title 
			
		
			
			
			Industry Role:  
				Join Date: May 2004 
				Location: West Coast, Canada. 
				
				
					Posts: 10,217
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 Don't know why you're using Tokeparser for this... 
		
	
		
		
		
		
		
	
	Code: 
	$lchtml = lc($html); $start = index($lchtml, '<table'); $end = index($lchtml, '</table>') + 8; $table = substr($html, $start, $end - $start);  | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#9 | 
| 
			
			
			
			 Confirmed User 
			
		
			
				
			
			
			Join Date: Apr 2002 
				Location: Houston 
				
				
					Posts: 5,651
				 
				
				
				
				 | 
	
	|
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#10 | 
| 
			
			
			
			 Too lazy to set a custom title 
			
		
			
			
			Industry Role:  
				Join Date: May 2004 
				Location: West Coast, Canada. 
				
				
					Posts: 10,217
				 
				
				
				
				 | 
	
	|
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#11 | |
| 
			
			
			
			 (felis madjewicus) 
			
		
			
			
			Industry Role:  
				Join Date: Jul 2006 
				Location: In Mom & Dad's Basement 
				
				
					Posts: 20,368
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 Quote: 
	
 I got some help and have achieved my goal using HTML::TreeBuilder though. Everything has been running just skippy. I'm gonna look mor einto what you've given me though, looks as though it'd shave a few lines off my code...  | 
|
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#12 | 
| 
			
			
			
			 (felis madjewicus) 
			
		
			
			
			Industry Role:  
				Join Date: Jul 2006 
				Location: In Mom & Dad's Basement 
				
				
					Posts: 20,368
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 Cheers Tempest, shaved 7 lines of code off, and is much easier to remember then the TreeBuilder method for future use. 
		
	
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#13 | 
| 
			
			
			
			 Too lazy to set a custom title 
			
		
			
			
			Industry Role:  
				Join Date: May 2004 
				Location: West Coast, Canada. 
				
				
					Posts: 10,217
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 If you're going to do quite a bit of Perl, I'd recomend you get and read this book http://oreilly.com/catalog/9780596520106/ and then the rest in the series... You might also want to check out this downloadable book http://www.perl.org/books/beginning-perl/ or perhaps this site http://www.perltutorial.org/ 
		
	
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 | 
| 
			
			 | 
		#14 | |
| 
			
			
			
			 (felis madjewicus) 
			
		
			
			
			Industry Role:  
				Join Date: Jul 2006 
				Location: In Mom & Dad's Basement 
				
				
					Posts: 20,368
				 
				
				
				
				 | 
	
	
	
	
		
		
		
		 Quote: 
	
  | 
|
| 
		 | 
	
	
	
		
                 
		
		
		
		
		
		
		
			
			
		
	 |