use MetaParser;
my $parse = new MetaParser;
my $content = $parse->getc('http://www.spydersubmission.com');
my %meta = $parse->meta('http://www.spydersubmission.com');
print $content;
foreach (keys %meta)
{
print "$_ => $meta{$_}\n";
}
####
#!/usr/bin/perl
use warnings;
use strict;
use MetaParser;
my $parse = new MetaParser;
my %meta = $parse->meta('http://www.spydersubmission.com');
foreach (keys %meta)
{
print "$_ => $meta{$_}\n";
}
####
language => EN-US
copyright => 2004 SpyderSubmission.com
author => SpyderSubmission
description => Certified marketing consultants who will bring your site to the top of engines for less than your morning coffee.
distribution => global
rating => general
keywords => search engine optimization, search engine optimization serices, search engine optimization training, search engine positioning, SEO, websit
e submissions, web site submissions, web site promotion, website promotion, web site marketing, engine ranking, google page rank
distributor => SpyderSubmission
robots => index, follow
abstract => Leaders in online marketing services
####
package MetaParser;
use strict;
use LWP::Simple;
sub new
{
my $pkg = shift;
my $obj = {@_};
$obj = bless {%$obj},$pkg || die 'unable to bless object!';
return $obj;
}
sub getc
{
my $obj = shift;
my $url = shift;
my $content = get($url);
return $content;
}
sub meta
{
my $obj = shift;
my $url = shift;
my $content = get($url);
die "Error retriving $url" unless defined $content;
my @content_lines = split(/\n/, $content); # let's make a gigantic string with all the
my $single_line = join("", @content_lines); # lines of HTML on one line. Come on, it'll be fun
my %meta;
#
$meta{$1} = $2 while $single_line =~ m//gi;
$meta{$1} = $2 while $single_line =~ m//gi;
#
$meta{$1} = $2 while $single_line =~ m//gi;
$meta{$1} = $2 while $single_line =~ m//gi;
#
$meta{$1} = $2 while $single_line =~ m//gi;
$meta{$1} = $2 while $single_line =~ m//gi;
#
$meta{$2} = $1 while $single_line =~ m//gi;
$meta{$2} = $1 while $single_line =~ m//gi;
#
$meta{$2} = $1 while $single_line =~ m//gi;
$meta{$2} = $1 while $single_line =~ m//gi;
return %meta;
}
1;