Skip to content

Access __DATA__ section via tied hash

Notifications You must be signed in to change notification settings

uperl/Tie-Hash-DataSection

Repository files navigation

Tie::Hash::DataSection static linux

Access __DATA__ section via tied hash

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

AUTHOR

Graham Ollis [email protected]

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.

About

Access __DATA__ section via tied hash

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages