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

App::hopen::Util::String - string utilities for hopen

SYNOPSIS

A collection of miscellaneous string utilities.

FUNCTIONS

line_mark_string

Add a #line directive to a string. Usage:

    my $str = line_mark_string <<EOT ;
    $contents
    EOT

or

    my $str = line_mark_string __FILE__, __LINE__, <<EOT ;
    $contents
    EOT

In the first form, information from caller will be used for the filename and line number.

The #line directive will point to the line after the line_mark_string invocation, i.e., the first line of <C$contents>. Generally, $contents will be source code, although this is not required.

$contents must be defined, but can be empty.

eval_here

eval a string, but first, add a #line directive. Usage:

    eval_here <<EOT
    $code_to_run
    EOT

The #line directive will point to the line after the eval_here invocation, i.e., the first line of <C$code_to_run>.

$code_to_run must be defined, but can be empty.

The return value is the return value of the eval. eval_here does not check $@; that is the caller's responsibility.