NAME

Database::BI::Util - Shared utility functions for Database::BI modules

SYNOPSIS

use Database::BI::Util qw(urlencode);
my $safe = urlencode($query_param_value);

DESCRIPTION

Small helpers shared by the plain-Perl modules (Database::BI::Ask, Database::BI::Insights) that build URLs without depending on Mojolicious. Nothing is exported by default.

FUNCTIONS

urlencode

my $encoded = urlencode($str);

Percent-encodes a string for use as a URI query-parameter value. Preserves the RFC 3986 unreserved characters (A-Z a-z 0-9 - . _ ~) and replaces all other bytes with %XX uppercase hex escapes.

API SPECIFICATION

INPUT

$str   # string or undef

OUTPUT

'string'   # percent-encoded; undef gives ''

Each character outside the unreserved set is encoded from its code point, so a character above 0xFF must be encoded to UTF-8 bytes first (Encode::encode_utf8). The application only passes ASCII column names and specs.

AUTHOR

Nigel Horne <njh@nigelhorne.com>

LICENCE AND COPYRIGHT

Copyright 2026 Nigel Horne.

Usage is subject to the GPL2 licence terms.