質問編集履歴

2

追記

2020/06/06 01:49

投稿

lin.ming
lin.ming

スコア50

test CHANGED
File without changes
test CHANGED
@@ -113,3 +113,79 @@
113
113
  ```
114
114
 
115
115
  と表示されます。
116
+
117
+
118
+
119
+ ##追記2
120
+
121
+ ```perl
122
+
123
+ (中略)
124
+
125
+ my $document = LWP::Simple::get($url) or die();
126
+
127
+ my $rss = XML::RSS->new;
128
+
129
+ $rss->parse($document);
130
+
131
+ for (@{$rss->{items}}){
132
+
133
+ if($counter > 5){
134
+
135
+ last;
136
+
137
+ }
138
+
139
+
140
+
141
+ my $date = substr($_->{pubDate}, 0, 10);
142
+
143
+ $date =~ s/\-./g;
144
+
145
+ $line .= "<li>" . $date;
146
+
147
+ $line .= " - ";
148
+
149
+ $line .= "<a href = \"" . $_->{link} . "\"";
150
+
151
+ $line .= $_->{title} . "</a></li>\n";
152
+
153
+ }
154
+
155
+ $line .= "</ul>\n";
156
+
157
+ ```
158
+
159
+ を実行すると、
160
+
161
+ ```
162
+
163
+ Backslash found where operator expected at ./rss_meets.pl line 26, near "</li>\"
164
+
165
+ (Missing operator before ?)
166
+
167
+ String found where operator expected at ./rss_meets.pl line 28, near "$line .= ""
168
+
169
+ (Might be a runaway multi-line "" string starting on line 26)
170
+
171
+ (Missing semicolon on previous line?)
172
+
173
+ String found where operator expected at ./rss_meets.pl line 30, near "open(BLOG, ""
174
+
175
+ (Might be a runaway multi-line "" string starting on line 28)
176
+
177
+ (Missing semicolon on previous line?)
178
+
179
+ Having no space between pattern and following word is deprecated at ./rss_meets.pl line 30.
180
+
181
+ String found where operator expected at ./rss_meets.pl line 30, at end of line
182
+
183
+ (Missing semicolon on previous line?)
184
+
185
+ syntax error at ./rss_meets.pl line 26, near "</li>\"
186
+
187
+ Can't find string terminator '"' anywhere before EOF at ./rss_meets.pl line 30.
188
+
189
+ ```
190
+
191
+ と怒られます。ダブルクォートの対応は気をつけたつもりですが、見落としはありますでしょうか?

1

追記

2020/06/06 01:49

投稿

lin.ming
lin.ming

スコア50

test CHANGED
File without changes
test CHANGED
@@ -57,3 +57,59 @@
57
57
 
58
58
 
59
59
  どうかよろしくお願いいたします。
60
+
61
+
62
+
63
+ ##追記
64
+
65
+ https://www.itmedia.co.jp/enterprise/articles/0702/22/news014.html
66
+
67
+ を参考に以下のコードに書き換えました。
68
+
69
+ ```perl
70
+
71
+ #!/usr/bin/perl
72
+
73
+
74
+
75
+ use strict;
76
+
77
+ use warnings;
78
+
79
+ use Encode;
80
+
81
+ use LWP::Simple;
82
+
83
+ use XML::RSS;
84
+
85
+ use Time::Local;
86
+
87
+
88
+
89
+ my $url = 'https://pocolog.bass-world.net/meets/feed/';
90
+
91
+ my $document = LWP::Simple::get($url) or die();
92
+
93
+ my $rss = XML::RSS->new;
94
+
95
+ $rss->parse($document);
96
+
97
+ for (@{$rss->{items}}){
98
+
99
+ print encode('UTF-8', $_->{title}), "\n";
100
+
101
+ }
102
+
103
+ return;
104
+
105
+ ```
106
+
107
+ 実行すると
108
+
109
+ ```
110
+
111
+ Protocol scheme 'https' is not supported ...propagated at ./rss_meets.pl line 11.
112
+
113
+ ```
114
+
115
+ と表示されます。