SPVM::Native(3)
π SPVM::Native π
okay so bestie, welcome to SPVM::Native(3) β it's part of the User Contributed Perl Documentation and honestly? it's giving control room energy. This is the class that lets you reach out and grab the current native environment, stack, runtime, and compiler. iykyk π
β¨ Name β¨
SPVM::Native β the class for getting the current native environment, stack, runtime, and compiler. no cap, that's the whole vibe. π¦
πΈ Description πΈ
So the Native class of SPVM is the plug π
. It's got methods to get the current native environment, the stack, the runtime, and the compiler. literally the main character of "what's going on right now" energy. π
π Usage π
use Native;
that's it. that's the whole ritual. π«Ά
π Class Methods π
β get_current_stack
static method get_current_stack : Native::Stack ();
Returns the current execution stack. the receipts, basically. π§Ύ
β get_current_env
static get_current_env : Native::Env ();
Returns the current execution environemnt. (yes bestie, the manpage really spells it "environemnt" β we do not fix, we respect the source π)
β get_current_runtime
static method get_current_runtime : Native::Runtime ();
Returns the current runtime. the whole engine room. π₯
β get_current_compiler
static method get_current_compiler : Native::Compiler ();
Returns the current compiler. the one doing all the actual thinking. π§
β check_bootstrap_method
static method check_bootstrap_method : void ($basic_type_name :
string);
Check the bootstrap method in the basic type $basic_type_name. like a vibe check but for bootstrap methods. β
β use
static method use : void (static method use : void ($class_name :
string, $file : string = undef, $line : int = -1));
Compiles the class $class_name using the compiler of the current runtime. that's the whole thing. slay. β¨
β use_anon_class
static method use_anon_class : string ($source : string, $file : string
= undef, $line : int = -1);
Compiles the anon class source $source using the compiler of the current runtime. anonymous but make it iconic. π
β eval
static method eval : object ($eval_source : string);
This method emulates Perl's string eval <https://perldoc.perl.org/functions/eval#String-eval>. (yes, the link is literally in the docs, we keep it, we respect it π«‘)
This method creates the following source code.
"
class {
static method eval : object () {
#line 1
$eval_source
}
}
"
And calls compile_anon_class given this source code and gets the anon class name.
And calls call_class_method in the Native::MethodCall class.
Native::MethodCall->call_class_method($anon_class_name, "eval");
Examples:
my $value = (Int)Native->eval("my $total = 1 + 2; return $total;");
say $value->value;
lowkey obsessed with the fact that you can just. eval a string. in SPVM. from Perl. π
β inc
static method inc : string[] ();
Returns the current serach directories of the class search directories of the compiler of the current runtime. (again β "serach" is exactly what the docs say, we are not correcting it, periodt π )
β set_inc
static method set_inc : void ($include_dirs : string[]);
Set the current serach directories $include_dirs to the class search directories of the compiler of the current runtime. full replacement, no leftovers. π
β push_inc
static method push_inc : void ($include_dir : string);
Add the class search directory $include_dir at the tail of the class search directories of the compiler of the current runtime. goes to the back of the line, respectfully. πΆββοΈ
β unshift_inc
static method unshift_inc : void ($include_dir : string);
Add the class search directory $include_dir at the head of the class search directories of the compiler of the current runtime. cuts the line, but make it legal. π
π Copyright & License π
Copyright (c) 2023 Yuki Kimoto
MIT License
and that's the tea, bestie π β this page was served up as SPVM::Native(3) from perl v5.42.2, dated 2026-02-03. go forth and get your current native environment. ππ¦β¨
π¦ where this page comes from
- alpine 3.24: spvm-doc 0.990125-r0 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms