The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

String::Sections::Result - Glorified wrapper around a hash representing a parsed String::Sections result

VERSION

version 0.3.2

METHODS

sections

my $sections = $result->sections;
for my $key( keys %{$sections}) {
    ...
}

set_current

$result->set_current('foo');

has_current

if ( $result->has_current ){
}

section

my $ref = $result->section( $name );
print ${$ref};

section_names

This contains the names of the sections in the order they were found/inserted.

my @names = $result->section_names;

section_names_sorted

has_section

if ( $result->has_section($name) ) {
    ...
}

set_section

$result->set_section($name, \$data);

append_data_to_current_section

# Unitialise slot
$result->append_data_to_current_section();
# Unitialise and/or extend slot
$result->append_data_to_current_section('somedata');

append_data_to_section

# Unitialise slot
$result->append_data_to_current_section( $name );
# Unitialise and/or extend slot
$result->append_data_to_current_section( $name, 'somedata');

shallow_clone

my $clone = $result->shallow_clone;

if ( refaddr $clone->section('foo') == refaddr $result->section('foo') ) {
    print "clone success!"
}

shallow_merge

my $merged = $result->shallow_merge( $other );

if ( refaddr $merged->section('foo') == refaddr $result->section('foo') ) {
    print "foo copied from orig successfully!"
}
if ( refaddr $merged->section('bar') == refaddr $other->section('bar') ) {
    print "bar copied from other successfully!"
}

to_s

my $str = $result->to_s

ATTRIBUTES

sections

PRIVATE ATTRIBUTES

_current

_section_names

PRIVATE METHODS

_current

my $current = $result->_current;

<_section_names>

_compose_section

my $str = $result->_compose_section('bar');

AUTHOR

Kent Fredric <kentnl@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 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.