|
Revision 1588
(checked in by miyagawa, 2 years ago)
|
- Added Test::Perl::Critic test and t/perlcriticrc policy file
- Fixed 2 args open() to comfort with PBP
- Added ## no critic to express "I know what I'm doing"
|
| Line | |
|---|
| 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(); |
|---|
| 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"; |
|---|
| 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 |
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
$context->subscription->add($feed); |
|---|
| 34 |
} |
|---|
| 35 |
} |
|---|
| 36 |
|
|---|
| 37 |
1; |
|---|