user/dev discussion of public-inbox itself
 help / Atom feed
* [PATCH] nntp: cleanup: move use statements out of sub scope
@ 2016-09-09 20:38 Eric Wong
  0 siblings, 0 replies; 1+ messages in thread
From: Eric Wong @ 2016-09-09 20:38 UTC (permalink / raw)
  To: meta

This clarifies the code somewhat, and we don't care to lazy-load
in NNTP.pm anyways since this is only used for a long-lived
daemon.
---
 lib/PublicInbox/NNTP.pm | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm
index 7bfc6dd..b7143ff 100644
--- a/lib/PublicInbox/NNTP.pm
+++ b/lib/PublicInbox/NNTP.pm
@@ -15,6 +15,8 @@ require PublicInbox::EvCleanup;
 use Email::Simple;
 use POSIX qw(strftime);
 use Time::HiRes qw(clock_gettime CLOCK_MONOTONIC);
+use Digest::SHA qw(sha1_hex);
+use Time::Local qw(timegm timelocal);
 use constant {
 	r501 => '501 command syntax error',
 	r221 => '221 Header follows',
@@ -237,7 +239,6 @@ sub cmd_listgroup ($;$) {
 
 sub parse_time ($$;$) {
 	my ($date, $time, $gmt) = @_;
-	use Time::Local qw();
 	my ($hh, $mm, $ss) = unpack('A2A2A2', $time);
 	if (defined $gmt) {
 		$gmt =~ /\A(?:UTC|GMT)\z/i or die "GM invalid: $gmt";
@@ -255,9 +256,9 @@ sub parse_time ($$;$) {
 		}
 	}
 	if ($gmt) {
-		Time::Local::timegm($ss, $mm, $hh, $DD, $MM - 1, $YYYY);
+		timegm($ss, $mm, $hh, $DD, $MM - 1, $YYYY);
 	} else {
-		Time::Local::timelocal($ss, $mm, $hh, $DD, $MM - 1, $YYYY);
+		timelocal($ss, $mm, $hh, $DD, $MM - 1, $YYYY);
 	}
 }
 
@@ -286,7 +287,6 @@ sub wildmat2re (;$) {
 	return $_[0] = qr/.*/ if (!defined $_[0] || $_[0] eq '*');
 	my %keep;
 	my $salt = rand;
-	use Digest::SHA qw(sha1_hex);
 	my $tmp = $_[0];
 
 	$tmp =~ s#(?<!\\)\[(.+)(?<!\\)\]#
-- 
EW


^ permalink raw reply	[flat|threaded] 1+ messages in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-09 20:38 [PATCH] nntp: cleanup: move use statements out of sub scope Eric Wong

user/dev discussion of public-inbox itself

Archives are clonable:
	git clone --mirror https://public-inbox.org/meta
	git clone --mirror http://czquwvybam4bgbro.onion/meta
	git clone --mirror http://hjrcffqmbrq6wope.onion/meta
	git clone --mirror http://ou63pmih66umazou.onion/meta

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.mail.public-inbox.meta
	nntp://ou63pmih66umazou.onion/inbox.comp.mail.public-inbox.meta
	nntp://czquwvybam4bgbro.onion/inbox.comp.mail.public-inbox.meta
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.mail.public-inbox.meta
	nntp://news.gmane.org/gmane.mail.public-inbox.general

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox