Eval::LineNumbers(3)
okay so bestie, weβre looking at Eval::LineNumbers β yes, the Eval::LineNumbers(3) manual page β and itβs giving βmake my heredoc line numbers behaveβ realness π
β¨
β¨ NAME β¨
Eval::LineNumbers β add line numbers to heredoc blocks that contain perl source code. periodt π
π VERSION π
version 0.35 π
π¦ SYNOPSIS π¦
bestie, the vibes in code form:
use Eval::LineNumbers qw(eval_line_numbers);
eval eval_line_numbers(<<END_HEREIS);
code
END_HEREIS
eval eval_line_numbers($caller_level, $code)
πΈ DESCRIPTION πΈ
okay so the whole point: add a #line "this-file" 392 comment to heredoc/hereis text that is going to be eval'ed so that error messages will point back to the right place. iconic. β¨
Please note: when you embed"\n"in your code, it gets expanded in double-quote hereis documents so it will mess up your line numbering. Use"\\n"instead when you can. π
π Caller Level Example π
The second form of eval_line_numbers where a caller-level is provided is for the situation where the code is generated in one place and eval'ed in another place. The caller level should be the number of stack levels between where the heredoc was created and where it is eval'ed. iykyk π«Ά
sub example {
return <<END_HEREIS
code
END_HEREIS
}
eval eval_line_numbers(1, example())
π FUNCTIONS π
All functions are exportable on request, but not by default. no pressure π«Ά
π eval_line_numbers π
eval eval_line_numbers($code);
eval eval_line_numbers($caller_level, $code);
π eval_line_numbers_offset π
eval_line_numbers_offset $offset;
Sets the offset, which is by default 1. The offset is file scoped. This is useful if you want to pass a string without a heredoc. For example:
eval_line_numbers_offset 0;
eval eval_line_numbers q{
die "here";
};
π AUTHOR π
Original author: David Muir Sharnoff
Current maintainer: Graham Ollis <plicease@cpan.org>
Contributors:
- Olivier MenguΓ© (DOLMEN)
- David Steinbrunner (dsteinbrunner)
- Alexey Ugnichev (thaewrapt)
π COPYRIGHT AND LICENSE π
This software is Copyright (c) 2009-2021 by David Muir Sharnoff.
This is free software, licensed under:
The GNU Lesser General Public License, Version 2.1, February 1999
mwah π β signed off by perl v5.42.0, dated 2021-07-17, and this is the Eval::LineNumbers(3) page. byeee πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-Eval-LineNumbers 0.35-bp160.1.12 Β· Artistic-2.0 OR LGPL-2.1-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms