From df484fd9b6640639c3a6098814b41628d02e5d54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Thu, 6 May 2021 18:21:15 +0200 Subject: Add perlmonks, irc nodes --- run/irc | 21 +++++++++++++++++++++ run/p5p | 10 +++++----- run/perlmonks | 38 ++++++++++++++++++++++++++++++++++++++ run/rss | 6 +++--- src/index.html | 10 +++++----- src/style.css | 7 +++++++ 6 files changed, 79 insertions(+), 13 deletions(-) create mode 100644 run/irc create mode 100644 run/perlmonks diff --git a/run/irc b/run/irc new file mode 100644 index 0000000..c69af13 --- /dev/null +++ b/run/irc @@ -0,0 +1,21 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use LWP::UserAgent (); + +my $ua = LWP::UserAgent->new(timeout => 5); +$ua->ssl_opts(verify_hostname => 0); +$ua->env_proxy; +$ua->agent(''); + +my $a = 'https://netsplit.de/channels/details.php?room=%23perl&net=freenode'; +my $r = $ua->get($a); +die $r->status_line if not $r->is_success; + +if ($r->decoded_content =~ m{(.*?)$2 +HTML +} diff --git a/run/p5p b/run/p5p index ebb0c62..e343723 100644 --- a/run/p5p +++ b/run/p5p @@ -17,14 +17,14 @@ my %s = %{$nntp->xhdr('Subject', [$last-10, $last])}; for ((reverse sort keys %d)[0..4]) { $_ = encode_entities($_) for ($d{$_}, $f{$_}, $s{_}); $f{$_} =~ s,@[^.]*\.,@hidden.,; + my $l = "https://www.nntp.perl.org/group/perl.perl5.porters/0/0/msg$_.html"; print < -
-Date: $d{$_} -
From: $f{$_} +
+
Date: $d{$_}
+
From: $f{$_}
+
-Subject: $s{$_} -

HTML } diff --git a/run/perlmonks b/run/perlmonks new file mode 100644 index 0000000..1f1e5b3 --- /dev/null +++ b/run/perlmonks @@ -0,0 +1,38 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use LWP::UserAgent (); +use Time::Piece; +use XML::LibXML; + +# Retrieve XML +my $ua = LWP::UserAgent->new(timeout => 5); +$ua->ssl_opts(verify_hostname => 0); +$ua->env_proxy; +$ua->agent(''); +my $a = 'https://www.perlmonks.org/?node_id=30175'; +my $r = $ua->get($a); +die $r->status_line if not $r->is_success; + +# Parse XML +my $dom = XML::LibXML->load_xml(string => $r->decoded_content); + +# Print HTML representation of each node +my $i; +for my $node ($dom->findnodes('/NEWESTNODES/NODE')) { + my $d = Time::Piece->strptime(($node->findnodes('./@createtime'))[0]->to_literal, '%Y%m%d%H%M%S')->strftime('%a, %e %B %Y %H:%M:%S UTC'); + my $f = ($node->findnodes('./@authortitle'))[0]->to_literal; + (my $s = $node->to_literal) =~ s/^\s+|\s+$//; + next if $s eq $f; # Skip home nodes + my $l = 'https://www.perlmonks.org/?node_id=' . ($node->findnodes('./@node_id'))[0]->to_literal; + print < +
Date: $d
+
From: $f
+ +
+HTML + last if ++$i >= 5; +} diff --git a/run/rss b/run/rss index 2dfb60f..5511350 100644 --- a/run/rss +++ b/run/rss @@ -20,14 +20,14 @@ my @entries = $feed->entries; # Print summary of five latest entries for my $entry (@entries[0..4]) { - my $d = encode_entities $entry->issued->ymd; + my $d = encode_entities $entry->issued->strftime('%a, %e %B %Y %H:%M:%S UTC'); my $f = encode_entities decode('utf8', $entry->author); my $s = encode_entities decode('utf8', $entry->title); my $l = encode_entities $entry->link; print < -
$d
-
$f
+
Date: $d
+
From: $f
HTML diff --git a/src/index.html b/src/index.html index 679f9d2..36bc592 100644 --- a/src/index.html +++ b/src/index.html @@ -27,14 +27,14 @@ within a few weeks had become an international phenomenon.

-Jokes aside, Perl is not dead. -It is still an excellent choice for a host of applications. -It still has – by far – the fastest startup time among +Jokes aside, Perl is alive and well. +It is an excellent choice for new applications, and +it has – by far – the fastest startup time among all its competitors, as you can see in the figure to the right. Every millisecond counts if you're building a command-line utility.

-Furthermore, the language and its community continues to evolve +Furthermore, the language and its community continue to evolve into the 2020s. Below is a summary of the recent activity of various Perl forums as of .eval print scalar localtime, ".\n"; @@ -55,7 +55,7 @@ Perl forums as of

-

Latest messages on the #perl IRC channel

+

Latest activity on the #perl IRC channel

.run irc
diff --git a/src/style.css b/src/style.css index f02e3f0..c150661 100644 --- a/src/style.css +++ b/src/style.css @@ -38,3 +38,10 @@ p.intro cite { .box h2 { font-size: 18px; } + +.entry .date, .entry .from { + font-size: smaller; +} +.entry { + margin-bottom: 1em; +} -- cgit v1.2.3