NAME
    String::Sections - Extract labelled groups of sub-strings from a string.

VERSION
    version 0.1.1

SYNOPSIS
      use String::Sections;

      my $sections = String::Sections->new();
      $sections->load_list( @lines );
      # TODO
      # $sections->load_string( $string );
      # $sections->load_filehandle( $fh );
      #
      # $sections->merge( $other_sections_object );

      my @section_names = $sections->section_names();
      if ( $sections->has_section( 'section_label' ) ) {
        my $string_ref = $sections->section( 'section_label' );
        ...
      }

DESCRIPTION
    Data Section sports the following default data markup

      __[ somename ]__
      Data
      __[ anothername ]__
      More data

    This module is designed to behave as a work-alike, except on already
    extracted string data.

METHODS
  new
  new( %args )
      my $object = String::Sections->new();

      my $object = String::Sections->new( attribute_name => 'value' );

  load_list
  load_list ( @strings )
  load_list ( \@strings )
      my @strings = <$fh>;

      $object->load_list( @strings );

      $object->load_list( \@strings );

    This method handles data as if it had been slopped in unchomped from a
    filehandle.

    Ideally, each entry in @strings will be terminated with $/ , as the
    collated data from each section is concatenated into a large singular
    string, e.g.:

      $object->load_list("__[ Foo ]__\n", "bar\n", "baz\n" );
      $object->section('Foo')
      # bar
      # baz

      $object->load_list("__[ Foo ]__\n", "bar", "baz" );
      $object->section('Foo');
      # barbaz

      $object->load_list("__[ Foo ]__", "bar", "baz" ) # will not work by default.

    This behaviour may change in the future, but this is how it is with the
    least effort for now.

  load_string
    TODO

  load_filehandle
  load_filehandle( $fh )
      $object->load_filehandle( $fh )

  merge
    TODO

  section_names
      my @names = $object->section_names;

    Returns a list of the sections that have been extracted so far.

  has_section
  has_section( $name )
      if( $object->has_section('Foo') ){
        # code
      }

    Determines if the given section name has been extracted.

  section
  section( $name )
      my $str = $object->section('Foo');

      print ${ $str };

    This returns a REFERENCE to a String that was parsed from section "Foo".

DEVELOPMENT
    This code is still new and under development.

    All the below facets are likely to change at some point, but don't
    largely contribute to the API or usage of this module.

    *   Needs Perl 5.10.1

        To make some of the development features easier.

Recommended Use with Data::Handle
    This modules primary inspiration is Data::Section, but intending to
    split and decouple many of the internal parts to add leverage to the
    various behaviors it contains.

    Data::Handle solves part of a problem with Perl by providing a more
    reliable interface to the __DATA__ section in a file that is not impeded
    by various things that occur if its attempted to be read more than once.

    In future, I plan on this being the syntax for connecting Data::Handle
    with this module to emulate Data::Section:

      my $dh = Data::Handle->new( __PACKAGE__ );
      my $ss = String::Sections->new( stop_at_end => 1 );
      $ss->load_filehandle( $dh );

    This doesn't implicitly perform any of the inheritance tree magic
    Data::Section does, but its also planned on making that easy to do when
    you want it with "->merge( $section )"

    For now, the recommended code is not so different:

      my $dh = Data::Handle->new( __PACKAGE__ );
      my $ss = String::Sections->new( stop_at_end => 1 );
      $ss->load_list( <$dh> );

    Its just somewhat less efficient.

AUTHOR
    Kent Fredric <kentnl@cpan.org>

COPYRIGHT AND LICENSE
    This software is copyright (c) 2011 by Kent Fredric <kentnl@cpan.org>.

    This is free software; you can redistribute it and/or modify it under
    the same terms as the Perl 5 programming language system itself.

