NAME

Tie::Hash::DataSection - Access __DATA__ section via tied hash

VERSION

version 0.01

SYNOPSIS

use Tie::Hash::DataSection;

tie my %ds, 'Tie::Hash::DataSection';

# "Hello World\n"
print $ds{foo};

__DATA__
@@ foo
Hello World

DESCRIPTION

This is a simple tie class that allows you to access data section content via a Perl hash interface.

CONSTRUCTOR

tie %hash, 'Tie::Hash::DataSection';
tie %hash, 'Tie::Hash::DataSection', $package;
tie %hash, 'Tie::Hash::DataSection', $package, @plugins;

The optional $package argument can be used to change which package's __DATA__ section will be read from.

The optional @plugins array contains a list of Data::Section::Pluggable plugins. These can either be a:

string
tie %hash, 'Tie::Hash::DataSection', __PACKAGE__, $plugin;

the name of the plugin, for example trim or json.

array reference
tie %hash, 'Tie::Hash::DataSection', __PACKAGE__, [$plugin, @args];

The first element of the array is a plugin name, subsequent values will be passed in as arguments to the plugin.

SEE ALSO

Data::Section::Pluggable
Data::Section::Writer

AUTHOR

Graham Ollis <plicease@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2024 by Graham Ollis.

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