Skip to main content

Module util

Module util 

Source
Expand description

Parser utilities and helpers. Tokenization utilities shared by parser-facing entry points.

Helpers in this module identify Perl data-section markers (__DATA__ and __END__) using lexer tokens, so callers can safely split executable code from trailing payload without matching markers embedded in strings, heredocs, or POD content.

Functionsยง

code_slice
Helper to get the code portion of text (before DATA/END)
find_data_marker_byteDeprecated
Find the byte offset of a DATA or END marker in the source text. Returns the byte offset of the start of the marker line, or None if not found.
find_data_marker_byte_lexed
Find the byte offset of a DATA or END marker in the source text. Uses the lexer to avoid false positives in heredocs/POD. Returns the byte offset of the start of the marker, or None if not found.
split_code_and_data
Split source text into executable code and optional trailing data section.