Vnlog::Parser(3pm) | vnlog | Vnlog::Parser(3pm) |
Vnlog::Parser - Simple library to parse vnlog data
use Vnlog::Parser; my $parser = Vnlog::Parser->new(); while (<DATA>) { if( !$parser->parse($_) ) { die "Error parsing vnlog line '$_': " . $parser->error(); } my $d = $parser->getValuesHash(); next unless %$d; say "$d->{time}: $d->{height}"; }
This is a simple perl script to parse vnlog input and make the incoming key/values available. The example above is representative of normal use. API functions are
Creates new Vnlog::Parser object. Takes no arguments.
Method to call for each input line. On error, a false value is returned.
If an error occurred, returns a string that describes the error.
Returns a list-ref containing the current column labels or undef if this hasn't been parsed yet.
Returns a list-ref containing the values for the current line or undef if there aren't any. This isn't an error necessarily because this line could have been a comment. Empty fields are '-' in the vnlog and undef in the values returned here.
Returns a hash-ref containing the key-value mapping for the current line or undef if there's no data in this line. This isn't an error necessarily because this line could have been a comment. Empty fields are '-' in the vnlog and undef in the values returned here.
<https://github.com/dkogan/vnlog>
Dima Kogan, "<dima@secretsauce.net>"
Copyright 2016 California Institute of Technology.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
2019-01-22 |