Tie::Hash::DataSection - Access __DATA__ section via tied hash
version 0.01
use Tie::Hash::DataSection; tie my %ds, 'Tie::Hash::DataSection'; # "Hello World\n" print $ds{foo}; __DATA__ @@ foo Hello World
This is a simple tie class that allows you to access data section content via a Perl hash interface.
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:
tie %hash, 'Tie::Hash::DataSection', __PACKAGE__, $plugin;
the name of the plugin, for example trim
or json
.
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.
Graham Ollis <plicease@cpan.org>
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.