A Grammar to parse dig results.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib/ec/grammars up it goes Jun 7, 2017
LICENSE
META6.json Fix incorrect source url Jun 10, 2017
README.md

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: