diff options
author | John Ankarström <john@ankarstrom.se> | 2021-05-06 18:21:15 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2021-05-06 18:21:15 +0200 |
commit | df484fd9b6640639c3a6098814b41628d02e5d54 (patch) | |
tree | bad0c9b4f01d383059937a95cabd48d6ed544473 | |
parent | 65f946b63b4786170702097288aa1c84bd8e8fa1 (diff) | |
download | perlisdead-df484fd9b6640639c3a6098814b41628d02e5d54.tar.gz |
Add perlmonks, irc nodes
-rw-r--r-- | run/irc | 21 | ||||
-rw-r--r-- | run/p5p | 10 | ||||
-rw-r--r-- | run/perlmonks | 38 | ||||
-rw-r--r-- | run/rss | 6 | ||||
-rw-r--r-- | src/index.html | 10 | ||||
-rw-r--r-- | src/style.css | 7 |
6 files changed, 79 insertions, 13 deletions
@@ -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{<img border="0" src="(/tmp/channels/.*?\.png)" alt="(.*?)"}) { + print <<HTML; +<a href="$a"><img border="0" src="https://netsplit.de$1" alt="$2"/></a> +HTML +} @@ -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,@[^.]*\.,@<i>hidden</i>.,; + my $l = "https://www.nntp.perl.org/group/perl.perl5.porters/0/0/msg$_.html"; print <<HTML; <p> -<div style="font-size: 80%; margin: 0;"> -<span class="date" style="line-height: 1;">Date: $d{$_}</span> -<br/><span class="from">From: $f{$_}</span> +<div class="entry"> +<div class="date">Date: $d{$_}</div> +<div class="from">From: $f{$_}</div> +<div class="subject"><a href="$l">$s{$_}</a></div> </div> -<span class="subject">Subject: <a href="https://www.nntp.perl.org/group/perl.perl5.porters/0/0/msg$_.html">$s{$_}</a></span> -</p> 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 <<HTML; +<div class="entry"> +<div class="date">Date: $d</div> +<div class="from">From: $f</div> +<div class="subject"><a href="$l">$s</a></div> +</div> +HTML + last if ++$i >= 5; +} @@ -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 <<HTML <div class="entry"> -<div class="date">$d</div> -<div class="from">$f</div> +<div class="date">Date: $d</div> +<div class="from">From: $f</div> <div class="subject"><a href="$l">$s</a></div> </div> 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. </div> <p> -<b>Jokes aside, Perl is not dead.</b> -It is still an excellent choice for a host of applications. -It still has – by far – the fastest startup time among +<b>Jokes aside, Perl is alive and well.</b> +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. <p> -<b>Furthermore, the language and its community continues to evolve +<b>Furthermore, the language and its community continue to evolve into the 2020s</b>. 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 </div> <div class="box" id="irc"> -<h2>Latest messages on the <a href="https://kiwiirc.com/nextclient/irc.freenode.net/#perl">#perl</a> IRC channel</h2> +<h2>Latest activity on the <a href="https://kiwiirc.com/nextclient/irc.freenode.net/#perl">#perl</a> IRC channel</h2> .run irc </div> 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; +} |