Skip to content

hirose31/perl-Text-LBSV

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NAME
    Text::LBSV - Labeled Bell Separated Value manipulator

SYNOPSIS
      use Text::LBSV;
      my $p = Text::LBSV->new;
      my $hash = $p->parse_line("hoge:foo\abar:baz\n");
      is $hash->{hoge}, 'foo';
      is $hash->{bar},  'baz';

      my $data = $p->parse_file('./t/test.lbsv'); # or parse_file_utf8
      is $data->[0]->{hoge}, 'foo';
      is $data->[0]->{bar}, 'baz';

      # Iterator interface
      my $it = $p->parse_file_iter('./t/test.lbsv'); # or parse_file_iter_utf8
      while ($it->has_next) {
          my $hash = $it->next;
          ...
      }
      $it->end;

      # Only want certain fields?
      my $p = Text::LBSV->new;
      $p->want_fields('hoge');
      $p->parse_line("hoge:foo\abar:baz\n");

      # Vise versa
      my $p = Text::LBSV->new;
      $p->ignore_fields('hoge');
      $p->parse_line("hoge:foo\abar:baz\n");

      my $lbsv = Text::LBSV->new(
        hoge => 'foo',
        bar  => 'baz',
      );
      is $lbsv->to_s, "hoge:foo\abar:baz";

DESCRIPTION
    Labeled Bell-separated Values (LBSV) format is a variant of
    Bell-separated Values (BSV). Each record in a LBSV file is represented
    as a single line. Each field is separated by BELL and has a label and a
    value. The label and the value have been separated by ':'.

    cf: <http://lbsv.org/>

    This format is useful for log files, especially HTTP access_log.

    This module provides a simple way to process LBSV-based string and
    files, which converts Key-Value pair(s) of LBSV to Perl's hash
    reference(s).

AUTHOR
    HIROSE Masaaki <[email protected]> Naoya Ito <[email protected]>

LICENSE
    This library is free software; you can redistribute it and/or modify it
    under the same terms as Perl itself.

About

Text::LBSV - Labeled Bell Separated Value manipulator

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages