Property::Lookup::Local - Package hash-based property lookup layer


Property-Lookup documentation Contained in the Property-Lookup distribution.

Index


Code Index:

NAME

Top

Property::Lookup::Local - Package hash-based property lookup layer

VERSION

Top

version 1.101400

SYNOPSIS

Top

    use Property::Lookup;

    my %opt;
    GetOptions(\%opt, '...');

    my $config = Property::Lookup->new;
    $config->add_layer(file => 'conf.yaml');
    $config->add_layer(getopt => \%opt);
    $config->default_layer({
        foo => 23,
    });

    my $foo = $config->foo;

    # ...

    use Property::Lookup::Local;
    local %Property::Lookup::Local::opt = (bar => 'baz');

DESCRIPTION

Top

This class implements a package hash-based property lookup layer. It has a package global %opt which the user can override - usually using local so only the scope in which this layer is used is affected.

METHODS

Top

get_config

Returns the options hash with which this layer was configured.

AUTOLOAD

Determines which key is being looked up, the simply consults the %opt for that key.

INSTALLATION

Top

See perlmodinstall for information and options on installing Perl modules.

BUGS AND LIMITATIONS

Top

No bugs have been reported.

Please report any bugs or feature requests through the web interface at http://rt.cpan.org/Public/Dist/Display.html?Name=Property-Lookup.

AVAILABILITY

Top

The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit http://www.perl.com/CPAN/ to find a CPAN site near you, or see http://search.cpan.org/dist/Property-Lookup/.

The development version lives at http://github.com/hanekomu/Property-Lookup/. Instead of sending patches, please fork this project using the standard git and github infrastructure.

AUTHOR

Top

  Marcel Gruenauer <marcel@cpan.org>

COPYRIGHT AND LICENSE

Top


Property-Lookup documentation Contained in the Property-Lookup distribution.

use 5.008;
use strict;
use warnings;

package Property::Lookup::Local;
BEGIN {
  $Property::Lookup::Local::VERSION = '1.101400';
}
# ABSTRACT: Package hash-based property lookup layer
use parent 'Property::Lookup::Base';
our %opt;    # so it can be overridden via local()

sub AUTOLOAD {
    my $self = shift;
    (my $method = our $AUTOLOAD) =~ s/.*://;
    our %opt;
    $opt{$method};
}

sub get_config {
    our %opt;
    wantarray ? %opt: \%opt;
}

1;


__END__