From 22e69f338295b2ab3ab7386ec7933c54ac104eb4 Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Thu, 21 Oct 2021 23:22:31 -0400 Subject: [PATCH] txt2pre: eliminate 'Use of uninitialized value ...' warnings the 404 pages don't have $url --- txt2pre | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/txt2pre b/txt2pre index 31fdb78..5bf8811 100644 --- a/txt2pre +++ b/txt2pre @@ -1,5 +1,5 @@ #!/usr/bin/env perl -# txt2pre --- convert my site's txt files to `pre'-based html +# txt2pre --- convert my site's txt files to `pre'-based atom/rss/html # Copyright (C) 2014-2021 all contributors # Copyright (c) 2021 Amin Bandali @@ -211,10 +211,10 @@ $txt = linkify(html_esc($txt)); my $upd_iso8601 = `date -Iseconds -ud '$upd' | tr -d \\\\n` if $upd; my $pub_iso8601 = `date -Iseconds -ud '$pub' | tr -d \\\\n` if $pub; my $pub_rfc5322 = `date -uRd '$pub' | tr -d \\\\n` if $pub; -my $url_html = $url =~ s/(?:[.]$lang)?[.]txt$/.html/r; -$url_html =~ s|/bandali-(.*)|/$1|; -my $slug = $url_html =~ s|.*/(.*)[.]html$|$1|r; -my $note_id = "$feed_id:$slug"; +my $url_html = $url =~ s/(?:[.]$lang)?[.]txt$/.html/r if $url; +$url_html =~ s|/bandali-(.*)|/$1| if $url_html; +my $slug = $url_html =~ s|.*/(.*)[.]html$|$1|r if $url_html; +my $note_id = "$feed_id:$slug" if $url_html; # note header if ($format eq 'html') { -- 2.20.1