The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Parse::Netstat - Parse the output of Unix "netstat" command

VERSION

version 0.01

SYNOPSIS

 use Parse::Netstat qw(parse_netstat);

 my $output = `netstat -anp`;
 my $res = parse_netstat output => $output;

DESCRIPTION

This module provides parse_netstat().

FUNCTIONS

None are exported by default, but they are exportable.

parse_netstat(%args) -> [STATUS_CODE, ERR_MSG, RESULT]

Parse the output of Unix "netstat" command.

Returns a 3-element arrayref. STATUS_CODE is 200 on success, or an error code between 3xx-5xx (just like in HTTP). ERR_MSG is a string containing error message, RESULT is the actual result.

Arguments (* denotes required arguments):

  • output* => str

    Output of netstat command.

    This function only parses program's output. You need to invoke "netstat" on your own.

  • tcp => bool (default 1)

    Whether to parse tcp connections.

  • udp => bool (default 1)

    Whether to parse udp connections.

  • unix => bool (default 1)

    Whether to parse unix connections.

SEE ALSO

AUTHOR

Steven Haryanto <stevenharyanto@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by Steven Haryanto.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.