質問するログイン新規登録

質問編集履歴

2

追記

2020/06/06 01:49

投稿

lin.ming
lin.ming

スコア50

title CHANGED
File without changes
body CHANGED
@@ -55,4 +55,42 @@
55
55
  ```
56
56
  Protocol scheme 'https' is not supported ...propagated at ./rss_meets.pl line 11.
57
57
  ```
58
- と表示されます。
58
+ と表示されます。
59
+
60
+ ##追記2
61
+ ```perl
62
+ (中略)
63
+ my $document = LWP::Simple::get($url) or die();
64
+ my $rss = XML::RSS->new;
65
+ $rss->parse($document);
66
+ for (@{$rss->{items}}){
67
+ if($counter > 5){
68
+ last;
69
+ }
70
+
71
+ my $date = substr($_->{pubDate}, 0, 10);
72
+ $date =~ s/\-./g;
73
+ $line .= "<li>" . $date;
74
+ $line .= " - ";
75
+ $line .= "<a href = \"" . $_->{link} . "\"";
76
+ $line .= $_->{title} . "</a></li>\n";
77
+ }
78
+ $line .= "</ul>\n";
79
+ ```
80
+ を実行すると、
81
+ ```
82
+ Backslash found where operator expected at ./rss_meets.pl line 26, near "</li>\"
83
+ (Missing operator before ?)
84
+ String found where operator expected at ./rss_meets.pl line 28, near "$line .= ""
85
+ (Might be a runaway multi-line "" string starting on line 26)
86
+ (Missing semicolon on previous line?)
87
+ String found where operator expected at ./rss_meets.pl line 30, near "open(BLOG, ""
88
+ (Might be a runaway multi-line "" string starting on line 28)
89
+ (Missing semicolon on previous line?)
90
+ Having no space between pattern and following word is deprecated at ./rss_meets.pl line 30.
91
+ String found where operator expected at ./rss_meets.pl line 30, at end of line
92
+ (Missing semicolon on previous line?)
93
+ syntax error at ./rss_meets.pl line 26, near "</li>\"
94
+ Can't find string terminator '"' anywhere before EOF at ./rss_meets.pl line 30.
95
+ ```
96
+ と怒られます。ダブルクォートの対応は気をつけたつもりですが、見落としはありますでしょうか?

1

追記

2020/06/06 01:49

投稿

lin.ming
lin.ming

スコア50

title CHANGED
File without changes
body CHANGED
@@ -27,4 +27,32 @@
27
27
 
28
28
  https に対応したb HTTP::Lite をインストールすればいいと思うのですが、そのパッケージ名がわからないのでインストールできません。
29
29
 
30
- どうかよろしくお願いいたします。
30
+ どうかよろしくお願いいたします。
31
+
32
+ ##追記
33
+ https://www.itmedia.co.jp/enterprise/articles/0702/22/news014.html
34
+ を参考に以下のコードに書き換えました。
35
+ ```perl
36
+ #!/usr/bin/perl
37
+
38
+ use strict;
39
+ use warnings;
40
+ use Encode;
41
+ use LWP::Simple;
42
+ use XML::RSS;
43
+ use Time::Local;
44
+
45
+ my $url = 'https://pocolog.bass-world.net/meets/feed/';
46
+ my $document = LWP::Simple::get($url) or die();
47
+ my $rss = XML::RSS->new;
48
+ $rss->parse($document);
49
+ for (@{$rss->{items}}){
50
+ print encode('UTF-8', $_->{title}), "\n";
51
+ }
52
+ return;
53
+ ```
54
+ 実行すると
55
+ ```
56
+ Protocol scheme 'https' is not supported ...propagated at ./rss_meets.pl line 11.
57
+ ```
58
+ と表示されます。