++ed by:
SSCAFFIDI MATTP SYP

3 PAUSE user(s)
1 non-PAUSE user(s).

Doug Hoyte

NAME

App::Unliner - Untangle your unix pipeline one-liners

SYNOPSIS

Unliner is a scripting language and toolset for refactoring and developing unix one-liners.

Note: This page is a high-level overview of unliner. For an introduction and manual, see App::Unliner::Intro.

The simplest way to install unliner is with cpanminus:

    curl -sL https://raw.github.com/miyagawa/cpanminus/master/cpanm | sudo perl - App::Unliner

Here is an unliner script to display response code tallies from standard apache logs. Save it in the file reportgen:

    #!/usr/bin/env unliner

    def main {
        extract-response-codes $@ | tally
    }

    def extract-response-codes : perl -n {
        ## HTTP response code is 2nd last field
        print "$1\n" if /(\d\d\d) \S+$/;
    }

    def tally {
        sort | uniq -c | sort -rn
    }

Now make reportgen executable:

    $ chmod a+x reportgen

Now you can run reportgen like a normal program:

    $ ./reportgen /var/www/log/access.log
      43628 200
       1911 301
        201 404
          6 500

SEE ALSO

For a more detailed description of unliner, see the introduction: App::Unliner::Intro.

Unliner github repo

AUTHOR

Doug Hoyte, <doug@hcsw.org>

COPYRIGHT & LICENSE

Copyright 2012-2014 Doug Hoyte.

This module is licensed under the same terms as perl itself.