HTML-Inspect
view release on metacpan or search on metacpan
lib/HTML/Inspect.pod view on Meta::CPAN
=item $obj-E<gt>B<collectMetaClassic>(%options)
Returns a HASH reference with all C<< <meta> >> information of traditional content:
the single C<charset> and all C<http-equiv> records, plus the subset of names which
are listed on F<https://www.w3schools.com/tags/tag_meta.asp>. People defined far too
many names to be useful for everyone.
example:
{ 'http-equiv' => { 'content-type' => 'text/plain' },
charset => 'UTF-8',
name => { author => 'John Smith' , description => 'The John Smith\'s page.'},
}
=item $obj-E<gt>B<collectMetaNames>(%options)
Returns a HASH with all C<< <meta> >> records which have both a C<name> and a
C<content> attribute. These are used as key-value pairs for many, many different
purposes.
t/10_basic.t view on Meta::CPAN
isa_ok($inspector->_doc, 'XML::LibXML::Element');
like($inspector->_doc => qr|<b>FooBar</b>|, 'doc, lowercased ok');
};
my $collectMeta = sub {
my $html = read_text "t/data/collectMeta.html";
my $inspector = HTML::Inspect->new(location => 'http://example.com/doc', html_ref => \$html);
my $expectedMetaClassic = {
'charset' => 'utf-8',
'http-equiv' =>
{'content-disposition' => '', 'content-type' => 'text/html;charset=utf-8', 'refresh' => '3;url=https://www.mozilla.org'},
'name' => {
# Should capital letters be acepted in name attributes content? Not
# in standart metadata names, otherwise why not.
# See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta/name
# 'Author' => "ÐанÑо ÐанÑев",
'description' => 'The Open Graph protocol enables...',
'generator' => "Хей, гиди ÐанÑо",
'referrer' => 'no-referrer'
}
};
( run in 2.508 seconds using v1.01-cache-2.11-cpan-d7f47b0818f )