The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Elasticsearch::Util::API::Path - A utility class for converting path templates into real paths

VERSION

version 0.74

DESCRIPTION

This module converts path templates in Elasticsearch::Role::API such as /{index}/{type}/{id} into real paths such as /my_index/my_type/123.

EXPORTS

path_init()

    use Elasticsearch::Util::API::Path qw(path_init);

    $handler = path_init($template);
    $path    = $handler->(\%params);

The path_init() sub accepts a path template and returns an anonymous sub which converts \%params into a real path, removing the keys that it has used from %params, eg:

    $handler = path_init('/{indices}/_search');
    $params  = { index => ['foo','bar'], size => 10 };
    $path    = $handler->($params);

Would result in:

    $path:      '/foo,bar/_search';
    $params:    { size => 10 };

AUTHOR

Clinton Gormley <drtech@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2013 by Elasticsearch BV.

This is free software, licensed under:

  The Apache License, Version 2.0, January 2004