| 24 | | for my $entry ($args->{feed}->entries) { |
|---|
| 25 | | my $file = $entry->id_safe . '.webbookmark'; |
|---|
| 26 | | my $path = File::Spec->catfile($dir, $file); |
|---|
| 27 | | $context->log(info => "writing output to $path"); |
|---|
| | 24 | my $entry = $args->{entry}; |
|---|
| | 25 | my $file = $entry->id_safe . '.webbookmark'; |
|---|
| | 26 | my $path = File::Spec->catfile($dir, $file); |
|---|
| | 27 | $context->log(info => "writing output to $path"); |
|---|
| 31 | | open my $out, ">:utf8", $path or $context->error("$path: $!"); |
|---|
| 32 | | print $out $body; |
|---|
| 33 | | close $out; |
|---|
| 34 | | |
|---|
| 35 | | # Add $entry->body as spotlight comment using AppleScript (OSX only) |
|---|
| 36 | | if ($self->{conf}->{add_comment}) { |
|---|
| 37 | | eval { require Mac::Glue }; |
|---|
| 38 | | my $comment = $entry->body; |
|---|
| 39 | | utf8::decode($comment) unless utf8::is_utf8($comment); |
|---|
| 40 | | $comment =~ s/<[^>]*>//g; |
|---|
| 41 | | $comment =~ s/\n//g; |
|---|
| 42 | | $comment = encode("shift_jis", $comment); # xxx |
|---|
| 43 | | |
|---|
| 44 | | my $finder = Mac::Glue->new("Finder"); |
|---|
| 45 | | my $file = $finder->obj(file => $path); |
|---|
| 46 | | $file->prop('comment')->set(to => $comment); |
|---|
| 47 | | } |
|---|
| | 35 | # Add $entry->body as spotlight comment using AppleScript (OSX only) |
|---|
| | 36 | if ($self->{conf}->{add_comment}) { |
|---|
| | 37 | eval { require Mac::Glue }; |
|---|
| | 38 | my $comment = $entry->body; |
|---|
| | 39 | utf8::decode($comment) unless utf8::is_utf8($comment); |
|---|
| | 40 | $comment =~ s/<[^>]*>//g; |
|---|
| | 41 | $comment =~ s/\n//g; |
|---|
| | 42 | $comment = encode("shift_jis", $comment); # xxx |
|---|
| | 43 | |
|---|
| | 44 | my $finder = Mac::Glue->new("Finder"); |
|---|
| | 45 | my $file = $finder->obj(file => $path); |
|---|
| | 46 | $file->prop('comment')->set(to => $comment); |
|---|