The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WGmeta::Wrapper::Bridge - Interface with shell using IPC::Open3

METHODS

gen_keypair()

Runs the wg genkey command and returns a private and the corresponding public-key

Returns

Two strings: private-key and public-key

get_pub_key($priv_key)

Runs wg pubkey on $priv_key.

Parameters

  • $priv_key A valid private key

Returns

A string containing the derived publickey.

get_wg_show()

Runs wg show dump and captures the output into str_out and str_err.

Raises

Please refer to "run_external($command_line [, $input, $soft_fail])"

Returns

First array of STD_OUT

run_external($command_line [, $input, $soft_fail])

Runs an external program and throws an exception (or a warning if $soft_fail is true) if the return code is != 0

Parameters

  • $command_line Complete commandline for the external program to execute.

  • [$input = undef] If defined, this is feed into STD_IN of $command_line.

  • [$soft_fail = FALSE] If set to true, a warning is thrown instead of an exception

Raises

Exception if return code is not 0 (if $soft_fail is set to true, just a warning)

Returns

Returns two lists with all lines of STDout and STDerr