TokeParser problems - grab http-equiv ???

This works fine! It always grabs the $name and $content of the
Meta tags just like it's supposed too!
example:  
$name = "Author";
$content = "John Doe";

 $parser=HTML::TokeParser->new(\$webPage);
          while (my $token=$parser->get_tag("meta"))
           {
            $name=$token->[1]{name};          # grabs name here
            $content=$token->[1]{content};     # grabs content here
            $HashMeta{$name}=$content;        
           }


The following doesn't work! How do I grab the HTTP-EQUIV name ?
It always returns blank "" for $name.  I've tried using capitals, etc...

 $parser=HTML::TokeParser->new(\$webPage);
          while (my $token=$parser->get_tag("meta"))
           {
            $name=$token->[1]{http-equiv};     # cant grab this
            $content=$token->[1]{content};       # grabs content here
            $HashMeta{$name}=$content;  
           }

Example:
$name=""
$content="what it should be";

Also, how would I make it grab ANY tags within Meta?  There are some real weird ones (like dublin core).  Anyone got any code for this?  P.S.  You don't have to answer this last part!
jgoreAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

clockwatcherCommented:
The '-' sign is throwing you off.  Try this and I think you'll have better luck:

 $name=$token->[1]{'http-equiv'};

To list all the tags within a meta simply iterate through the keys:

use LWP::Simple;
use HTML::TokeParser;

$page = qq(
<html>
<head>
<meta http-equiv="refresh" content="1,http://www.somewhere.com">
<meta name="author" content="me">
<meta name="keyword" content="perl,tokeparser">
<meta HTTP-EQUIV="content-type" content="text/html">
<meta whatever="something" what-about-this="sure">
</head>
<body>
Hello
</body>
</html>
);

$parser = HTML::TokeParser->new(\$page);

while (my $token=$parser->get_tag("meta"))
  {
    foreach (sort keys %{$token->[1]}) {
      print "$_ : $token->[1]{$_}\n";
    }
    print "\n\n";
  }



 

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jgoreAuthor Commented:
Thanks ClockWatcher!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Perl

From novice to tech pro — start learning today.