A Grammar to parse dig results.
Perl 6
Switch branches/tags
Nothing to show
Latest commit f6b23da Jun 11, 2017 @bioduds committed on GitHub Merge pull request #2 from zoffixznet/patch-1
Fix incorrect source url
Permalink
Failed to load latest commit information.
lib/ec/grammars up it goes Jun 7, 2017
LICENSE up it goes Jun 7, 2017
META6.json Fix incorrect source url Jun 10, 2017
README.md out to err Jun 8, 2017

README.md

EC-Grammars-DIG

EC::Grammars::DIG is a module that provides a very easy and clear way to parse the dig command.

It is part of the project HON, a blockchain that is being written in Perl6.

Main features of this module

  • run dig command and receive main results parsed
  • GNU Licensed - Software Livre

This module performs generic parsing on rules and tokens.

Contents

Base Grammar

  • EC::Grammars::DIG - Digs into dig with url

Parser Actions

EC::Grammars::DIG will provide important information parsed like the IPs, the urls, used mainly for seeded out digs for P2P networks. A simple usage would be:

use EC::Grammars::DIG;
my $proc = run 'dig', URL_YOU_WANT_TO_DIG_HERE, :out, :err;
with $proc.err { say "Error running dig"; die; }
my $output = $proc.out.slurp: :close;
my $dig = EC::Grammars::DIG.new.parse( $output, :actions( EC:Grammars::DIG::Actions.new ) );
say $dig<DATE>; ## you may here query which ever tokens or rules desired
## TO ITERATE USE, FOR INSTANCE:
for $dig<ANSWER> -> $answers {
say $answers<IP>; ## for instance

Actions Options

  • :lax Pass back, don't drop, quantities with unknown dimensions.

Installation

With zef:

zef install EC::Grammars::DIG

You'll first need to download and build Rakudo Star or better (http://rakudo.org/downloads/star/ - don't forget the final make install):

Ensure that perl6 and panda are available on your path, e.g. :

% export PATH=~/src/rakudo-star-2015.07/install/bin:$PATH

You can then use panda to test and install CSS::Grammar:

% panda install EC::Grammars::DIG

To try parsing some content:

% perl6 -MCSS::EC::Grammars::DIG -e"say EC::Grammars::DIG.parse( run 'dig', 'YOUR_URL_TO_DIG')"

See Also

References

This module been built from the W3C CSS Specifications. In particular: