On Mon, Feb 08, 2021 at 01:46:11PM -0600, J. Chris Coppick wrote:
>Do not think the "use Vileserv" replaces those other lines.  It does ring a
>bell.  I'd have to dig up the docs and code to check what was required for
>what.

It does, you can pretty easily test it:

  $ echo 'perl "use Vileserv"' >~/vilerc.tmp
  $ vile @~/vilerc.tmp
  :!vileget /etc/passwd

at which point you should have a buffer containing /etc/passwd.

If you're interested in the gory details, the `use Vileserv;' statment in Perl
is equivalent to:

  BEGIN { require Vileserv; Vileserv->import() }

You can ignore the BEGIN block which just changes the evaluation order (not
relevant given that this evaluation context contains only that statement), the
important part here is the invocation of the `import' method, which in the
case of Vileserv does this:

  https://salsa.debian.org/debian/vile/-/blob/master/perl/Vileserv.pm#L80-83

it first calls `Vile::Exporter::import', which is the magic by which every key
in `%REGISTRY' is mapped to a command using `Vile::register':

  https://salsa.debian.org/debian/vile/-/blob/master/perl/Vileserv.pm#L33-38

it then starts the server.  The `END' block arranges to stop the server on
exit:

  https://salsa.debian.org/debian/vile/-/blob/master/perl/Vileserv.pm#L76-78

--bod

Reply via email to