Mercurial > eagle-eye
changeset 146:00a21f73e906
we don't use DOM API of HTML::TagParser
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Sat, 01 Nov 2008 00:14:28 +0800 |
parents | 9fb18f3d6e26 |
children | 7f9109a50679 |
files | Ikariam.pm |
diffstat | 1 files changed, 0 insertions(+), 39 deletions(-) [+] |
line wrap: on
line diff
--- a/Ikariam.pm Fri Oct 31 16:13:36 2008 +0800 +++ b/Ikariam.pm Sat Nov 01 00:14:28 2008 +0800 @@ -95,7 +95,6 @@ use LWP; use HTTP::Cookies; use WWW::Mechanize; -use HTML::TagParser; use XML::LibXML qw(:encoding); use IO::Uncompress::Gunzip qw(gunzip $GunzipError) ; use POSIX; @@ -913,43 +912,5 @@ } } -sub getElementsByTagName { - my $element = shift; - my $tagname = lc(shift); - my ( $flat, $cur ) = @$element; - - my $out = []; - for( ; $cur <= $#$flat ; $cur++ ) { - last if ($flat->[ $cur + 1 ]->[001] eq $element->tagName() ); - next if ($flat->[$cur]->[001] ne $tagname ); - next if $flat->[$cur]->[000]; # close - - my $elem = HTML::TagParser::Element->new( $flat, $cur ); - return $elem unless wantarray; - push( @$out, $elem ); - } - return unless wantarray; - @$out; -} - -sub getElementsByAttribute { - my $element = shift; - my $key = lc(shift); - my $val = shift; - my ( $flat, $cur ) = @$element; - - my $out = []; - for ( ; $cur <= $#$flat ; $cur++ ) { - next if $flat->[$cur]->[000]; # close - my $elem = HTML::TagParser::Element->new( $flat, $cur ); - my $attr = $elem->attributes(); - next unless exists $attr->{$key}; - next if ( $attr->{$key} ne $val ); - return $elem unless wantarray; - push( @$out, $elem ); - } - return unless wantarray; - @$out; -} 1;