1
0
Fork 0
mirror of https://github.com/perlbot/perlbuut synced 2025-06-07 18:35:49 -04:00

some updates

This commit is contained in:
Ryan Voots 2020-10-31 01:52:42 -04:00
parent 5fae083979
commit 6f57e480f3
6 changed files with 9 additions and 10 deletions

View file

@ -7,7 +7,6 @@ use Data::Dumper;
use Text::Glob qw/match_glob/; use Text::Glob qw/match_glob/;
use Memoize; use Memoize;
use Regexp::Assemble; use Regexp::Assemble;
use JSON::MaybeXS qw//;
use strict; use strict;
sub new { sub new {

View file

@ -50,7 +50,7 @@ sub _start {
# TODO setup TCP server. # TODO setup TCP server.
$self->{server} = POE::Component::Server::TCP->new( $self->{server} = POE::Component::Server::TCP->new(
Port => 1784, Port => 1784,
Address =>'192.168.196.2', Address =>'192.168.32.1',
ClientFilter => "POE::Filter::Line", ClientFilter => "POE::Filter::Line",
ClientInput => \&receive_paste, ClientInput => \&receive_paste,
); );

View file

@ -747,7 +747,6 @@ sub get_fact_grep ($self, $body, $name, $said) {
my $value_only = $body =~ s/\s*--val\s+//; my $value_only = $body =~ s/\s*--val\s+//;
#XXX: need to also search contents of factoids TODO
$results = $self->dbh->selectall_arrayref(" $results = $self->dbh->selectall_arrayref("
WITH RECURSIVE factoid_lookup_order_inner (depth, namespace, server, alias_namespace, alias_server, parent_namespace, parent_server, recursive, gen_server, gen_namespace) AS ( WITH RECURSIVE factoid_lookup_order_inner (depth, namespace, server, alias_namespace, alias_server, parent_namespace, parent_server, recursive, gen_server, gen_namespace) AS (
SELECT 0 AS depth, namespace, server, alias_namespace, alias_server, parent_namespace, parent_server, recursive, generated_server, generated_namespace SELECT 0 AS depth, namespace, server, alias_namespace, alias_server, parent_namespace, parent_server, recursive, generated_server, generated_namespace

View file

@ -60,9 +60,9 @@ sub command {
$query =~ s/%20/+/g; $query =~ s/%20/+/g;
if ($oper eq 'q') { if ($oper eq 'q') {
$url = "https://perldoc.pl/search?no_redirect=1&q=".$query."#FAQ"; $url = "https://perldoc.perl.org/search?no_redirect=1&q=".$query."#FAQ";
} else { } else {
$url = "https://perldoc.pl/search?q=".$query; $url = "https://perldoc.perl.org/search?q=".$query;
} }
# $url = makeashorterlink($url); # $url = makeashorterlink($url);
} }
@ -76,19 +76,19 @@ sub command {
$func = "-X" if ($func eq "-x"); #only case where it isn't lowercase, its easier to test at this point $func = "-X" if ($func eq "-x"); #only case where it isn't lowercase, its easier to test at this point
$url = "https://perldoc.pl/functions/".$func $url = "https://perldoc.perl.org/functions/".$func
} }
elsif ($said->{body} =~ /-v\s+(\S+)\s*/i) #functions, only use the first part of a multiword expression elsif ($said->{body} =~ /-v\s+(\S+)\s*/i) #functions, only use the first part of a multiword expression
{ {
my $var = uri_encode($1, {"encode_reserved" => 1}); my $var = uri_encode($1, {"encode_reserved" => 1});
$url = "https://perldoc.pl/variables/".$var $url = "https://perldoc.perl.org/variables/".$var
} }
elsif ($said->{body} =~ /-m\s+(\S+)\s*/i) # got a module! elsif ($said->{body} =~ /-m\s+(\S+)\s*/i) # got a module!
{#http://search.cpan.org/search?query=foo%3ABar&mode=all {#http://search.cpan.org/search?query=foo%3ABar&mode=all
my $query = uri_encode($1); my $query = uri_encode($1);
# $query =~ s/%20/+/g; # $query =~ s/%20/+/g;
$url = "https://perldoc.pl/".$query; $url = "https://perldoc.perl.org/".$query;
# $url = makeashorterlink($url); # $url = makeashorterlink($url);
} }
elsif ($said->{body} =~ /::/) #module, go to cpan also elsif ($said->{body} =~ /::/) #module, go to cpan also
@ -97,14 +97,14 @@ sub command {
$trimmed =~ s/^\s*(\S+)\s*(?:#.*)?$/$1/; $trimmed =~ s/^\s*(\S+)\s*(?:#.*)?$/$1/;
my $query = uri_encode($trimmed); my $query = uri_encode($trimmed);
$query =~ s/%20/+/g; $query =~ s/%20/+/g;
$url = "https://perldoc.pl/$query"; $url = "https://perldoc.perl.org/$query";
# $url = makeashorterlink($url); # $url = makeashorterlink($url);
} }
else # we've got just a plain word, use it as a doc title else # we've got just a plain word, use it as a doc title
{ #http://perldoc.perl.org/perlrun.html { #http://perldoc.perl.org/perlrun.html
if ($said->{body} =~ /^\s*(\S+)\s*(?:#.*)?$/) if ($said->{body} =~ /^\s*(\S+)\s*(?:#.*)?$/)
{ {
$url = "https://perldoc.pl/$1"; $url = "https://perldoc.perl.org/$1";
} }
else else
{ {

View file

@ -14,6 +14,7 @@ use Regexp::Optimizer;
use Regexp::Assemble; use Regexp::Assemble;
use strict; use strict;
use utf8; use utf8;
use DBI;
no warnings 'void'; no warnings 'void';