diff options
author | Eric Wong <e@80x24.org> | 2019-12-22 00:12:45 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-12-22 03:55:12 +0000 |
commit | f1f0db6ba1118ee91eaf93bc1e1805fecdb16948 (patch) | |
tree | 22d2b511059119409e24863c45c943ee9f87b93a /lib/PublicInbox/NNTP.pm | |
parent | 3f7c0003047a81375d5a6f8c0633a43893d75cc1 (diff) | |
download | public-inbox-f1f0db6ba1118ee91eaf93bc1e1805fecdb16948.tar.gz |
No need to do an eval dance or disable strict refs.
Diffstat (limited to 'lib/PublicInbox/NNTP.pm')
-rw-r--r-- | lib/PublicInbox/NNTP.pm | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm index 6cd2b84c..5c23e476 100644 --- a/lib/PublicInbox/NNTP.pm +++ b/lib/PublicInbox/NNTP.pm @@ -81,10 +81,7 @@ sub process_line ($$) { my ($self, $l) = @_; my ($req, @args) = split(/[ \t]/, $l); return 1 unless defined($req); # skip blank line - $req = eval { - no strict 'refs'; - *{'cmd_'.lc($req)}{CODE}; - }; + $req = $self->can('cmd_'.lc($req)); return res($self, '500 command not recognized') unless $req; return res($self, r501) unless args_ok($req, scalar @args); @@ -173,11 +170,7 @@ sub cmd_list ($;$$) { my $arg = shift @args; $arg =~ tr/A-Z./a-z_/; $arg = "list_$arg"; - - $arg = eval { - no strict 'refs'; - *{$arg}{CODE}; - }; + $arg = $self->can($arg); return r501 unless $arg && args_ok($arg, scalar @args); more($self, '215 information follows'); $arg->($self, @args); |