Thanks!!
That's what I figured and I was actually just formulating another question based on it
::
if($token->[0] eq 'a'){
print $token->[1]{href} || "what?","\n";
# print $tok->get_trimmed_text("/a"); print "\n";
}
elsif($token->[0] eq 'img') {
print $token->[1]{src} || "again?","\n";
print $token->[1]{alt} || "again?","\n";
}
If I comment out that line it works and if I comment it it removes whatever is
inbetween the <a tags.
I winder if it's possible to do some thing like this :
if($token->[0] eq 'a'){
print $token->[1]{href} || "what?","\n";
my $link_guts = $tok->get_trimmed_text("/a");
and then some how grab the 'src' and 'alt' attributes from each img tag in $link_guts
if it's an image and the regular text if it's not and probably all three if it has an
img's and text
Would a whole new object be a good idea ::
my $tok2 = new HTML::TokeParser(\$link_guts) || die $!;
while(1){
my $token = $tok2->get_tag("img");
last unless($token);
if($token->[0] eq 'img') {
print $token->[1]{src} || "again?","\n";
print $token->[1]{alt} || "again?","\n";
}
else { print "somehow print any text here"; } # how would I do this
}
}
}
>
> Dan Muey wrote:
>
> >
> >
> > The script you sent me does get the imagses, mine doesn't
> so I screwed
> > up somewhere along the way. I'll take your original and
> modify it one
> > step at a time to narrow down what I did wrong.
> >
> > I'll post back when I get it right so that hopefully
> someone can learn
> > from my dumbness.
>
> that's not dumbness.
>
> >
> >> my $text = $p->get_trimmed_text("/a");
>
> you didn't screw anything up. your problem is this line. it
> eats up the text
> between the <a> and </a> link which isn't really a text, it's <img>
> instead. so your <img> tag "disappeared" after this line. if
> you remove it,
> you will see it show up.
>
> david
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]