line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WWW::Blog::Metadata::Language; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
24015
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
5
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
109
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
473
|
use WWW::Blog::Metadata; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use Text::Language::Guess; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# Module implementation here |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
WWW::Blog::Metadata->mk_accessors(qw( language )); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub on_got_html { |
18
|
|
|
|
|
|
|
my ($class, $meta, $html, $base_uri) = @_; |
19
|
|
|
|
|
|
|
my $guesser = Text::Language::Guess->new(); |
20
|
|
|
|
|
|
|
my $plain_text = ${$html}; |
21
|
|
|
|
|
|
|
$plain_text =~ s/<.*>?//g; |
22
|
|
|
|
|
|
|
my $language = $guesser->language_guess_string($plain_text); |
23
|
|
|
|
|
|
|
$meta->language($language); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
sub on_got_html_order { 99 } |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
1; # Magic true value required at end of module |
29
|
|
|
|
|
|
|
__END__ |