The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

Name

Web::ComposableRequest::Util - Functions used in this distribution

Synopsis

   use Web::ComposableRequest::Util qw( first_char );

Description

Functions used in this distribution

Configuration and Environment

Defines no attributes

Subroutines/Methods

add_config_role

   add_config_role $config_role_name;

The supplied configuration role name is pushed onto a class attribute list. See "list_config_roles"

base64_decode_ns

   $decoded_value = base64_decode_ns $encoded_value;

Decode a scalar value encode using "base64_encode_ns"

base64_encode_ns

   $encoded_value = base64_encode_ns $encoded_value;

Base 64 encode a scalar value using an output character set that preserves the input values sort order (natural sort)

bson64id

   $base64_encoded_extended_bson64_id = bson64id;

Generate a new BSON id. Returns a 20 character string that is reasonably unique across hosts and are in ascending order. Use this to create unique ids for data streams like message queues and file feeds

bson64id_time

   $seconds_elapsed_since_the_epoch = bson64id_time $bson64_id;

Returns the time the "bson64id" id was generated as Unix time

decode_array

   decode_array $encoding, $array_ref;

Applies "decode" in Encode to each element in the supplied list

decode_hash

   decode_hash $encoding, $hash_ref;

Applies "decode" in Encode to both the keys and values of the supplied hash

extract_lang

   $language_code = extract_lang $locale;

Returns the first part of the supplied locale which is the language code, e.g. en_GB returns en

first_char

   $single_char = first_char $some_string;

Returns the first character of $string

is_arrayref

   $bool = is_arrayref $scalar_variable

Tests to see if the scalar variable is an array ref

is_hashref

   $bool = is_hashref $scalar_variable

Tests to see if the scalar variable is a hash ref

is_member

   $bool = is_member 'test_value', qw( a_value test_value b_value );

Tests to see if the first parameter is present in the list of remaining parameters

list_config_roles

   @list_of_role_names = list_config_roles;

Returns the list of configuration role names stored in the class attribute. See "add_config_role"

merge_attributes

   $dest = merge_attributes $dest, $src, $defaults, $attr_list_ref;

Merges attribute hashes. The $dest hash is updated and returned. The $dest hash values take precedence over the $src hash values which take precedence over the $defaults hash values. The $src hash may be an object in which case its accessor methods are called

new_uri

   $uri_object_ref = new_uri $uri_path, $scheme;

Return a new "URI" object reference

thread_id

   $tid = thread_id;

Returns the id of this thread. Returns zero if threads are not loaded

throw

   throw error => 'error_key', args => [ 'error_arg' ];

Expose "throw" in Web::ComposableRequest::Exception. Web::ComposableRequest::Usul::Constants has a class attribute Exception_Class which can be set change the class of the thrown exception

trim

   $trimmed_string = trim $string_with_leading_and_trailing_whitespace;

Remove leading and trailing whitespace including trailing newlines. Takes an additional string used as the character class to remove. Defaults to space and tab

uric_escape

   $value_ref = uric_escape $value, $pattern;

Uses "escape_char" in URI::Escape to escape any characters in $value that match the optional pattern. Returns a reference to the escaped value

Diagnostics

None

Dependencies

Digest::MD5
Encode
URI::Escape
URI::http
URI::https

Incompatibilities

There are no known incompatibilities in this module

Bugs and Limitations

There are no known bugs in this module. Please report problems to http://rt.cpan.org/NoAuth/Bugs.html?Dist=Web-ComposableRequest. Patches are welcome

Acknowledgements

Larry Wall - For the Perl programming language

Author

Peter Flanigan, <pjfl@cpan.org>

License and Copyright

Copyright (c) 2015 Peter Flanigan. All rights reserved

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic

This program is distributed in the hope that it will be useful, but WITHOUT WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE