Plagger/Plugin/Subscription/Bookmarks/InternetExplorer.pm untested

filter: Statementstmt 0.0% 0 / 35 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 48 CC 3 SCAR 16.1
CC
3
Cov
0%
load
12.0
BEGIN
2.0
BEGIN
2.0
CRAP 5.0
1 package Plagger::Plugin::Subscription::Bookmarks::InternetExplorer;
2 use strict;
3 use base qw( Plagger::Plugin::Subscription::Bookmarks );
4  
5 use Encode;
6 use File::Basename qw( basename );
7 use Win32::IEFavorites;
8 use Win32::Locale;
9  
10 use URI;
11  
12 sub load {
13 my($self, $context) = @_;
14  
15 my @items = Win32::IEFavorites->find(); # TODO: support expression?
16 for my $item (@items) {
17 my $url = URI->new( $item->url );
18 next if $url->scheme !~ /^http/;
19  
20 my $language = Win32::Locale::get_language();
21 my $fs_encoding = $lanuage eq 'ja' ? "cp932" : "latin-1"; # xxx utf-8?
22  
23 my $title = basename($item->path);
24 $title =~ s/\.url$//;
25 $title = decode($fs_encoding, $title);
26
27 my $feed = Plagger::Feed->new;
28 $feed->url($item->url);
29 $feed->title($title);
30 # TODO: add favico?
31 # TODO: tag support by folder name
32
33 $context->subscription->add($feed);
34 }
35 }
36  
37 1;